Vous êtes sur la page 1sur 2

%To write a programme to display an image and its histogram

clc; A=imread('BHIM2.jpg'); I=rgb2gray(A); I=im2double(I); imshow(I); figure, im


hist(I)
--------------------------------------% this program produces mirror image of the image passed to it
% and also displays both the original and mirror image
A=imread('BHIM2.jpg');
a=rgb2gray(A);
[r,c]=size(a);
for i=1:1:r k=1;
for j=c:-1:1
temp=a(i,k);
result(i,k)=a(i,j);
result(i,j)=temp;
k=k+1;
end
end
subplot(1,2,1),imshow(a)
subplot(1,2,2),imshow(result)
--------------------------------------%display an image adjust and its histogrm
A=imread('BHIM2.jpg');
I=rgb2gray(A);
figure;
subplot(1,2,1); imshow(I);
subplot(1,2,2); imhist(I);
imh=imadjust(I,[0.3,0.6],[0.0,0.1]);
imh1=histeq(I);
figure;
subplot(2,2,1); imshow(imh);
subplot(2,2,2); imhist(imh);
subplot(2,2,3); imshow(imh1);
subplot(2,2,4); imhist(imh1);
--------------------------------------------%extraction_of_bit_plane_in_gray_scale_image
a=imread('BHIM2.jpg');
c=rgb2gray(a);
imshow(c);
cd=double(c);
imshow(cd/255);
cd1=im2double(c);
figure, imshow(cd1);
a=c>120;
imshow(a);
impixelinfo;
%convert image into bitplane
c0=mod(cd,2);
figure, imshow(c0);
%extract next bit plane
c1=mod(floor(cd/2),2);
figure, imshow(c1);
c2=mod(floor(cd/4),2);

c3=mod(floor(cd/8),2);
c4=mod(floor(cd/16),2);
c5=mod(floor(cd/32),2);
c6=mod(floor(cd/64),2);
c7=mod(floor(cd/128),2);
figure,
figure,
figure,
figure,
figure,
figure,
figure,
figure,

imshow(c0);
imshow(c1);
imshow(c2);
imshow(c3);
imshow(c4);
imshow(c5);
imshow(c6);
imshow(c7);

%Recreate these images c0 c1 c2 c3 c4 c5 c6 c7 again in one original image


cc=2*(2*(2*(2*(2*(2*(2*c7+c6)+c5)+c4)+c3)+c2)+c1)+c0;
imshow(cc);
%imshow(uint8(cc));
--------------------------------------------------------

Vous aimerez peut-être aussi