Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8197893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:50:08+00:00 2026-06-07T05:50:08+00:00

I have an image, and a selection given by a list of points (a

  • 0

I have an image, and a selection given by a list of points (a poly). My goal is to get another image where everything except the selection is transparent.

There are two parts to this question:
* how to create the mask from the list of points?
* what’s the best way of creating the new image using the mask? I was thinking of cvCopy but how can I handle the alpha channel?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:50:09+00:00Added an answer on June 7, 2026 at 5:50 am

    I had a simillar issue and I solved it in a strange (not very fast) way:

    1. Extracted red, green and blue channels of an image (using extractChannel).
    2. Do a bitwise_and operation between each of the channels and poygon mask image.
    3. Merged them back (using merge function).

    Note that if you have one-channel image than you just need to do a bitwise_and.

    C++ code:

    void createPOI(const Mat& src, const Mat& polyMat, Mat& dst)
    {
        vector<Mat> array(3);
    
        for (int i=0; i<3; i++)
        {
            extractChannel(src, array[i], i);
            bitwise_and(array[i], polyMat, array[i]);
        }
    
        merge(array, dst);
    }
    

    You can create polyMat mask using fillPoly/fillConvexPoly functions (depends on your polygon). For example:

    Mat polyMat = Mat::zeros(size, CV_8UC1);
    fillConvexPoly(polyMat, polygon, Scalar(255));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this code in the button click to show selection image when the
I have image Array with two images out of that first image its showing
I have a horizontal StackPanel with an image and another StackPanel. The inner StackPanel
I have an image carousel. There's a div for the main viewing area, and
I have image map that can I move, but this map will be so
I have image on server of dimension 1000x800. I download it using following approaches:
I have image and txt file of same size say 200 KB. Now i
I have image upload, where I check, how big part of image is already
I have image A and image B. They are located in the different places
i have a div that it have image content .i wanna implement animation when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.