Image not displaying with imshow() OpenCV

倾然丶 夕夏残阳落幕 提交于 2019-12-25 08:38:04

问题


I'm getting a weird issue (but no error) when loading in an image and trying to display it. Here's the code I'm using:

import numpy as np  
import cv2  

# I'm using the full-path in the actual document   
img = cv2.imread('shapes.jpg')  
gray = cv2.imread('shapes.jpg',0)  

#not displaying anything currently  
cv2.imshow('gray', img)  
cv2.waitKey(0)  
cv2.destroyAllWindows()  

What I do get is the top part of a window. When using cv2.namedWindow('gray', cv2.WINDOW_NORMAL), I'm able to maximize the image and I can see that it does load the image, but it's surrounded by gray.

Any thoughts?

来源:https://stackoverflow.com/questions/44639948/image-not-displaying-with-imshow-opencv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!