PS: Write before the nonsense, to the new company just good one months, the company is a foreign enterprise, and the Shanghai side of the Disney cooperation, to the new company is to do graphics related projects, today finally finished the first to take over the project, green background cutout, from completely do not know to complete the first project, instantly have a little achievement feeling.
Green background cutout:
1. Green Background photo
2. Making Masks
3, use mask to deduct the characters in the picture
Let's take a look at the idea.
We use loops to find the green pixels in the image.
Mark the green as (0,0,0) and mark the foreground to be deducted (255,255,255) so that we can make a mask (mask).
Use CopyTo to invoke the mask diagram as a parameter deduction foreground.
The code is not on, because it is the company's project. Besides, it's not very difficult. Small hint, how to find the green pixels in the image is the key and processing green pixels, if one method is not ideal, can be converted to other color space, RGB to HSV, HLS, lab and other color space to try it.