cv2.imshow is working with a jpg file but not with an array

asked 2016-06-01 15:24:48 -0600

updated 2018-10-26 16:12:50 -0600

HI, I am using python and try to use cv2.impshow :

img = cv2.imread('messi5.jpg',0) cv2.imshow('image',im[index]) cv2.waitKey(0) cv2.destroyAllWindows()

and it is working fine.

But when I try to replace img with a array of 96*96 with each elements have value between 0 to 255, then it display be a gray box.

If I try to use matplotlib, it is then nicely displayed. How could I display my array with cv2.imshow ?

Thank you for your help in advance,

Sébastien

edit retag flag offensive close merge delete

Comments

what is your testcase for this ?

berak gravatar imageberak ( 2016-06-02 00:49:58 -0600 )edit