2020
10-01
10-01
opencv+python实现鼠标点击图像,输出该点的RGB和HSV值
我就废话不多说了,大家还是直接看代码吧!importcv2#读取图片并缩放方便显示img=cv2.imread('D:/6.jpg')height,width=img.shape[:2]size=(int(width*0.2),int(height*0.2))#缩放img=cv2.resize(img,size,interpolation=cv2.INTER_AREA)#BGR转化为HSVHSV=cv2.cvtColor(img,cv2.COLOR_BGR2HSV)#鼠标点击响应事件defgetposHsv(event,x,y,flags,param):ifevent==cv2.EVENT_LBUTTONDOWN:print("HS...
继续阅读 >