usb_cam pkg gives garbled green screen
I have a ROS kinetic on my virtualbox. I tried to use "usbcam" pkg but it doesn't work. My web cam is connected directly to my PC and I can see the video through "cheese" or "camorama" but when I run usbcam pkg, I get garbled green screen both on "imageview" or directly on "rviz" for imageraw. I tried both yuyv and jpeg for pixel format but it doesn't work. Any suggestions ?
Asked by STrobotics on 2019-06-12 16:00:19 UTC
Answers
I had the same issue, to solve it you need to do the following: 1- check the output type format for the USB camera you're working with. 2- Mine was mjpeg so I had to modify the usb_cam-test.launch which can be found under the following directory: /opt/ros/noetic/share/usb_cam/launch/usb_cam-test.launch 3- Change "yuyv" to "mjpeg" in the launch file 4- Run the following node rosrun usb_cam usb_cam_node _pixel_format:=mjpeg 5- It should be working well right now. You can double-check by doing: rosrun image_view image_view image:=/usb_cam/image_raw
Asked by TKashmar on 2022-01-08 04:56:08 UTC
Comments
Is your camera connected as multiple devices? When I plug in my webcam and run
guvcview
, I get two devices named the same thing, but one produces a garbled green picture while the other is normal. In Ubuntu (if that's what you're using), you can get a list of video devices with:ls -ltrh /dev/video*
With only the webcam connected, I get:
Furthermore, I can stream one (the normal one) directly into ROS using the
video_stream_opencv
package, but the garbled one throws an error. Can you confirm that you're using the correct device?Asked by tryan on 2019-06-20 10:54:50 UTC
Exactly the same, I can get stream using video_stream_opencv but not usb_cam pkg. As you mentioned, I changed the video devices in the usb_cam launch file. I'm getting garbled green screen for /dev/video0 and "No image" for /dev/video1 when I'm looking at image_raw through rviz.
Asked by STrobotics on 2019-06-20 13:25:23 UTC
Does
usb_cam
throw any errors when trying to connect to the "normal" stream? Can you see output on the topic usingrostopic echo
?Asked by tryan on 2019-06-21 09:41:29 UTC
There is no error, the output of rostopic echo is normal(big matrix). It is weird that rviz can't display the image
Asked by STrobotics on 2019-06-26 09:52:58 UTC
Wait a second, it sounds like the output of rostopic echo doesn't change even if I cover the camera. It looks like it's the garbled green screen pixels
Asked by STrobotics on 2019-06-26 10:01:08 UTC
Have you used
rqt_graph
to make sure the topics are connected?Asked by tryan on 2019-06-28 09:24:39 UTC
Did you solve that issue, I'm in the same problem, and don't know how to fix it
Asked by quyetbui on 2021-08-04 05:08:46 UTC
If someone was able to solve this then please let me know, facing this smae issue.
Asked by Victor_Kash on 2021-08-16 13:08:25 UTC
https://www.programmersought.com/article/14297290711/ folow these instructions, may help you
Asked by quyetbui on 2021-08-22 11:49:41 UTC
@quyetbui: could you please summarise the article you link to, so we avoid link-only posts here?
And if it really solves the problem, please post it as an answer instead of a comment.
Asked by gvdhoorn on 2021-08-22 11:56:51 UTC