安装opencv
图片 image.jpg的处理
import cv2
img = cv2.imread('image.jpg', 1)
cv2.circle(img,center=(200,200),radius=100,color=(0,0,255),thickness=10)
cv2.namedWindow("ttt",0)
cv2.imshow('ttt',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
视频的处理
import cv2
cap = cv2.VideoCapture(0)
#print("VideoCapture is opened?", cap.isOpened)
while(True):
ret, frame = cap.read()
#center = (frame.shape[1]//2, frame.shape[0]//2)
#gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
#cv2.circle(frame, center=(200, 200), radius=100, color=(0,0,255))
cv2.namedWindow("aaa",0)
cv2.imshow("aaa", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()