# Revision history [back]

I don't know why you're having this problem, but I have a couple of suggestions.

First, replace the addWeighted with bitwise_or. It's just more descriptive of what you want done, and quicker. Also it might possibly have a problem when you add 255+255, I dunno.

Second, get rid of the masked variable. Just convert src to gray and then use the setTo method. You can use this with a mask to set every "on" pixel to white. That means you need to do this with a non-negated red_hue_mask, so get rid of the bitwise_not.

Imgproc.cvtColor(src, mBlacked, Imgproc.COLOR_RGB2GRAY);