Member-only story
OpenCV Series — 12 — Blemish Removal
In this post , we will see how to use the sobel filter in opencv to get the gradient of an image patch and use that to hide the blemish patch in an image.
Step: 1:
Determine the radius of the patch required based on the size of the blemishes in the image and Load the image.
Step: 2:
Use the mouse callback function to get the x and y values
Step: 3:
Get the patch using the x, y and r values
crop_img = source[y:(y+2*r), x:(x+2*r)]
Step: 4:
Use the selected patch as center, convolve around eight direction , around the patch and get the lowest gradient value using sobel filter.
Step: 5:
Now with the new gradient patch , apply opencv’s seamless cloning function to apply the new patch on the blemish patch.