필터 지우기
필터 지우기

How to write code for 3x3 sliding window to process over a Image with Pixel size of 256x256

조회 수: 1 (최근 30일)
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.
#I have attached flow chart for my Algorithm http://i46.tinypic.com/246nm69.jpg

답변 (1개)

Image Analyst
Image Analyst 2012년 9월 25일
편집: Image Analyst 2012년 9월 25일
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;
  댓글 수: 1
Sudharsan
Sudharsan 2012년 9월 25일
Thanks for your reply.
I Think i didn't make my point clear. To be more precise
1. Choose the first pixel. Having it as the center pixel i have to form a 3x3 window. [Being the first pixel i've padded the Matrix with Zeros]
2. If that center Pixel is Noise Pixel it's location should be returned with all its neighborhood pixels. I will convert this 3x3 Matrix into a 1-D array and do my calculations to correct the corrupted pixels.
Here i'm struggling in designing the sliding 3x3 window to move over the image.

댓글을 달려면 로그인하십시오.

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by