Thursday, June 14, 2018

image processing - Blurring Non-Uniform Areas


I have an image with arbitrary area (the boundary is shown in gray):


enter image description here


I would like to blur just the image within boundaries.


Ordinary blur causes the background proliferating to image and vice versa. This results in dark areas near boundaries of the image:


enter image description here



Answer



One simple solution would be to create a binary (0/255) mask of the area you want to blur. Then blur the source image BITWISE AND mask, blur the mask with the same filter and divide them. As pseudocode:


(filter(source & mask) / filter(mask)) & mask

No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, $\ce{Mg^2+}$ is closest in radius to $\ce{Li+}$. Is this true, and if so, why would a whole larger shell ($\ce{...