Implementing HPF in MATLAB

a=imread('Blue hills.jpg');
b=rgb2gray(a);
t=size(b);

fori=2:t(1)-1
for j=2:t(2)-1

       p(i,j)=(-b(i-1,j-1)-b(i-1,j)-b(i-1,j+1)-b(i,j-1)+8*b(i,j)-b(i,j+1)-b(i+1,j-1)-b(i+1,j)-b(i+1,j+1));
end;
end
subplot(1,2,1); 
imshow(b);
subplot(1,2,2) 
imshow(p);

Output

Output

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.