ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

display a 16-bit grayscale images from a thermal camera in OpenCV

asked 2019-04-15 03:22:04 -0600

Khalaf90 gravatar image

updated 2019-10-11 20:12:49 -0600

I would like to display a 16-bit grayscale images from a thermal camera in OpenCV. I tried different images' encoding but what I get is either totally black or totally white picture. my code looks like this:

void imageCallback(const sensor_msgs::ImageConstPtr& img)
{
             cv_bridge::CvImagePtr cv_ptr;
             cv_ptr = cv_bridge::toCvCopy(img);
             cv::imshow("16-bit Mono", cv_ptr->image);
             cv::waitKey(1);
}
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-10-11 20:15:34 -0600

Khalaf90 gravatar image

updated 2019-10-15 17:26:54 -0600

in case that someone face the same problem in the future, the solution is to convert from 16 bit to 8 bit per pixel using:

  cv::normalize(img,img,0.,255.,cv::NORM_MINMAX,CV_8U);
edit flag offensive delete link more

Comments

Thank you.

Gomimaker gravatar image Gomimaker  ( 2023-04-17 20:38:22 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-04-15 03:22:04 -0600

Seen: 4,608 times

Last updated: Oct 15 '19