Ask Your Question

Mask + Image without black on destination

asked 2012-07-21 15:33:36 -0600

Pat gravatar image

Hi, essentially I have a mask and I make a bitwise_and between the mask and an image. This works wonderfully, but I cannot find a way to ignore the black on the destination image. Here's the process for more clarification :

Essentially, I do something like this:

//Should dst have an alpha channel to replace black by a zero-opacity pixel?
cv::bitwise_and(image, mask, dst, mask???);
edit retag flag offensive close merge delete


What values do you want to get on border?

AlexanderShishkov gravatar imageAlexanderShishkov ( 2012-07-21 16:13:36 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2012-07-21 16:15:34 -0600

AlexanderShishkov gravatar image

I don't understand what is the purpose of using bitwise_and in this case. If you want to copy some part of image to the other image, you should use:

image.copyTo(dst, mask);
edit flag offensive delete link more

Question Tools


Asked: 2012-07-21 15:33:36 -0600

Seen: 668 times

Last updated: Jul 21 '12