flipkart ads

MATLAB TUTORIAL THREE




Image Enhancement in spatial domain.


clc;
clear all;
close all;
I = imread('capture.jpg');
subplot(3,3,1)
imshow(I)
title('original image')
J = rgb2gray(I);
subplot(3,3,2)
imshow(J)
title('grayscale image of original image')
subplot(3,3,5);
imhist(J);
title('histogram of grayscale image')

F = histeq(J);
subplot(3,3,3),imshow(F)
title('histogram equalized grayscale image')
subplot(3,3,6),imhist(F)
title('histogram equalization graph of grayscale equlized image')

L = imadjust(J,[0.2;0.6],[0.2;0.5])
subplot(3,3,4),imshow(L)
title('grayscale image is adjsuted in some range')
subplot(3,3,7),imhist(L)
title('histogram of adjusted grayscale image')

K = imadjust(F,[0.2 ;0.3 ],[0.1 ; 0.4 ],0.8);
subplot(3,3,8),imshow(K)
title('grayscale image is adjsuted with some gamma value')
subplot(3,3,9),imhist(K)
title('histogram of gamma adjusted grayscale image')








close all;
clear all;
clc;
r = imread('flowers.jpg');
% r = imresize(a,[64 64]);
g = input('enter the value of gamma = ')
v = r.^g;
c = input('enter the value of constant multiplier = ')
s = c*(v);
size(r)
subplot(1,2,1)
imshow(r)
subplot(1,2,2)
imshow(s)
  


Output
enter the value of gamma = 3
g =  3
enter the value of constant multiplier = 2
c = 2
ans = 1600        2560           3







clear all;
close all;
clc;
a=imread('flowers.jpg');
a = imresize(a,[256 256])
a=double(a);
b1=[];
b2=[];
b3=[];
b4=[];

b5=[];
b6=[];

b7=[];


for m=1:256
for n=1:256
        b1(m,n)=ceil(a(m,n)/power(2,7))*power(2,7);
        b2(m,n)=ceil(a(m,n)/power(2,6))*power(2,6);
        b3(m,n)=ceil(a(m,n)/power(2,5))*power(2,5);
        b4(m,n)=ceil(a(m,n)/power(2,4))*power(2,4);
        b5(m,n)=ceil(a(m,n)/power(2,3))*power(2,3);
        b6(m,n)=ceil(a(m,n)/power(2,2))*power(2,2);
        b7(m,n)=ceil(a(m,n)/power(2,1))*power(2,1);
end
end

subplot(2,4,1);
imshow(uint8(a));
title('image of flowers','color','r');

subplot(2,4,2);
imshow(uint8(b7));
title('bit-7','color','r');
subplot(2,4,3);
imshow(uint8(b6));
title('bit-6','color','r');
subplot(2,4,4);
imshow(uint8(b5));
title('bit-5','color','r');
subplot(2,4,5);
imshow(uint8(b4));
title('bit-4','color','r');
subplot(2,4,6);
imshow(uint8(b3));
title('bit-3','color','r');

subplot(2,4,7);
imshow(uint8(b2));
title('bit-2','color','r');

subplot(2,4,8);
imshow(uint8(b1));
title('bit-1','color','r');  







B=imread('Audi A9_214.jpg');
A = rgb2gray(B)
subplot(3,3,1);imshow(A);title('grayscale image')
B=bitget(A,1);
subplot(3,3,2);imshow(logical(B));title('Bit plane 1');

B=bitget(A,3);
subplot(3,3,3);imshow(logical(B));title('Bit plane 2');

B=bitget(A,3);
subplot(3,3,4);imshow(logical(B));title('Bit plane 3');

B=bitget(A,4);
subplot(3,3,5);imshow(logical(B));title('Bit plane 4');

B=bitget(A,5);
subplot(3,3,6);imshow(logical(B));title('Bit plane 5');

B=bitget(A,6);
subplot(3,3,7);imshow(logical(B));title('Bit plane 6');

B=bitget(A,7);
subplot(3,3,8);imshow(logical(B));title('Bit plane 7');

B=bitget(A,8);
subplot(3,3,9);imshow(logical(B));title('Bit plane 8');


 



No comments:

Post a Comment

flipkart products