标签:image lin mp4 read pen render cell color 灰度
import cv2 #opencv读取的格式是BGR import matplotlib.pyplot as plt import numpy as np %matplotlib inline img=cv2.imread(‘cat.jpg‘)
#图像的显示,也可以创建多个窗口 cv2.imshow(‘image‘,img) # 等待时间,毫秒级,0表示任意键终止 cv2.waitKey(0) cv2.destroyAllWindows()
def cv_show(name,img): cv2.imshow(name,img) cv2.waitKey(0) cv2.destroyAllWindows()
vc = cv2.VideoCapture(‘test.mp4‘) # 检查是否打开正确 if vc.isOpened(): oepn, frame = vc.read() else: open = False
while open: ret, frame = vc.read() if frame is None: break if ret == True: gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) cv2.imshow(‘result‘, gray) if cv2.waitKey(100) & 0xFF == 27: break vc.release() cv2.destroyAllWindows()
标签:image lin mp4 read pen render cell color 灰度
原文地址:https://www.cnblogs.com/exciting/p/10374610.html