0
$\begingroup$

Rosanswers logo

I have a Logitech c920 webcam that I want to use with ROS. I originally installed uvc_camera, but it gets a terrible quality image from the camera. Then I tried usb_cam, which gets a fantastic quality image, but only at 10fps (which just isn't good enough).

uvc_cam image

usb_camera image

So my question is: How do I get a good image out of uvc OR How do I set frame rate with usb_camera

It should be noted that guvcview gets a fantastic image using the uvc driver, though ros does not.

launch file contents:

FOR usb_cam:
<launch>
    <node name="camera" pkg="usb_cam" type="usb_cam_node" output="screen" >
        <param name="video_device" value="/dev/video1" />
        <param name="image_width" value="1280" />
        <param name="image_height" value="720" />
        <param name="pixel_format" value="yuyv" />
        <param name="camera_frame_id" value="webcam" />
    </node>
</launch>

FOR uvc_camera:
<launch>
  <node ns="camera" pkg="uvc_camera" type="camera_node" name="uvc_camera" output="screen">
    <param name="width" type="int" value="1280" />
    <param name="height" type="int" value="720" />
    <param name="fps" type="int" value="30" />
    <param name="frame" type="string" value="webcam" />
    <param name="device" type="string" value="/dev/video1" />
  </node>
</launch>

Originally posted by Slippery John on ROS Answers with karma: 51 on 2012-10-31

Post score: 3


Original comments

Comment by dinamex on 2012-11-21:
I have exactly the same problem with the weird color settings for the uvc_cam. To the slow frame rate of the usb_cam: do you use an usb2.0 port? $lsusb will show you...

Comment by Avio on 2016-09-12:
I have exactly the same problem with a BW analog cam (with USB dongle on video0): vlc shows the video correctly, cheese shows the video correctly, both usb_cam and uvc_camera show purple video with different shades of green/red. No matter what pixfmt parameter I set, they always fall back to YUYV.

Comment by Avio on 2016-09-12:
After a couple of hours spent fighting with this problem, I solved the issue. I discovered that the correct pixel format for my camera was "uyvy". For future reference, I used this launch file: https://siddhantahuja.wordpress.com/2011/07/20/working-with-ros-and-opencv-draft/

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Since you have Logitech C920, which has hardware H264 encoding which is an awesome thing. For usb_cam you can try it by changing the value of pixel_format to H264. Change <param name="pixel_format" value="yuyv" /> to <param name="pixel_format" value="H264" />. That should work and you'll get high fps with low resource usage.


Originally posted by sarkar with karma: 36 on 2013-10-27

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Artem on 2013-10-30:
If I do as you suggested I get [FATAL] [1383197110.463584559]: Unknown pixel format. [ERROR] [1383197110.463895717]: VIDIOC_STREAMOFF error 9, Bad file descriptor

Comment by Artem on 2013-10-30:
Okay uvc_cam accepts it, but the frame rate is still slow.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.