OPENCV Green Background Cutout

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.