0
votes

I am getting an error when I run the following sample display image program in my Dell Inspiron 15R windows 8.1 64 bit system

import numpy as np
import cv2

img = cv2.imread('G:/space.jpg',0)
cv2.imshow('image',img)
cv2.waitKey(0) & 0xFF
cv2.destroyAllWindows()

And the error which I am getting at the command prompt is:

Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\Ankit>python G:/messi.py

OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in unknown function, file C:\slave\WinInstallerMegaPack\src\opencv\modules\core\src\array.cpp, line 2482

Traceback (most recent call last):

File "G:/messi.py", line 5, in

cv2.imshow('image',img)

cv2.error: C:\slave\WinInstallerMegaPack\src\opencv\modules\core\src\array.cpp:2

482: error: (-206) Unrecognized or unsupported array type

Please help! I am a novice in opencv.

1
Maybe the image couldn't be read. You might want to print img to check if it's valid. See the imread documentation for more information. - Falko
Thanks a lot! I replaced .jpg formatted image with other .bmp formatted image and it worked. - Ankit Kumar

1 Answers

0
votes

Apparently the image couldn't be read. You might want to print img to check if it's valid. See the imread documentation for more information.