0
votes

i tried to run the tutorial code for object detection. i have logitech c170 webcam with me. i am not able to run any tutorial codes with this cam connected.

HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP --(!) No captured frame -- Break!

but the same program runs effectively with my built in webcam. since i am a newbie to openCV i am not able to understand the mistakes.

when i took the details of the both cams(built in and logitech c170) using

v4l2-ctl --device=/dev/video0 --all

Driver Info (not using libv4l2): Driver name : uvcvideo Card type : Webcam C170 Bus info : usb-0000:00:1d.0-1.2 Driver version: 3.2.50 Capabilities : 0x04000001 Video Capture Streaming Format Video Capture: Width/Height : 640/480 Pixel Format : 'MJPG' Field : None Bytes per Line: 0 Size Image : 921600 Colorspace : SRGB Crop Capability Video Capture: Bounds : Left 0, Top 0, Width 640, Height 480 Default : Left 0, Top 0, Width 640, Height 480 Pixel Aspect: 1/1 Video input : 0 (Camera 1: ok) Streaming Parameters Video Capture: Capabilities : timeperframe Frames per second: 30.000 (30/1) Read buffers : 0

i got the difference that the pixel formats of both are different. the built in cam is YUYV while logitech is MJPG. more over i am completely unaware of MJPG format..i tried to change the formate to YUYV using

v4l2-ctl --device=/dev/video1 --set-fmt-video=width=640,height=480,pixelformat=0

i could change the format.but when i run the program again the error repeats the format is again changed to MJPG by the system.

consider me as smallest guy in OpenCV..

1

1 Answers

0
votes

I've been trying to use my Logitech C170 with the V4L2 API for a couple of days, and capturing YUYV uncompressed images doesn't seem to work in 640x480 nor 640x360 resolutions. Waiting for the frame buffer filling makes V4L2 stall.

But that works well with all the other resolutions reported in the UVC capabilities, e.g. 352x288, 320x240, 176x144, 160x120, 544x288, 432x240 and 320x176.

For 640x480 resolution, I've only managed to dump JFIF compressed frames from the camera.

Maybe you could make your codes work with this camera if you try image widths lowerer than 640 pixels.