Removal of noises at edges
Afficher commentaires plus anciens
I have a grayscale (value 0-255) image with background pixel equals 0. I am trying to remove noises at the border between the foreground and the background. These noises can be identified by the big jump in values. Is there any existing algorithm/filter that can achieve this? If no, may I know the most efficient way to do it instead of comparing pixels with its neighborhood?
The result that I expect is to removal of those noises by changing them to background pixel (0) without changing any of the border/foreground pixel values.

Réponse acceptée
Plus de réponses (1)
Image Analyst
le 9 Jan 2016
An alternative way is to use mathematical morphology. You can get the local min in a 3x3 (or whatever size or shape you want) using imerode()
localMin = imerode(grayImage, true(3));
% Find jumps by subtracting from the original
jumpThreshold = 32; % or whatever you want.
jumps = (grayImage - localMin) > jumpThreshold ; % This is a mask!
% Set big jump pixels to zero.
grayImage(jumps) = 0;
You could boil all that down to 2 lines of code (or even 1) if you wanted it to be super compact.
6 commentaires
Hg
le 9 Jan 2016
Image Analyst
le 9 Jan 2016
Well, there's the median filter, medfilt2() - maybe you'll like what that does. It replaces the center pixel in a moving window by the median of pixel values in the window. Why do you get the boost at the edge anyway? Maybe your enhancement scheme could be better? Why do you need to clip/zero/remove the bright edges anyway? What is your overall goal?
Image Analyst
le 9 Jan 2016
Why not just threshold
distanceImage(distanceImage>200) = inf;
Image Analyst
le 9 Jan 2016
A slight variant of what I code I gave is to use imopen(). It does an imerode() (local min) followed by imdilate() (local max). Try that also and see how it looks. Try varying the kernel size.
Catégories
En savoir plus sur Object Analysis dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!