Manipulasi Citra

 Tampilan figure dengan 4 subplot:

Subplot 1: Citra asli.
Subplot 2: Citra threshold 100.
Subplot 3: Citra threshold 150, lalu lakukan flip vertikal.
Subplot 4: Flip horizontal dari citra asli, lalu lakukan brightness + 80.

mancit

clear;
citra_asli=imread('gambar.jpg');
citra_gray=rgb2gray(citra_asli);
citra_gray=double(citra_gray);
[b k]=size(citra_gray);
for x=1:b
for y=1:k
if citra_gray(x,y)=100
citra_threshold_100(x,y)=1;
end
if citra_gray(x,y)=150
citra_threshold_150(x,y)=1;
end

end
end
[b k c]=size(citra_gray);
for x=1:1:b
for y=1:1:k
for z=1:1:c
citra_flip_vertikal_150(x,y,z)=citra_threshold_150((b-x)+1,y,z);

end
end
end
temp=citra_asli;
[b k c]=size(citra_asli);
for x=1:1:b
for y=1:1:k
for z=1:1:c
citra_flip_horizontal(x,y,z)=temp(x,(k-y)+1,z);

end
end
end

citra_brightness= citra_flip_horizontal+80;
citra_brightness=uint8(citra_brightness);

subplot(2,2,1);
imshow(citra_asli),title('Citra Asli');
subplot(2,2,2);
imshow(citra_threshold_100),title('Citra Threshold 100');
subplot(2,2,3);
imshow(citra_flip_vertikal_150),title('Citra Threshold 150 Flip Vertikal');
subplot(2,2,4);
imshow(citra_brightness),title('Citra Flip Horizontal dengan Brightness+80');

0 komentar :

Post a Comment