Abh*_*kar 3 python opencv numpy gesture-recognition image-thresholding
我想突出显示实时手势识别的手。我观察到使用 cv2.imsplit 函数,对于不同的颜色通道,手的图像会以不同的方式突出显示。但是这个拆分函数在时间上是非常昂贵的。我无法使用 Numpy 索引执行相同的功能(如官方页面所示)
您可以使用 numpy 的切片:
import cv2
import numpy as np
## read image as np.ndarray in BGR order
img = cv2.imread("test.png")
## use OpenCV function to split channels
b, g, r = cv2.split(img)
## use numpy slice to extract special channel
b = img[...,0]
g = img[...,1]
r = img[...,2]
Run Code Online (Sandbox Code Playgroud)