How to remove the smudges and noise in this image?
4 views (last 30 days)
Show older comments
Duncan on 24 Jul 2014
Answered: Image Analyst on 25 Jul 2014
I have the attached image of a crack. I have used the following code to remove most of the noise and blobs to leave only the crack pattern:
%binarize an image and display it
I = imread('crack3.JPG');
level = graythresh(I);
BW = im2bw(I, level);
BW1 = imcomplement(BW); %colour inversion
G = fspecial('gaussian', [5 5], 0.5); %Create the gaussian filter with hsize = [5 5] and sigma = 0.5
BW2 = imfilter(BW1,G,'same');
BW3 = bwareaopen(BW2,50); %removes objects with < 50 connected pixels
BW4 = bwmorph(BW3, 'bridge', 1);
BW5 = bwmorph(BW4, 'diag', 1);
BW6 = bwmorph(BW5, 'majority', 1);
but I am still having trouble removing some of the smudges occurring on the top left-hand corner and at various positions.
Any help would be appreciated. Thanks
Image Analyst on 25 Jul 2014
That's not how I'd do it. And you aren't even showing how you filled in the crack.
Anyway if you want to brighten various smudges, then use CLAHE, done by adapthisteq(). It will scan the image and make every tile roughly the same mean and standard deviation. Not like a Wallis filter, but sort of similar. You could also do a Wallis filter, if you can find code for that. Another method is to blur the image to get rid of fine texture and noise and then divide your image by the blurred one. Yet another one (one that I use) is to use John D'Errico's polyfitn() to create a smooth model background and then divide your image by the smoothed model background. I've attached a demo for that. Or you can look at shadow removal methods, like that invented at the University of Dayton http://www.udayton.edu/engineering/vision_lab/video_preprocessing/nonlinear_enchancement.php
More Answers (0)
Find more on Images in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!