问题
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