美文网首页
opencv-python

opencv-python

作者: lk_erzanml | 来源:发表于2022-01-07 17:16 被阅读0次

安装的时候一定要注意,安装和python对应的版本https://www.lfd.uci.edu/~gohlke/pythonlibs/#wordcloud
下载whl,然后pip install .whl文件

import numpy as np
import cv2 as cv

img = cv.imread('u=4198287529,2774471735&fm=193&f=GIF.jpeg',0) #read photo
cv.namedWindow('photo_title',cv.WINDOW_NORMAL)
cv.imshow('photo_title',img)
cv.waitKey(0)
cv.destroyAllWindows()
import numpy as np
import cv2 as cv

img = cv.imread('u=4198287529,2774471735&fm=193&f=GIF.jpeg',0) #read photo
cv.namedWindow('photo_title',cv.WINDOW_NORMAL)
cv.imshow('photo_title',img)
k = cv.waitKey(0)
if k == 27:         # 等待ESC退出
    cv.destroyAllWindows()
elif k == ord('s'): # 等待关键字,保存和退出
    cv.imwrite('messigray.png',img)
    cv.destroyAllWindows()
import numpy as np
import cv2 as cv
# 创建黑色的图像
img = np.zeros((512,512,3), np.uint8)
# 绘制一条厚度为5的蓝色对角线
cv.line(img,(0,0),(511,511),(255,0,0),5)
cv.imshow('photo_title',img)
cv.waitKey(0)
cv.destroyAllWindows()

相关文章

网友评论

      本文标题:opencv-python

      本文链接:https://www.haomeiwen.com/subject/mtnjcrtx.html