Skip to content

image_view:set CvtColorForDisplay encoding as bgr8 #1071

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

Merged
merged 3 commits into from
Feb 13, 2025

Conversation

zycczy
Copy link
Contributor

@zycczy zycczy commented Feb 12, 2025

based on issue 1021, Fix the issue that the input image encoding as yuv, error to show

Fix the issue that the input image encoding as yuv, error to show

Signed-off-by: Zhaoyuan Cheng <[email protected]>
@zycczy
Copy link
Contributor Author

zycczy commented Feb 12, 2025

Test result as below
Image

@@ -214,7 +214,7 @@ void ImageViewNode::imageCb(const sensor_msgs::msg::Image::ConstSharedPtr & msg)
}
}

std::string encoding = msg->encoding.empty() ? "bgr8" : msg->encoding;
std::string encoding = "bgr8";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't the right fix - it would likely break mono8 usage.

If a particular encoding doesn't work for display, we should add a special rule for it below (see line 220-222 where we override bayer to mono8 - you can add another rule there for your yuv format that doesn't currently work)

@zycczy
Copy link
Contributor Author

zycczy commented Feb 13, 2025

Hi @mikeferguson
I add a special rule for the YUV format in the same way as the existing rule for Bayer format. Here is the updated code:

This change ensures that if the input image encoding is YUV, it will be converted to BGR8 for display, while still handling other encodings appropriately.

@ahcorde ahcorde merged commit cebd97a into ros-perception:rolling Feb 13, 2025
4 checks passed
@ahcorde
Copy link
Contributor

ahcorde commented Feb 13, 2025

https://github.com/Mergifyio backport jazzy humble

Copy link
Contributor

mergify bot commented Feb 13, 2025

backport jazzy humble

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Feb 13, 2025
Signed-off-by: Zhaoyuan Cheng <[email protected]>
(cherry picked from commit cebd97a)
mergify bot pushed a commit that referenced this pull request Feb 13, 2025
Signed-off-by: Zhaoyuan Cheng <[email protected]>
(cherry picked from commit cebd97a)

# Conflicts:
#	image_view/src/image_view_node.cpp
ahcorde pushed a commit that referenced this pull request Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants