2021
03-16
03-16
Opencv对象追踪的示例代码
1HSV上下限颜色的HSV上下限如下表:2追踪单个颜色importcv2ascvimportnumpyasnpcap=cv.VideoCapture(0)lower_color=np.array([0,43,46])upper_color=np.array([10,255,255])whilecap.isOpened():#读取帧_,frame=cap.read()#转换颜色空间BGR到HSVhsv=cv.cvtColor(frame,cv.COLOR_BGR2HSV)#设置HSV的阈值使得只取某色mask=cv.inRange(hsv,lower_color,upper_color)#将掩膜和图像...
继续阅读 >