Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libuvc_ros
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
ADC
external
libuvc_ros
Commits
069bc5b5
Commit
069bc5b5
authored
5 years ago
by
Ryosuke Tajima
Committed by
Ken Tossell
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add monochrome format support (#54)
parent
a56465ac
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libuvc_camera/src/camera_driver.cpp
+12
-0
12 additions, 0 deletions
libuvc_camera/src/camera_driver.cpp
with
12 additions
and
0 deletions
libuvc_camera/src/camera_driver.cpp
+
12
−
0
View file @
069bc5b5
...
...
@@ -192,6 +192,16 @@ void CameraDriver::ImageCallback(uvc_frame_t *frame) {
}
image
->
encoding
=
"bgr8"
;
memcpy
(
&
(
image
->
data
[
0
]),
rgb_frame_
->
data
,
rgb_frame_
->
data_bytes
);
}
else
if
(
frame
->
frame_format
==
UVC_FRAME_FORMAT_GRAY8
)
{
image
->
encoding
=
"8UC1"
;
image
->
step
=
image
->
width
;
image
->
data
.
resize
(
image
->
step
*
image
->
height
);
memcpy
(
&
(
image
->
data
[
0
]),
frame
->
data
,
frame
->
data_bytes
);
}
else
if
(
frame
->
frame_format
==
UVC_FRAME_FORMAT_GRAY16
)
{
image
->
encoding
=
"16UC1"
;
image
->
step
=
image
->
width
*
2
;
image
->
data
.
resize
(
image
->
step
*
image
->
height
);
memcpy
(
&
(
image
->
data
[
0
]),
frame
->
data
,
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_
);
...
...
@@ -318,6 +328,8 @@ enum uvc_frame_format CameraDriver::GetVideoMode(std::string vmode){
return
UVC_COLOR_FORMAT_MJPEG
;
}
else
if
(
vmode
==
"gray8"
)
{
return
UVC_COLOR_FORMAT_GRAY8
;
}
else
if
(
vmode
==
"gray16"
)
{
return
UVC_COLOR_FORMAT_GRAY16
;
}
else
{
ROS_ERROR_STREAM
(
"Invalid Video Mode: "
<<
vmode
);
ROS_WARN_STREAM
(
"Continue using video mode: uncompressed"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment