I got a trick to do it simply copy the area to a new mat, then draw a circle and blur it on the new mat, and use addWeighted to blend it to the image with whatever alpha I need.
Mat roi = myImage.submat(y-20, y+20, x-20, x+20);
Mat mix = roiB.clone();
Imgproc.circle(mix, new Point(20, 20), 12, color, -1);
Core.addWeighted(mix, alpha, roiB, beta, 0.0, mix);
Imgproc.GaussianBlur(mix, mix, new Size(21, 21), 0);
mix.copyTo(roiB);
The background of your brush image is black. If you were in photoshop and set that brush layer’s blend mode to screen the red gradient would show through and the black background would become transparent.
2
Answers
I got a trick to do it simply copy the area to a new mat, then draw a circle and blur it on the new mat, and use addWeighted to blend it to the image with whatever alpha I need.
The background of your brush image is black. If you were in photoshop and set that brush layer’s blend mode to screen the red gradient would show through and the black background would become transparent.
Here are a couple of relevant posts:
Alternatively, if you’re using OpenCV 3.0 you try using
seamlessClone
.