ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to use ROS gscam to get grayscale image

asked 2013-12-01 04:20:11 -0500

PaulYang gravatar image

updated 2013-12-01 20:25:41 -0500

tfoote gravatar image

I am using ubuntu 12.04, ROS hydro and gscam to read webcam. I can get color image easily by make

GSCAM_CONFIG="v4l2src device=/dev/video1 ! video/x-raw-yuv,framerate=30/1 ! ffmpegcolorspace"

Then I run gscam, rostopic /camera/image_raw gives me images.

However, I want to get single channel grayscale image from webcam directly, because my subsequent algorithms can only handle grayscale image (in opencv, the mat entries are CV_8UC1).

I tried

GSCAM_CONFIG="v4l2src device=/dev/video1 ! video/x-raw-yuv,framerate=30/1 ! videobalance saturation=0.0 ! ffmpegcolorspace"

It does make the output image looks as grayscale, but rostopic /camera/image_raw still have 3 channels instead of channel 1. (/camera/image_raw/step is three times of /camera/image_raw/width).

How can I get single channel image from gscam? (/camera/image_raw/step equals to /camera/image_raw/width)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-11-23 13:55:45 -0500

tfoote gravatar image

It's possible the driver doesn't support that.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-12-01 04:20:11 -0500

Seen: 573 times

Last updated: Nov 23 '14