Ask Your Question
0

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

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

Khalaf90 gravatar image

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

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

Khalaf90 gravatar image

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 68 times

Last updated: Oct 15