从documantation,它说我们可以通过CV_WINDOW_KEEPRATIO来保持图像比例,但是在调整窗口后,窗口仍然失去了宽高比。有人可以帮忙吗?
示例代码:
import cv2
# load the image, clone it, and setup the mouse callback function
image = cv2.imread('1.jpg')
cv2.namedWindow('image', cv2.WINDOW_KEEPRATIO)
# keep looping until the 'q' key is pressed
while True:
# display the image and wait for a keypress
cv2.imshow('image', image)
key = cv2.waitKey()
if key == 27:
break
# close all open windows
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4242 次 |
| 最近记录: |