我的图像是6400×3200,而我的屏幕是1280 x 800.因此,图像需要调整大小才能显示.我正在使用Python和OpenCV 2.4.9.根据OpenCV文档,
如果需要显示大于屏幕分辨率的图像,则需要在imshow之前调用namedWindow("",WINDOW_NORMAL).
这就是我正在做的,但图像不适合屏幕,只显示一部分,因为它太大了.我也试过cv2.resizeWindow,但它没有任何区别.
import cv2
cv2.namedWindow("output", cv2.WINDOW_NORMAL) # Create window with freedom of dimensions
# cv2.resizeWindow("output", 400, 300) # Resize window to specified dimensions
im = cv2.imread("earth.jpg") # Read image
cv2.imshow("output", im) # Show image
cv2.waitKey(0) # Display the image infinitely until any keypress
Run Code Online (Sandbox Code Playgroud)