cb = newimge[1, :]
cr = newimge[2, :]
binary = np.logical_and(np.logical_and(np.logical_and(cb < 127,cb > 100), cr < 170),cr > 138).astype(np.uint8)*255
binary = binary.reshape(H,W)
img_ycrcb = cv2.cvtColor(image,cv2.COLOR_BGR2YCrCb)
Cr=img_ycrcb[:,:,1]
Cb=img_ycrcb[:,:,2]
binary1 = np.logical_and(np.logical_and(np.logical_and(Cb < 127,Cb > 100), Cr < 170),Cr > 138).astype(np.uint8)*255
将符合规定阈值范围内的全部变为1,不符合规定的全部变为0
最新推荐文章于 2022-09-11 14:41:59 发布