def hand_threshold(frame_in,hand_hist):
frame_in=cv2.medianBlur(frame_in,3)
hsv=cv2.cvtColor(frame_in,cv2.COLOR_BGR2HSV)
hsv[0:int(cap_region_y_end*hsv.shape[0]),0:int(cap_region_x_begin*hsv.shape[1])]=0 # Right half screen only
hsv[int(cap_region_y_end*hsv.shape[0]):hsv.shape[0],0:hsv.shape[1]]=0
back_projection = cv2.calcBackProject([hsv], [0,1],hand_hist, [00,180,0,256], 1)
disc = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (morph_elem_size,morph_elem_size))
cv2.filter2D(back_projection, -1, disc, back_projection)
back_projection=cv2.GaussianBlur(back_projection,(gaussian_ksize,gaussian_ksize), gaussian_sigma)
back_projection=cv2.medianBlur(back_projection,median_ksize)
ret, thresh = cv2.threshold(back_projection, hsv_thresh_lower, 255, 0)
return thresh
# 3. Find hand contour
HandRecognition.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录