You are on page 1of 8

Lab 1 1

clear all
clc
I1 = imread('bodypet.jpeg');
I2 = imread('body noise 4.jpeg');
I3=I1+I2;
subplot(2,2,2)
imshow (I3);
I4=I1-I2;
subplot(2,2,1)
imshow (I4)
I1;
subplot(2,2,3)
imshow (I1)
subplot (2,2,4)
imshow (I2)

lab 1 2
clear all
clc
I1 = imread('bodypet.jpeg');
I2 = imread('body noise 4.jpeg');
I3=I1+I2;
subplot(2,2,2)
imshow (I3);
I4=I1-I2;
subplot(2,2,1)
imshow (I4)
I1;
subplot(2,2,3)
imshow (I1)
subplot (2,2,4)
imshow (I2)

lab 1-2
clear all;
clc;
I1=imread ('breastcencorcell.jpeg');
I2=imresize (I1,3);
subplot (2,2,2)
imshow (I1);
subplot (2,2,1)
imshow (I2);
i=imread ("lab1 2 (1).PNG");
i1 = im2double(i);
E =input('enter the value of E');
m=input('enter the value of m');
C1 = 1./(1+(m./(i1+eps)).^E);
subplot(223), imshow(C1), title('\it at m and E')
lab 1-3
clear all;
clc;
i =imread ('brain mri.jpeg');
i1=imresize (i,4);
I1=imnoise(i1,'gaussian',0,0.005);
I2=imnoise(i1,'gaussian',0,0.005);
I3=imnoise(i1,'gaussian',0,0.005);
I4=imnoise(i1,'gaussian',0,0.005);
I5=imnoise(i1,'gaussian',0,0.005);
Iavg=(I1+I2+I3+I4+I5)./5;
subplot (2,2,1)
imshow (Iavg)

lab 2_2_1
clear all
clc
I=imread ("xray bone.jpeg");
subplot (2 ,2 ,1)
imshow ( I)
title original image
i=rgb2gray (I);
subplot (2 ,2 ,2)
imshow (i)
title grey image
c=input ('enter the value of c \n');
I2 = im2double(i);
J1 = c*log(1 + I2);
subplot(2,2,3), imshow(J1), title('\it at c ')

lab 2_2_2
clear all
clc
I=imread ("xray bone.jpeg");
subplot (2 ,2 ,1)
imshow ( I)
title original image
i=rgb2gray (I);
subplot (2 ,2 ,2)
imshow (i)
title grey image
m=input ('enter the value of m \n');
E=input ('enter the value of E \n');
I2 = im2double(i);
C1 = 1./(1+(m./(I2+eps)).^E);
subplot(2,2,3), imshow(C1), title('\it at m and E')

lab 2_3
clear all
clc
I = imread('xray bone.jpeg');
A = input('Enter a low threshold value for A: ');
B = input('Enter a low threshold value for B: ');
[row,col] = size(I);
I2 = uint8(zeros(row,col));
for i = 1:row
for j = 1:col
if (I(i,j)>A) && (I(i,j)<B)
I2(i,j) = 255;
else
I2(i,j) = 0;
end
end
end
I3 = uint8(zeros(row,col));
for i = 1:row
for j = 1:col
if (I(i,j)>A) && (I(i,j)<B)
I3(i,j) = 255;
else
I3(i,j) = I(i,j);
end
end
end
figure, subplot(231), imshow(I), title('Original')
subplot(232), imshow(I2), title('Intensity Sliced w/o Background')
subplot(233), imshow(I3), title('Intensity Sliced w Background')

lab 3_1
clc;
clear;
x=imread('Xray_Bone_Noise2.tif');
x=imread('Xray_Bone_Noise2.tif');
x=imread('Xray_Bone_Noise.tif');
f1=[1 1 1 ;1 1 1 ;1 1 1 ];

x1=x(1:256,1:256);
y1=conv2(x1,f1);
M1=max(max(y1));
y1=255.*(y1./M1);

lab 3_1
clear all;
clc;
n=input ('enter the value of kennel');
h = fspecial('average',n);
I = imread('xray bone.jpeg');
subplot(2,2,1), imshow(I)
title('Original Image')
J = imcomplement(I);
subplot(2,2,2), imshow(J)
title('Image Complement')
MRI1 = imfilter(J,h);
subplot(2,2,3), imshow(MRI1)
title('Zero-Padded')

lab 3_2
clear all;
clc;

n=input ('enter the value of kennel');


h = fspecial('average',n);
I = imread('xray bone.jpeg');
subplot(2,2,1), imshow(I)
title('Original Image')
J = imcomplement(I);
subplot(2,2,2), imshow(J)
title('Image Complement')
MRI1 = imfilter(J,h);
subplot(2,2,3), imshow(MRI1)
title('Zero-Padded')

f1=[-1 -1 -1 ;0 0 0 ;1 1 1 ];

x1=I(1:256,1:256);
y1=conv2(x1,f1);
M1=max(max(y1));
y1=255.*(y1./M1);

