29/8/25 11:54 AM D:\bip6.
m 1 of 1
clc;
clear all;
close all;
% im=imread('C:\Documents and Settings\All Users\Documents\My Pictures\Sample
Pictures\Water [Link]');
im1=imread("D:\Biomedical Image Processing\sample
images\DIP3E_Original_Images_CH03\Fig0338(a)(blurry_moon).tif");
im2=imread("D:\Biomedical Image Processing\sample
images\DIP3E_Original_Images_CH03\Fig0343(a)(skeleton_orig).tif");
% spatial high pass filtering using default masks
f=[-1 -1 -1;-1 8 -1;-1 -1 -1];
y1=filter2(f,im1);
y2=uint8(y1);
figure(1),subplot(2,3,1),imshow(im1),title('original image')
subplot(2,3,2),imshow(y2),colormap('gray'),title('Laplacian image without scaling');
y3=y1-min(min(y1));
y4=255.*(y3./max(max(y3)));
y5=uint8(y4);
subplot(2,3,3),imshow(y5),title('Laplacian image with scaling');
y6=im1+1.*y2;
y7=uint8(y6);
subplot(2,3,4),imshow(y6),title('sharp image ');
% enhancement of bone image
y8=filter2(f,im2);
y9=uint8(y8);
figure(2),subplot(2,4,1),imshow(im2),title('original image');
subplot(2,4,2),imshow(y9),title('laplacian filter image');
y12=im2+1.*y9;
subplot(2,4,3),imshow(y12),title('laplacian filter image+original image');
s = fspecial('sobel');
y13=imfilter(im2,s);
subplot(2,4,4),imshow(y13),title('sobel filter image');
c=ones(5,5)/(5*5);
y14=filter2(c,y13);
y15=uint8(y14);
subplot(2,4,5),imshow(y15),title('sobel image smoothed with avg filter mask=[5 5]');
g1=im2double(y12);
g2=im2double(y15);
y16=immultiply(g1,g2);
g4=uint8(y16);
subplot(2,4,6),imshow(y16),title('product of laplacian filter image and smoothed sobel
image');
g3=im2+g4;
subplot(2,4,7),imshow(g3),title('mask image + original image');
g5=im2double(g3);
g6=g5.^(0.7);
subplot(2,4,8),imshow(g6),title('power low transformation with gamma=0.7 and c=1 on sharp
image');