How to write code for 3x3 sliding window to process over a Image with Pixel size of 256x256
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am designing a filter removing high density noises from an Gray Scale Image(256x256).
For identifying the noise pixels in the image I need a 3x3 window to slide over the image starting from the first Pixel to the Last.
If the corrupted Pixel is found i have to do some calculation to correct it.
To find this Corrupted Pixel I need a 3x3 Window to slide over my Image.
Can Anybody give me an outline on how to write Matlab code for the above.
0 Kommentare
Antworten (1)
Image Analyst
am 25 Sep. 2012
Bearbeitet: Image Analyst
am 25 Sep. 2012
How about
% Blur the image with a 3x3 averaging filter.
blurredImage = conv2(grayImage, ones(3)/9, 'same');
% Get map of where "corrupted" pixels are:
binaryImage = FindCorruptedPixels(grayImage); % You write this.
% Replace corrupted pixels with averaged ones.
grayImage(binaryImage) = blurredImage(binaryImage);
Of course you need to write FindCorruptedPixels() to define what constitutes a corrupted pixels - I don't know how you define that. For example, maybe it's just pure white pixels, like
binaryImage = grayImage == 255;
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!