0

I am trying to add some blur brush stroke with OpenCV

If I use cv.add or cv.addweighted, I only got half of the red color (look pink),

but I want the red to cover the underlying picture, not blend.

If I use copyto or clone, I can't get the blur edge, so how should I do it ??

Paint Brush

enter image description here

Jazz
  • 916
  • 1
  • 8
  • 22
user1718854
  • 446
  • 4
  • 7
  • 1
    if you don't blend the colours you won't have any blur / soft edge effect as you will either have background or 100% red... – Piglet Sep 14 '17 at 08:19

2 Answers2

0

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.

George Profenza
  • 50,687
  • 19
  • 144
  • 218
0

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);
user1718854
  • 446
  • 4
  • 7