Ask Your Question

imshow data types?

asked 2019-02-22 05:58:52 -0500

aguila gravatar image

hello! i am havind a problem with the imshow function, according to the documentation it supports Mat of different types than CV_8U imshow_doc, i have been using it on other opencv versions and it works (example opencv 3.4.1).. The Mat that i want to show is CV_64F type, i tried also with CV_16U but i get the same assertion error, i checked the source file:

OpenCV(4.0.0) c:\build\master_winpack-build-win64-vc15\opencv\modules\highgui\src\window_w32.cpp:1230: error: (-215:Assertion failed) == (uchar*)dst_ptr in function 'cvShowImage'

and my temporary solution would be to comment that assertion but i am not sure if that would bring other problems. I see in the assertion that it is expecting a uchar data.. maybe thats why it gets error with other types?? Has someone experienced something similar? or has any ideas?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-02-22 06:52:31 -0500

berak gravatar image

there was a shortlived bug in early 4.0, where imshow only could show 8U images, seems you got that.

in the long run: -- update your codebase, it's fixed now.

for now: do your own conversion to CV_8U before calling imshow():

img.convertTo(img, CV_8U, 255);
imshow("lalala", img);
edit flag offensive delete link more


thank you for the answer! okay i will update to the latest release..

aguila gravatar imageaguila ( 2019-02-22 07:02:49 -0500 )edit

Question Tools

1 follower


Asked: 2019-02-22 05:58:52 -0500

Seen: 351 times

Last updated: Feb 22 '19