皮肤检测与抠图
皮肤检测的方法很多,这里写的是最简单的方法,感兴趣的同学可以自己加上椭圆检测,膨胀腐蚀等,使得检测与抠图更加精确。github上许多人脸识别的算法,可以多学习那些。
HSV颜色空间
hsv涉及心理学的颜色知识,比rgb检测具有更好的分类效果
python 代码
def get_skin_hsv(img)
hsv_img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
back = np.zeros(img.shape, np.uint8)
(h, s, v) = cv2.split(hsv_img)
(x, y) = h.shape
for i in range(x):
for j in range(y):
if (h0[i][j] > 0) and (h0[i][j] < 20) and (s0[i][j] > 48) and (s0[i][j] < 255) and (v0[i][j] > 50) and (v0[i