# IMAGE PROCESSING

" Two roads diverged in a wood, and I,
I took the one less traveled by,
And that has made all the difference "-Robert Frost

### MAX FILTER - MATLAB CODE

• To find the brightest points in an image.
•  Finds the maximum value in the area encompassed by the filter.
•  Reduces the pepper noise as a result of the max operation.
•  The 100th percentile filter is max filter. Check the 50th percentile filter i.e the median filter.

MATLAB CODE:

A = rgb2gray(A(1:300,1:300,:));
figure,imshow(A),title('ORIGINAL IMAGE');

%PREALLOCATE THE OUTPUT MATRIX
B=zeros(size(A));

%PAD THE MATRIX A WITH ZEROS

x=[1:3]';
y=[1:3]';

for i= 1:size(modifyA,1)-2
for j=1:size(modifyA,2)-2

%VECTORIZED METHOD
window=reshape(modifyA(i+x-1,j+y-1),[],1);

%FIND THE MAXIMUM VALUE IN THE SELECTED WINDOW

B(i,j)=max(window);

end
end

%CONVERT THE OUTPUT MATRIX TO 0-255 RANGE IMAGE TYPE
B=uint8(B);
figure,imshow(B),title('IMAGE AFTER MAX FILTERING');

Like "IMAGE PROCESSING" page

durre shehwar said...

Excellent Blog.... (Y) (Y) (Y)

Sakthi Vel said...

Index exceeds matrix dimensions.

Error in max (line 3)
A = rgb2gray(A(1:300,1:300,:)); this will shows when i am going to try different image...please help as soon as

ravi said...

for x=1:size(my_image,1)
for y=1:size(my_image,2)