参考:https://blog.csdn.net/fjswcjswzy/article/details/105843455
import cv2
import numpy as np
from matplotlib import pyplot as plt
camera = cv2.VideoCapture("test1.avi")
(ret,image)=camera.read()
#image=cv2.imread('szy.png')这是直接标定图片
HSV=cv2.cvtColor(image,cv2.COLOR_BGR2HSV)
def getpos(event,x,y,flags,param):
if event==cv2.EVENT_LBUTTONDOWN: #定义一个鼠标左键按下去的事件
print(HSV[y,x])
cv2.imshow("imageHSV",HSV)
cv2.imshow('image',image)
cv2.setMouseCallback("imageHSV",getpos)
cv2.waitKey(0)
在hsv图里点击,就可输出该点的精确的hsv的值: