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

Add support for visualizing yuv422 #499

Merged
merged 3 commits into from
Apr 29, 2021
Merged
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
5 changes: 5 additions & 0 deletions image_tools/src/showimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ class ShowImage : public rclcpp::Node
return CV_32FC1;
} else if (encoding == "rgb8") {
return CV_8UC3;
} else if (encoding == "yuv422") {
return CV_8UC2;
} else {
throw std::runtime_error("Unsupported encoding type");
}
Expand All @@ -205,6 +207,9 @@ class ShowImage : public rclcpp::Node

if (msg->encoding == "rgb8") {
cv::cvtColor(frame, frame, cv::COLOR_RGB2BGR);
} else if (msg->encoding == "yuv422") {
msg->is_bigendian ? cv::cvtColor(frame, frame, cv::COLOR_YUV2BGR_UYVY) :
cv::cvtColor(frame, frame, cv::COLOR_YUV2BGR_YUYV);
}

cv::Mat cvframe = frame;
Expand Down