Ask Your Question
2

imshow() can't show CV_32F image

asked 2018-11-19 15:48:05 -0600

MN gravatar image

On the OpenCV(C++) version 4.0.0, imshow() can't show CV_32F images. Version 3.4.4 can show CV_32F images normaly, same like CV_8U. Why 4.0.0's imshow can't treat CV_32F? Is it a kind of specification change?

edit retag flag offensive close merge delete

Comments

os ? compiler ? exact error msg ?

berak gravatar imageberak ( 2018-11-19 15:50:24 -0600 )edit
1

reproduced (win10 / 4.0.0 / mingw64):

Mat m(400,400,CV_32F,Scalar(0.5));
imshow("M",m);
waitKey();

OpenCV(4.0.0-pre) Error: Assertion failed (dst.data == (uchar*)dst_ptr) in cvShowImage, file C:\p\opencv\modules\highgui\src\window_w32.cpp, line 1230
berak gravatar imageberak ( 2018-11-19 15:57:06 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-11-20 02:24:23 -0600

berak gravatar image

updated 2018-11-20 03:08:38 -0600

that's a bug !

until it gets fixed, you'll have to add a manual conversion before the imshow() call:

img.convertTo(img, CV_8U, 255); // [0..1] -> [0..255] range
imshow("win", img);
edit flag offensive delete link more

Comments

1

Thanks! It was a bag :(

MN gravatar imageMN ( 2018-11-20 03:14:05 -0600 )edit
berak gravatar imageberak ( 2018-11-27 01:10:44 -0600 )edit
1

yes, I'm keeping watching your exchanges on GitHub. Thanks. I wish this bag be fixed asap for all OpenCV users.

MN gravatar imageMN ( 2018-11-27 01:21:24 -0600 )edit
1

This bag has been fixed on OpenCV 4.0.1 now. Thanks berak!

MN gravatar imageMN ( 2019-01-03 03:42:17 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-19 15:48:05 -0600

Seen: 4,636 times

Last updated: Nov 20 '18