Write A Matlab Code For Obtaining Digital Negative of An Image
Write A Matlab Code For Obtaining Digital Negative of An Image
6. Write matlab code for sharpening an image using high pass filter
>> clear all
>>aa=imread('C:\Users\D106\Desktop\New folder (2)\rose.jpg');
a=double(aa);
[row col]=size(a);
w=[-1 -1 -1; -1 8 -1; -1 -1 -1]
>> for i=2:1:row-1
for j=2:1:col-1
a1(i,j)= w(1)*a(i-1,j-1)+ w(2)*a(i-1,j)+ w(3)*a(i-1,j+1)+ w(4)*a(i,j-1)+
w(5)*a(i,j)+ w(6)*a(i,j+1)+ w(7)*a(i+1,j-1)+ w(8)*a(i+1,j)+ w(9)*a(i+1,j+1);
end
end
>> for i=2:1:row-1
for j=2:1:col-1
if(a1(i,j)<0)
a1(i,j)=0;
end
if(a1(i,j)>255)
a1(i,j)=a(i,j)/a;
end
end
>> imshow(uint8(aa));
>> imshow(uint8(a1));