Вы находитесь на странице: 1из 9

EXPERMENT NO.

- BIT PLANE SLICING


% bitplane slicing
I=imread('cameraman.tif');
subplot(3,2,1);imshow(I);title('original image');
%MSB=0
b=double(I);
b1=dec2bin(b);
b1(:,1)='0';
b2=bin2dec(b1);
c1=uint8(b2);
k=reshape(c1,256,256);
subplot(3,2,2);imshow(k);title('MSB=0');
% 6th bit=0
b3=dec2bin(b);
b3(:,3)='0';
b4=bin2dec(b3);
c2=uint8(b4);
k1=reshape(c2,256,256);
subplot(3,2,3);imshow(k1);title('6th bit=0');
% 4th bit=0
b5=dec2bin(b);
b5(:,5)='0';
b6=bin2dec(b5);
c3=uint8(b6);
k2=reshape(c3,256,256);
subplot(3,2,4);imshow(k2);title('4th bit=0');
% 2nd bit=0
b7=dec2bin(b);
b7(:,7)='0';
b8=bin2dec(b7);
c4=uint8(b8);
k3=reshape(c4,256,256);
subplot(3,2,5);imshow(k3);title('2nd bit=0');
% LSB bit=0
b9=dec2bin(b);
b9(:,8)='0';
b10=bin2dec(b9);
c4=uint8(b10);
k3=reshape(c4,256,256);
subplot(3,2,6);imshow(k3);title('LSB=0');

%tyagendra singh kararia


%ROLL NO:- P07EC911
%Q.2 Gamma corection.
P=imread('cameraman.tif');
subplot(2,1,1);
imshow(P); title('original image');
Q=1.1*a.^2;
subplot(2,1,2)

%TYAGENDRA SINGH KARARIA


%Roll number p07ec911
%PROGRAM FOR BIT PLANE SLICNG
P=imread('cameraman.tif');
subplot(2,2,1);
imshow(m);title('orignal image');
n=P;
o=P;
for i=1:255
for j=1:255
if m(i,j)>=128
m(i,j)=0;
end
end
end
subplot(2,2,2);
imshow(P);title('MSB is cleared');
for i=1:255
for j=1:255
if n(i,j)>=64 &n(i,j)<=127;
n(i,j)=0;
end
end
end
subplot(2,2,3);
imshow(n);title('Bit 6 is cleared');
for i=1:255
for j=1:255
if n(i,j)>=32& n(i,j)<=63;
o(i,j)=0;
end
end
end
subplot(2,2,4);
imshow(n);title('Bit 5 is cleared');
for i=1:255
for j=1:255
if o(i,j)<=1;
o(i,j)=0;
end
end
end
subplot(2,2,4);
imshow(o);title('Bit 0(LSB) is cleared');imshow(Q);title('gamma 2');

%TYAGENDRA SINGH KARARIA


%ROLL NO:- P07EC911
%Resize image with bilinear.
A=imread('cameraman.tif');
figure;
imshow(A);title('realimage');
B = imresize(A,[150 200]);;
figure
subplot(2,1,1);
imshow(B);title('resize by interpolation');
C = imresize(A,[150 200],'bilinear');
subplot(2,1,2);
imshow(C);title('resize by bilinear');
D = imresize(A,[1500 2500]);
figure;
subplot(2,1,1);
imshow(D);title('resize by interpolation');
E = imresize(A,[1500 2500],'bilinear');
subplot(2,1,2);
imshow(E);title('resize by bilinear');

%TYAGENDRA SINGH KARARIA


%ROLL NO:- P07EC911
%Q.1 Effect of spatial gray level.
P= imread('cameraman.tif');
figure;
imshow(P);title('original image');
R=P*2;
figure;
imshow(R);title('gray level doubled');
Q=P/3;
figure;
imshow(Q);title('gray level devide by 3');

% TYAGENDRA SINGH KARARIA


% PO7EC911
%Generate negative of image
P = imread('CIRCUIT.TIF');
Q = imcomplement(P);
subplot(1,2,1);
imshow(P)
subplot(1,2,2);
imshow(Q)

% TYAGENDRA SINGH KARARIA


% PO7EC911
%Histogram equalization in image
p = imread('cameraman.tif');
q = histeq(p);
subplot(2,2,1);
imshow(p)
subplot(2,2,2);
imshow(q)
subplot(2,2,3);
imhist(p,64)
subplot(2,2,4);
imhist(q,64)

%TYAGENDRA SINGH KARARIA


%ROLL NO:- P07EC911
%Q.1 Nagative of image.
P=imread('cameraman.tif');
subplot(2,1,1);
imshow(P); title('original image');
for i=1:256
for j=1:256
Q(i,j)=255-P(i,j);
end
end
subplot(2,1,2)
imshow(Q);title('nagative');

%TYAGENDRA SINGH KARARIA


%ROLL NO:- P07EC911
%Q.3 Rsize image with bilinear.
A=imread('cameraman.tif');
figure;
imshow(A);title('realimage');
B = imresize(X,[150 200]);;
figure
subplot(2,1,1);
imshow(B);title('resize by interpolation');
C = imresize(X,[150 200],'bilinear');
subplot(2,1,2);
imshow(C);title('resize by bilinear');
D = imresize(X,[1500 2500]);
figure;
subplot(2,1,1);
imshow(D);title('resize by interpolation');
E = imresize(X,[1500 2500],'bilinear');
subplot(2,1,2);
imshow(E);title('resize by bilinear');

Вам также может понравиться