简体   繁体   English

在python OpenCV中运行示例显示图像程序时出错

[英]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 在Dell Inspiron 15R Windows 8.1 64位系统中运行以下示例显示图像程序时出现错误

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. Microsoft Windows [版本6.3.9600](c)2013 Microsoft Corporation。 All rights reserved. 版权所有。

C:\\Users\\Ankit>python G:/messi.py 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 OpenCV错误:未知函数(文件C:\\ slave \\ WinInstallerMegaPack \\ src \\ opencv \\ modules \\ core \\ src \\ array.cpp,行2482)中的错误标志(参数或结构字段)(无法识别或不受支持的数组类型)

Traceback (most recent call last): 追溯(最近一次通话):

File "G:/messi.py", line 5, in 文件“ G:/messi.py”,第5行,在

 cv2.imshow('image',img) 

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

482: error: (-206) Unrecognized or unsupported array type 482:错误:(-206)无法识别或不支持的数组类型

Please help! 请帮忙! I am a novice in opencv. 我是opencv的新手。

Apparently the image couldn't be read. 显然无法读取图像。 You might want to print img to check if it's valid. 您可能需要print img以检查其是否有效。 See the imread documentation for more information. 有关更多信息,请参见imread文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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