Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Dip 3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

DIGITAL IMAGE PROCESSING LAB 3

AIM: To implement
a) Image weighted sum of two images
b) Write custom function to plot histogram of colour and grey

SOFTWARE USED:
MATLAB
CODE:
clear all;
close all;
C = imread("similarity_images3.jpg");
D = imread("similarity_images4.jpg");
L = im2gray(D);

for a = 0:100
Y = (C).*(a/100) + (D).*((100-a)/100);
imshow(Y);

end
for a = 0:100
Y = (C).*((100-a)/100) + (D).*(a/100);
imshow(Y);
end
M = hist1(C(:,:,1));
x = 0:1:255;
figure
imhist(C(:,:,1));
figure
bar(x,M);

N = hist1(C(:,:,2));
figure
imhist(C(:,:,2));
figure
bar(x,N);
K = hist1(C(:,:,3));
figure
imhist(C(:,:,3));
figure
bar(x,K);
gray = hist1(L);
figure
imhist(L);
figure
bar(x,gray);
function X = hist1(k)
X = zeros(1,256);
[m,n] = size(k);
for i = 1:m
for j = 1:n
X(k(i,j)+1) =X(k(i,j)+1)+1;
end
end
end
DIGITAL IMAGE PROCESSING LAB 3
RESULT:

For grey image: histogram userdefined

For grey image: histogram standard


DIGITAL IMAGE PROCESSING LAB 3

For colored image: histogram userdefined(red)

For colored image: histogram std(red)


DIGITAL IMAGE PROCESSING LAB 3
For colored image: histogram userdefined(green)

For colored image: histogram std(green)


DIGITAL IMAGE PROCESSING LAB 3
For colored image: histogram userdefined(blue)

For colored image: histogram std(blue)

CONCLUSION:

We can see how two images mix together by changing the amount of each image we use. This
helps us understand how the mixed image looks different depending on the ratio of the two
images. We can also see how many pixels have a certain brightness or color in the mixed image
‘C’. We can look at each color (Red, Green, Blue) separately or together. The grayscale image ‘L’
shows us the overall brightness of the mixed image in one color.and the custom function is gave
the same histogram as bar graph.

You might also like