简体   繁体   中英

Error while running the sample display image program in python OpenCV

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM