opencv 基本阅读和图像显示
示例
import cv2
image_path= #put your image path here
#use imread() function to read image data to variable img.
img = cv2.imread(image_path)
#display image data in a new window with title 'I am an image display window'
cv2.imshow('I am an image display window',img)
#wait until user hits any key on keyboard
cv2.waitKey(0)
#close any windows opened by opencv
cv2.destroyAllWindows()要控制屏幕上显示窗口的大小,请在命令之前添加以下命令cv2.imshow:
window_width=800 #size of the display window on the screen
window_height=600
#open an empty window with a title.
#The flagcv2.WINDOW_NORMALallows the window to be scaleable.
cv2.namedWindow('I am an image display window', cv2.WINDOW_NORMAL)
#scale the image display window to desired size
cv2.resizeWindow('I am an image display window', window_width, window_height)有关更多详细信息,请参见openCV文档
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短