yangh / uvcvideo

uvcvideo driver with still image capture support
70 stars 48 forks source link

Compiling uvcvideo #1

Open lefsky opened 9 years ago

lefsky commented 9 years ago

I am a scientist who needs a program to capture still images from a UVC camera. I have tried to compile this program under fedora 20 but have had two problems:

1) The definition of v4l_printk_ioctl seems to have changed- it now requires a prefix. To get around this problem, I simply commented out this line- it seems to be used to log information and thought I could do without it

2) Now I get the error "No rule to make target /home/lefsky/uvcvideo/uvcvideo-master/uvc/uvc_entity.o', needed by/home/lefsky/uvcvideo/uvcvideo-master/uvc/uvcvideo.o'.

Can you please advise?

M

yangh commented 9 years ago

Sorry for that I didn't include the uvc_entity.c in the repository, please download the following file in to the uvc source tree and try again.

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/drivers/media/video/uvc/uvc_entity.c?id=refs/tags/v3.2.71

lefsky commented 9 years ago

Thank you for that clarification. I have gotten the code to compile, but when I run "vc" I receive the following message:

./vc -d /dev/video0 -x 4912 -y 3684 -s

Set still format: 4912x3684, format: YUYV VIDIOC_S_FMT Still error 22, Invalid argument

Can you advise?

M

On Wed, Aug 26, 2015 at 4:21 AM, Yang Hong notifications@github.com wrote:

Sorry for that I didn't include the uvc_entity.c in the repository, please download the following file in to the uvc source tree and try again.

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/drivers/media/video/uvc/uvc_entity.c?id=refs/tags/v3.2.71

— Reply to this email directly or view it on GitHub https://github.com/yangh/uvcvideo/issues/1#issuecomment-134935376.

Michael Lefsky Center for Ecological Applications of Lidar College of Natural Resources Colorado State University http://www.researcherid.com/rid/A-7224-2009

If I were creating the world I wouldn't mess about with butterflies and daffodils. I would have started with lasers, eight o'clock, Day One! - Time Bandits

lefsky commented 9 years ago

I should say that the resulT of v4l2-ctl --list-formats-ext

is:

ioctl: VIDIOC_ENUM_FMT Index : 0 Type : Video Capture Pixel Format: 'YUYV' Name : YUV 4:2:2 (YUYV) Size: Discrete 1920x1080 Interval: Discrete 0.033 s (30.000 fps) Size: Discrete 4912x3684 Interval: Discrete 0.033 s (30.000 fps) Size: Discrete 1280x720 Interval: Discrete 0.033 s (30.000 fps)

On Mon, Aug 31, 2015 at 1:41 PM, lefsky@gmail.com lefsky@gmail.com wrote:

Thank you for that clarification. I have gotten the code to compile, but when I run "vc" I receive the following message:

./vc -d /dev/video0 -x 4912 -y 3684 -s

Set still format: 4912x3684, format: YUYV VIDIOC_S_FMT Still error 22, Invalid argument

Can you advise?

M

On Wed, Aug 26, 2015 at 4:21 AM, Yang Hong notifications@github.com wrote:

Sorry for that I didn't include the uvc_entity.c in the repository, please download the following file in to the uvc source tree and try again.

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/drivers/media/video/uvc/uvc_entity.c?id=refs/tags/v3.2.71

— Reply to this email directly or view it on GitHub https://github.com/yangh/uvcvideo/issues/1#issuecomment-134935376.

Michael Lefsky Center for Ecological Applications of Lidar College of Natural Resources Colorado State University http://www.researcherid.com/rid/A-7224-2009

If I were creating the world I wouldn't mess about with butterflies and daffodils. I would have started with lasers, eight o'clock, Day One! - Time Bandits

Michael Lefsky Center for Ecological Applications of Lidar College of Natural Resources Colorado State University http://www.researcherid.com/rid/A-7224-2009

If I were creating the world I wouldn't mess about with butterflies and daffodils. I would have started with lasers, eight o'clock, Day One! - Time Bandits

yangh commented 8 years ago

I think you should insmod new uvcvideo kernel module, and make sure use size from STILL Capture format.

sreyasvpariyath commented 8 years ago

