1
Former-commit-id: 1b34dc488f5306fcb5d20746c217255bb9ead3c5
This commit is contained in:
11
test2.py
Normal file
11
test2.py
Normal file
@ -0,0 +1,11 @@
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
cap = cv2.VideoCapture(2) # 使用摄像头0,通常更稳定
|
||||
im = cap.read()[1]
|
||||
hsv = cv2.cvtColor(im, cv2.COLOR_BGR2HSV)
|
||||
h, s, v = cv2.split(hsv)
|
||||
pink_mask = (((h >= 300/360) | (h <= 20/360)) & (s >= 0.15) & (v >= 0.2))
|
||||
cv2.imshow("Pink Mask", im * pink_mask[:,:,np.newaxis]) # 显示掩码
|
||||
cv2.waitKey(0) # 等待按键
|
||||
cap.release()
|
Reference in New Issue
Block a user