import cv2 import numpy as np cap = cv2.VideoCapture(0) # set blue thresh 设置HSV中蓝色.天蓝色范围 lower_blue = np.array([78,43,46]) upper_blue = np.array([110,255,255]) while(1): # get a frame and show 获取视频帧并转成HSV格式, 利用cvtColor()将BGR格式转成HSV格式,参数为cv2.COLOR_BGR