Hi When I try to make -f Makefile.android I am getting the following error sudo make -f Makefile.android Password: make ARCH=arm CROSS_COMPILE=arm-eabi- -C /obj/KERNEL_OBJ M= modules make[1]: * No rule to make target `modules'. Stop. make: * [all] Error 2 any idea.?

yangh commented 8 years ago

Hi Sreyasvpariyath

I think you should setup android build environment before run 'make -f Makefile.android' command.

Sorry for lately reply

Best regards

rameshandroid commented 8 years ago

when i am compiling the code,getting compilations errors.

uvcvideo-master/uvc/uvc_v4l2.c:1244:3: error: too few arguments to function ‘v4l_printk_ioctl’ v4l_printk_ioctl(cmd);

Build logs :-

make -C /lib/modules/uname -r/build M=$PWD make[1]: Entering directory `/usr/src/linux-headers-3.19.0-25-generic' LD /home/sakhi/Downloads/uvcvideo-master/uvc/built-in.o CC [M] /home/sakhi/Downloads/uvcvideo-master/uvc/uvc_driver.o CC [M] /home/sakhi/Downloads/uvcvideo-master/uvc/uvc_queue.o CC [M] /home/sakhi/Downloads/uvcvideo-master/uvc/uvc_v4l2.o /home/sakhi/Downloads/uvcvideo-master/uvc/uvc_v4l2.c: In function ‘uvc_v4l2_ioctl’: /home/sakhi/Downloads/uvcvideo-master/uvc/uvc_v4l2.c:1244:3: warning: passing argument 1 of ‘v4l_printk_ioctl’ makes pointer from integer without a cast [enabled by default] v4l_printk_ioctl(cmd); ^ In file included from /home/sakhi/Downloads/uvcvideo-master/uvc/uvcv4l2.c:27:0: include/media/v4l2-ioctl.h:305:13: note: expected ‘const char ’ but argument is of type ‘unsigned int’ extern void v4l_printk_ioctl(const char prefix, unsigned int cmd); ^ /home/sakhi/Downloads/uvcvideo-master/uvc/uvc_v4l2.c:1244:3: error: too few arguments to function ‘v4l_printk_ioctl’ v4l_printk_ioctl(cmd); ^ In file included from /home/sakhi/Downloads/uvcvideo-master/uvc/uvc_v4l2.c:27:0: include/media/v4l2-ioctl.h:305:13: note: declared here extern void v4l_printk_ioctl(const char prefix, unsigned int cmd); ^ make[2]: _\ [/home/sakhi/Downloads/uvcvideo-master/uvc/uvc_v4l2.o] Error 1

Regards Ramesh

dasgo commented 8 years ago

I am using OpenCV and Python in Ubuntu to acquire still images from a usb camera (8Mp). Is this driver capturing images from a usb camera without any delay? When I use OpenCV I have a lag due to the internal buffer, I suppose it is caused by uvc driver, because it doesn't happen in Windows or in Mac.

Regards Dasgo

yangh commented 8 years ago

Hi rameshandroid

The current code is based on kernel 3.2, it's a bit older than yours 3.19. You need fix it by yourself.

BR.

yangh commented 8 years ago

Hi Dasgo

This driver is not widely tested/tunned, so may be lag on some camera. And I'm not sure if you have used the still image capture API provided by this driver.

Best regards.

rameshandroid commented 8 years ago

modified uvc_v4l2_ioctl function.now i am able to compile

static long uvc_v4l2_ioctl(struct file file,unsigned int cmd, unsigned long arg) { struct video_device vfd = video_devdata(file); if (uvc_trace_param & UVC_TRACE_IOCTL) { uvc_printk(KERN_DEBUG, "uvc_v4l2_ioctl executing \n"); v4l_printk_ioctl(video_device_node_name(vfd),cmd); }

return video_usercopy(file, cmd, arg, uvc_v4l2_do_ioctl);

}

PowerfulMoney commented 5 years ago

Hi, yangh Firstly, thank you for your nice program, it solves my "STILL IMAGE" problem! I am new for V4L2, after compiling this program under Ubuntu, I have 2 problem:

  1. In order to get a high-quality still image from a web camera(supports 4608x3456) timely ,I'd like to get directly the image by V4L2 without "streamon" and "streamoff", is it feasible? 2.It takes too long time to execute "xioctl(fd, VIDIOC_DQBUF, &buf);", maybe 3000ms, but the same process takes just 850ms by "DirectX Show" under Windows, the reason is the platform or the src? In addition, are you in Beijing now? Maybe we can discuss the problem by phone. Good luck to you!