Error while running the sample display image program in python OpenCV
Question: 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.


Answer: Apparently the image couldn't be read. You might want to `print img` to check
if it's valid. See [the `imread`
documentation](http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html#imread)
for more information.

