Robotics StackExchange | Archived questions

How to get an YUV422 Image with camera1394?

Hi Community,

we would like to use the camera1394 package, but we are unable to directly get an YUV422 coded Image from it, without conversion from RGB (or the like) to YUV422. Any hints, examples are welcome!

UPDATE

After a year, we asked the same question again and got a final answer: http://answers.ros.org/question/211539/camera-1394-uses-wrong-video-mode/

Asked by Stopfer on 2014-04-28 21:44:28 UTC

Comments

Answers

The IEEE 1394 Digital Camera standard specifies six modes that provide data in YUV422 format:

              Format0_Mode1: "320x240_yuv422"
              Format0_Mode3: "640x480_yuv422"
              Format1_Mode0: "800x600_yuv422"
              Format1_Mode3: "1024x768_yuv422"
              Format2_Mode0: "1280x960_yuv422"
              Format2_Mode3: "1600x1200_yuv422"

The question is whether your camera supports any of them. Try seting the video_mode parameter to the corresponding strings, from "320x240_yuv422" to "1600x1200_yuv422". If the device supports the corresponding mode, that parameter will be accepted, otherwise the device will reject it.

If the device does not support any of those modes, the camera1394 driver will not provide YUV422 data. It does not do conversions in software. You would need to write your own nodelet to provide that conversion.

UPDATE: The encoding should be: sensor_msgs::image_encodings::YUV422.

I don't know where you got that other link from, but that is the actual source. You can verify the encoding being published while the driver is running like this:

$ rostopic echo /camera/image_raw/encoding

It should print "yuv422" at the current frame rate, when you are in the correct mode.

The Camera1394 nodelet and camera1394_node both wrap the same driver. It is very unlikely that they would publish different encodings for the same video_mode.

Asked by joq on 2014-04-29 04:39:31 UTC

Comments

Thank you for your fast reply! We where able to set the right video_mode in the past with our own libdc1394 driver and setting the video mode seems to work with camera1394, too. We have problem by getting the image in the right format out of the camera1394 nodlet.

Here a little snippet to make it more clear:

image_subscriber_ = node_handle.subscribe("image", 1, &Camera::imageCB, this);

void Camera::imageCB(const sensor_msgs::ImageConstPtr& msg)
{
    if(startParams->verbose>=3) cout << "New image received: "  << msg->height <<"x" << msg->width << endl;
    cv_bridge::CvImageConstPtr cv_ptr;
    cv_ptr = cv_bridge::toCvShare(msg, enc::BGR8);
    cout << ".";
}

In sensor_msgs::encodings no string exists for yuv422 (see ros rep). So what whould be the right way ? Do we need a new encoding-string?

Asked by Stopfer on 2014-04-29 20:41:06 UTC

Comments

Please do not misuse this Q&A forum by posting additional questions as an "answer". Instead, you should edit your original question.

Asked by joq on 2014-04-30 03:54:39 UTC