Commit b9e64431 authored by Stefan Kohlbrecher's avatar Stefan Kohlbrecher Committed by Ken Tossell
Browse files

Fix ROS image output for uyvy uvc frame format input (#51)

parent e1886d04
...@@ -185,8 +185,13 @@ void CameraDriver::ImageCallback(uvc_frame_t *frame) { ...@@ -185,8 +185,13 @@ void CameraDriver::ImageCallback(uvc_frame_t *frame) {
image->encoding = "rgb8"; image->encoding = "rgb8";
memcpy(&(image->data[0]), frame->data, frame->data_bytes); memcpy(&(image->data[0]), frame->data, frame->data_bytes);
} else if (frame->frame_format == UVC_FRAME_FORMAT_UYVY) { } else if (frame->frame_format == UVC_FRAME_FORMAT_UYVY) {
image->encoding = "yuv422"; uvc_error_t conv_ret = uvc_uyvy2bgr(frame, rgb_frame_);
memcpy(&(image->data[0]), frame->data, frame->data_bytes); if (conv_ret != UVC_SUCCESS) {
uvc_perror(conv_ret, "Couldn't convert frame to RGB");
return;
}
image->encoding = "bgr8";
memcpy(&(image->data[0]), rgb_frame_->data, rgb_frame_->data_bytes);
} else if (frame->frame_format == UVC_FRAME_FORMAT_YUYV) { } else if (frame->frame_format == UVC_FRAME_FORMAT_YUYV) {
// FIXME: uvc_any2bgr does not work on "yuyv" format, so use uvc_yuyv2bgr directly. // FIXME: uvc_any2bgr does not work on "yuyv" format, so use uvc_yuyv2bgr directly.
uvc_error_t conv_ret = uvc_yuyv2bgr(frame, rgb_frame_); uvc_error_t conv_ret = uvc_yuyv2bgr(frame, rgb_frame_);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment