Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YUV420 support #166

Open
wants to merge 2 commits into
base: noetic-devel
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion sensor_msgs/include/sensor_msgs/image_encodings.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ namespace sensor_msgs
// This is the UYVY version of YUV422 codec http://www.fourcc.org/yuv.php#UYVY
// with an 8-bit depth
const std::string YUV422="yuv422";
// YUV420 format, 12 bits per pixel
const std::string YUV420="yuv420";

// Prefixes for abstract image encodings
const std::string ABSTRACT_ENCODING_PREFIXES[] = {
Expand Down Expand Up @@ -176,6 +178,9 @@ namespace sensor_msgs
if (encoding == YUV422)
return 2;

if (encoding == YUV420)
return 1;

throw std::runtime_error("Unknown encoding " + encoding);
return -1;
}
Expand Down Expand Up @@ -221,7 +226,7 @@ namespace sensor_msgs
return atoi(prefix.c_str()); // valid encoding string
}

if (encoding == YUV422)
if (encoding == YUV422 || encoding == YUV420)
return 8;

throw std::runtime_error("Unknown encoding " + encoding);
Expand Down