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 8288327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:15:42+00:00 2026-06-08T12:15:42+00:00

I have this mask : Let’s say I would like to make a bitwise_and

  • 0

I have this mask :

mask

Let’s say I would like to make a bitwise_and with another image to fill in the white this works:

cv::bitwise_and(srcImage, mask, dstImage, [mask???]);

Now, the resulting image gives something like this :

Image + Mask

This is fine and dandy, but I’d like to subtract the black from the result. I’ve seen that bitwise_and also accepts an 8-bit single channel image, I’m not exactly sure what it does. I suppose if it’s 0 then it let’s it pass otherwise it ignores it.

So how would I use the same mask to convert it as an 8-bit image and use it to remove the black of the result? I’d like the same image, but without the black border essentially.

  • 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-08T12:15:43+00:00Added an answer on June 8, 2026 at 12:15 pm

    The solution is pretty simple. Since I didn’t know much about the openCV library I wasn’t using the right function for the task. I’m still not certain for sure why the application crashed when passing a mask to the bitwise_and method though.

    Essentially all you have to do is the following :

    image.copyTo(dst, mask);
    

    This will copy the image to dst and even handle the details of the mat to give it the same properties as ‘image’. Just have to make sure to have mask be an 8-bit single channel image. This way when you call the method only the pixels that pass the mask will be copied to dst.

    Here’s the doc link for more information:copyTo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file looks like this: <?xml version=1.0 encoding=utf-8 ?> <PathMasks> <Mask
I guess this would be a DevExpress mask, but here is what I have:
Let's say I have a loading indicator image, I want it to display nicely
Let's say I have the following int susan = 2; //0010 int bob =
I have a list of file names(I already have the filelist let's say in
I would like to implement a simple substitution cipher to mask private ids in
Let's say I have an array k = [1 2 0 0 5 4
I have Class which Extends View I'm able To Move one Image Over another
I have: $(document).ready(function () { jQuery(function ($) { $(#ClientID).mask(999-999999999); } } Now this mask
I have this set of codes to create a simple before and after image

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.