Some tips and tricks for PYTHON-OPENCV
When using PYTHON-OPENCV to process an image, you can take a picture as a matrix and perform vector operations like MATLAB to speed up the operation of your code.
Here are a few common things to remember
1. The Mask image (mask) that takes the pixel value in the image to satisfy a specific condition
Mask = Imge < (b, G, R)
The mask size returned by this operation is equal to the image and the number of channels is equal, independently judging whether the pixel value of each channel satisfies the condition.
Mask = (Image < (b, G, R)). All (Axis = 2)
The mask size returned by this operation is equal to the image size, only one channel, combined to determine three conditions return True/false
2. Find the horizontal ordinate in the mask image that is not a zero area
X, y = np.where (mask)
3. Find the mean of three channels for the specified coordinates x, y
Mu_b, mu_g, Mu_r = Np.mean (Skin_picture[x, y,:],axis = 0)
4. Using masks to act on images
# image as one channel for in range (3): = Mask * image[:,;, I] #图像为三通道
Some tips for PYTHON-OPENCV