Professional Documents
Culture Documents
Lab Week-1
17BEC1085
Aditya Harichandar
sampe image:
r=size(I,1);
c=size(I,2);
R(:,:,1)=I(:,:,1);
G(:,:,2)=I(:,:,2);
B(:,:,3)=I(:,:,3);
figure(1);
imshow(uint8(R));
figure(2);
imshow(uint8(G));
figure(3);
imshow(uint8(B));
Output
a=imread('Lenna.jpg'); %horizontal
[m,n,p]=size(a)
b=zeros(m,n)
b=a(end:-1:1,:,:)
figure(1);
imshow(uint8(a));
figure(2);
imshow(uint8(b));
Output
//vertical flip
a=imread('Lenna.jpg');
%vertical
[m,n,p]=size(a)
b=zeros(m,n)
b=a(:,end:-1:1,:)
figure(1);
imshow(uint8(a));
figure(2);
imshow(uint8(b));
Output
3) Bitplane Slicing
clc
clear all
a = rgb2gray(imread('Lenna.jpg'));
[m,n] = size(a);
b1 = [];
b2 = [];
b3 = [];
b4 = [];
b5 = [];
b6 = [];
b7 = [];
b8 = [];
for i = 1:m
for j = 1:n
t = de2bi(a(i,j),8,'left-msb');
b1(i,j) = t(1,1);
b2(i,j) = t(1,2);
b3(i,j) = t(1,3);
b4(i,j) = t(1,4);
b5(i,j) = t(1,5);
b6(i,j) = t(1,6);
b7(i,j) = t(1,7);
b8(i,j) = t(1,8);
end
end
imshow(a)
figure
imshow(b1)
figure
imshow(b2)
figure
imshow(b3)
figure
imshow(b4)
figure
imshow(b5)
figure
imshow(b6)
figure
imshow(b7)
figure
imshow(b8)
Output: