Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mobile_robotics
ADC
external
libuvc_ros
Commits
b9e64431
Commit
b9e64431
authored
Oct 29, 2018
by
Stefan Kohlbrecher
Committed by
Ken Tossell
Jul 06, 2019
Browse files
Fix ROS image output for uyvy uvc frame format input (#51)
parent
e1886d04
Changes
1
Hide whitespace changes
Inline
Side-by-side
libuvc_camera/src/camera_driver.cpp
View file @
b9e64431
...
...
@@ -185,8 +185,13 @@ void CameraDriver::ImageCallback(uvc_frame_t *frame) {
image
->
encoding
=
"rgb8"
;
memcpy
(
&
(
image
->
data
[
0
]),
frame
->
data
,
frame
->
data_bytes
);
}
else
if
(
frame
->
frame_format
==
UVC_FRAME_FORMAT_UYVY
)
{
image
->
encoding
=
"yuv422"
;
memcpy
(
&
(
image
->
data
[
0
]),
frame
->
data
,
frame
->
data_bytes
);
uvc_error_t
conv_ret
=
uvc_uyvy2bgr
(
frame
,
rgb_frame_
);
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
)
{
// FIXME: uvc_any2bgr does not work on "yuyv" format, so use uvc_yuyv2bgr directly.
uvc_error_t
conv_ret
=
uvc_yuyv2bgr
(
frame
,
rgb_frame_
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment