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

CameraInfo | use image topic #821

Open
DasSchilli opened this issue Aug 6, 2021 · 3 comments
Open

CameraInfo | use image topic #821

DasSchilli opened this issue Aug 6, 2021 · 3 comments

Comments

@DasSchilli
Copy link

Hello,
thank you for these ingenious plugins. I have a question regarding the CameraInfo DisplayType. As soon as I select an image of type sensor_msgs/Image (image::encodingsMONO16), the program crashes. Would it be possible to support more formats except RGB or is this not possible?

@knorth55
Copy link
Member

knorth55 commented Aug 6, 2021

yes it is possible, but we do not have enough resource.
we want you to change the following codes and make a PR if possible.
https://github.com/jsk-ros-pkg/jsk_visualization/blob/master/jsk_rviz_plugins/src/camera_info_display.cpp

@DasSchilli
Copy link
Author

ok, now I can select an image with an image::encodings::TYPE_16UC1, but it crashes because of the methods drawImageTexture(). Sorry I am new to openCV and cannot understand what happens exactly in this method.

@knorth55
Copy link
Member

image_ is considered as RGB8, so you need to change cv_ptr from 16UC1 to RGB8 before https://github.com/jsk-ros-pkg/jsk_visualization/blob/master/jsk_rviz_plugins/src/camera_info_display.cpp#L411.

how you can do it is first change it from 16UC1 to 8UC1, and then change it to RGB8.
something like these.

cv::Mat gray_image;
cv::normalize(cv_ptr->image, gray_image, cv::NORM_MINMAX, 0, 255);
image_ = cv::cvtColor(gray_image, cv::COLOR_GRAY2RGB);

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

No branches or pull requests

2 participants