Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

YUV420 support #166

Closed
Closed
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