subplot(2,2,1);imshow(I);title('IMAGE ')
subplot(2,2,2);imshow(uint8((y1)));title('f1- IMAGE ')

lab 3_1(1)
clear all;
clc;

n=input ('enter the value of kennel');


h = fspecial('average',n);
I = imread('Xray_Bone_Noise1.tif');
subplot(2,2,1), imshow(I)
title('Original Image')
J = imcomplement(I);
subplot(2,2,2), imshow(J)
title('Image Complement')
MRI1 = imfilter(J,h);
subplot(2,2,3), imshow(MRI1)
title('Zero-Padded')

f1=[-1 0 1 ;-1 0 1 ;-1 0 1 ];

x1=I(1:256,1:256);
y1=conv2(x1,f1);
M1=max(max(y1));
y1=255.*(y1./M1);

subplot(2,2,1);imshow(I);title('IMAGE ')
subplot(2,2,2);imshow(uint8((y1)));title('f1- IMAGE ')

lab 3_3(1)
clc;

n=input ('enter the value of kennel');


h = fspecial('average',n);
I = imread('xray bone.jpeg');
subplot(2,2,1), imshow(I)
title('Original Image')
J = imcomplement(I);
subplot(2,2,2), imshow(J)
title('Image Complement')
MRI1 = imfilter(J,h);
subplot(2,2,3), imshow(MRI1)
title('Zero-Padded')

f1=[0 -1 0 ;-1 4 -1 ;0 -1 0 ];

x1=I(1:256,1:256);
y1=conv2(x1,f1);
M1=max(max(y1));
y1=255.*(y1./M1);

subplot(2,2,1);imshow(I);title('IMAGE ')
subplot(2,2,2);imshow(uint8((y1)));title('f1- IMAGE ')
lab 3_3 3
clear all;
clc;

n=input ('enter the value of kennel');


h = fspecial('average',n);
I = imread('Xray_Bone_Noise2.tif');
subplot(2,2,1), imshow(I)
title('Original Image')
J = imcomplement(I);
subplot(2,2,2), imshow(J)
title('Image Complement')
MRI1 = imfilter(J,h);
subplot(2,2,3), imshow(MRI1)
title('Zero-Padded')

f1=[0 -1 0 ;-1 4 -1 ;0 -1 0 ];

x1=I(1:256,1:256);
y1=conv2(x1,f1);
M1=max(max(y1));
y1=255.*(y1./M1);

subplot(2,2,1);imshow(I);title('IMAGE ')
subplot(2,2,2);imshow(uint8((y1)));title('f1- IMAGE ')

lab 2_1
clear all
clc
I = imread('Brain_MRI.tif');
figure, subplot(121), imshow(I), title('Original Image')
J = imcomplement(I);
subplot(122), imshow(J), title('Photographic Negative')

lab 2_1(1)
clear all
clc

I = imread('Brain_MRI.tif');
J1 = imadjust(I,[],[],1.0);
figure, subplot(131), imshow(J1), title('Original, \gamma = 1')
J2 = imadjust(I,[],[],0.3);
subplot(132), imshow(J2), title('\gamma = 0.3')
J3 = imadjust(I,[],[],2.8);
subplot(133), imshow(J3), title('\gamma = 2.8')

lab2_1(2)
clear all
clc

I = imread('Brain_MRI.tif');
figure, subplot(221), imshow(I), title('Original')
I2 = im2double(I);
J1 = 0.5*log(1 + I2);
subplot(222), imshow(J1), title('\it c = 0.5')
J2 = 2.0*log(1 + I2);
subplot(223), imshow(J2), title('\it c = 2.0')
J3 = 3.0*log(1 + I2);
subplot(224), imshow(J3), title('\it c = 3.0')

lab 2_1(3)
clear all
clc
I = imread('Brain_MRI.tif');
figure, subplot(221), imshow(I), title('Original')
I2 = im2double(I);
M = mean(I2(:));
C1 = 1./(1+M./(I2+eps)).^2;
subplot(222), imshow(C1), title('\it E = 2')
C2 = 1./(1+M./(I2+eps)).^4;
subplot(223), imshow(C2), title('\it E = 4')
C3 = 1./(1+M./(I2+eps)).^6;
subplot(224), imshow(C3), title('\it E = 6')

lab 2_1(4)
clear all
clc
clc, clear all, close all
I = imread('Brain_MRI.tif');
A = input('Enter a low threshold value for A: ');
B = input('Enter a low threshold value for B: ');
[row,col] = size(I);
I2 = uint8(zeros(row,col));
for i = 1:row
for j = 1:col
if (I(i,j)>A) && (I(i,j)<B)
I2(i,j) = 255;
else
I2(i,j) = 0;
end
end
end
I3 = uint8(zeros(row,col));
for i = 1:row
for j = 1:col
if (I(i,j)>A) && (I(i,j)<B)
I3(i,j) = 255;
else
I3(i,j) = I(i,j);
end
end
end
figure, subplot(131), imshow(I), title('Original')
subplot(132), imshow(I2), title('Intensity Sliced w/o Background')
subplot(133), imshow(I3), title('Intensity Sliced w Background')

You might also like