0% found this document useful (0 votes)
28 views

Tugas Pertama: 'Bagus - Jpeg'

The document discusses three image processing practices on an image called "bagus.jpeg": 1) Reading the RGB channels of the original image and plotting their histograms. 2) Creating a negative image and plotting histograms of its RGB channels. 3) Performing contrast stretching on the image by normalizing pixel values between minimum and maximum, and plotting histograms. 4) Applying histogram equalization and plotting histograms of the equalized image's RGB channels.

Uploaded by

BAGUS PUTRA
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Tugas Pertama: 'Bagus - Jpeg'

The document discusses three image processing practices on an image called "bagus.jpeg": 1) Reading the RGB channels of the original image and plotting their histograms. 2) Creating a negative image and plotting histograms of its RGB channels. 3) Performing contrast stretching on the image by normalizing pixel values between minimum and maximum, and plotting histograms. 4) Applying histogram equalization and plotting histograms of the equalized image's RGB channels.

Uploaded by

BAGUS PUTRA
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Tugas pertama

I=imread('bagus.jpeg');
read=I(:,:,1);
green=I(:,:,2);
blue=I(:,:,3);
A=imhist(read);
B=imhist(green);
C=imhist(blue);
x=1:256;
figure,subplot(1,2,1), imshow(I);title('Citra RGB');
subplot(1,2,2), plot(x,A,'r-');title('Histogram Citra RGB');
hold on
subplot(1,2,2), plot(x,B,'g-')
subplot(1,2,2), plot(x,C,'b-')
grid on

praktek 1
citra=imread('bagus.jpeg');
citra_negatif=255-citra;

figure, subplot(1,2,1),imshow(citra_negatif);title('citra negatif')


red2=citra_negatif(:,:,1);
green2=citra_negatif(:,:,2);
blue2=citra_negatif(:,:,3);
D=imhist(red2);
E=imhist(green2);
F=imhist(blue2);
y=1:256;
subplot(1,2,2),plot(y,D,'r-');title('Histogram citra negatif')
hold on
subplot(1,2,2),plot(y,E,'g-');
subplot(1,2,2),plot(y,F,'b-');
grid on

Praktek 2
citra=imread('bagus.jpeg');
a(:,:,1)= min(min(citra(:,:,1)));
a(:,:,2)= min(min(citra(:,:,2)));
a(:,:,3)= min(min(citra(:,:,3)));
b(:,:,1)= max(max(citra(:,:,1)));
b(:,:,2)= max(max(citra(:,:,2)));
b(:,:,3)= max(max(citra(:,:,3)));
c(:,:,1)= 255/(b(:,:,1)-a(:,:,1));
c(:,:,2)= 255/(b(:,:,2)-a(:,:,2));
c(:,:,3)= 255/(b(:,:,3)-a(:,:,3));
kontras(:,:,1)=(citra(:,:,1)-a(:,:,1))*c(:,:,1);
kontras(:,:,2)=(citra(:,:,2)-a(:,:,2))*c(:,:,2);
kontras(:,:,3)=(citra(:,:,3)-a(:,:,3))*c(:,:,3);

subplot(1,2,1),imshow(kontras);title('citra kontras')
red2=kontras(:,:,1);
green2=kontras(:,:,2);
blue2=kontras(:,:,3);
D=imhist(red2);
E=imhist(green2);
F=imhist(blue2);
y=1:256;
subplot(1,2,2),plot(y,D,'r-');title('Histogram citra kontras')
hold on
subplot(1,2,2),plot(y,E,'g-');
subplot(1,2,2),plot(y,F,'b-');
grid on

Praktek 3
citra=imread('bagus.jpeg');
citra_his=histeq(citra);

figure, subplot(1,2,1),imshow(kontras);title('citra ekualisasi')


red2=citra_his(:,:,1);
green2=citra_his(:,:,2);
blue2=citra_his(:,:,3);
D=imhist(red2);
E=imhist(green2);
F=imhist(blue2);
y=1:256;
subplot(1,2,2),plot(y,D,'r-');title('Histogram citra ekualisasi')
hold on
subplot(1,2,2),plot(y,E,'g-');
subplot(1,2,2),plot(y,F,'b-');
grid on

You might also like