Soal UAS TI PCD-dikonversi
Soal UAS TI PCD-dikonversi
Jl. A. Yani No. 10 Bojonegoro 62115 Telp. (0353) 887341 Email: unugiri.bjn@gmail.com Website:
http://www.unugiri.ac.id
Pertanyaan
1. Siapkan 5 image berwarna (2 image foto pribadi, wajib), ubah kelima gambar tersebut
menjadi image Grayscale (keabu-abuan) dan image Binary (hitam putih)
2. Carilah 3 image yang diolah dengan operasi dilasi, erosi, opening, dan closing Berikan
penjelasan terhadap setiap proses tersebut secara detail dan image yang ditampilkan dalam
laporan dapat terlihat jelas
3. Lakukan operasi Skeleton/Thinning/Thickening terhadap objek citra yang telah
diperbaiki kualitas objeknya. Berikan penjelasan terhadap setiap proses tersebut
secara detail dan image yang ditampilkan dalam laporan dapat terlihat jelas
4. Kombinasi Metode2 yang telah ada di modul dan buat detail penjelasannya
JAWABAN !!!
1. GRAYSCALE DAN BINARY
SYNTAX
clear
clc
close all
%gambar 1
img1 = imread('C:\Users\erlin\Downloads\UAS NOPA\er.jpg');
img1_grayscale = rgb2gray(img1);
img1_biner = im2bw(img1_grayscale);
subplot(5,3,1); imshow(img1); title('GAMBAR RGB');
subplot(5,3,2); imshow(img1_grayscale); title('GAMBAR GRAYSCALE');
subplot(5,3,3); imshow(img1_biner); title('GAMBAR BINARY');
%gambar 2
img2 = imread('C:\Users\erlin\Downloads\UAS NOPA\er2.jpg');
img2_grayscale = rgb2gray(img2);
img2_biner = im2bw(img2_grayscale);
subplot(5,3,4); imshow(img2);
subplot(5,3,5); imshow(img2_grayscale);
subplot(5,3,6); imshow(img2_biner);
%gambar 3
img3 = imread('C:\Users\erlin\Downloads\UAS NOPA\melon.jpg');
img3_grayscale = rgb2gray(img3);
img3_biner = im2bw(img3_grayscale);
subplot(5,3,7); imshow(img3);
subplot(5,3,8); imshow(img3_grayscale);
subplot(5,3,9); imshow(img3_biner);
%gambar 4
img4 = imread('C:\Users\erlin\Downloads\UAS NOPA\bunga.jpg');
img4_grayscale = rgb2gray(img4);
img4_biner = im2bw(img4_grayscale);
subplot(5,3,10); imshow(img4);
subplot(5,3,11); imshow(img4_grayscale);
subplot(5,3,12); imshow(img4_biner);
%gambar 5
img5 = imread('C:\Users\erlin\Downloads\UAS NOPA\kelinci.jpg');
img5_grayscale = rgb2gray(img5);
img5_biner = im2bw(img5_grayscale);
subplot(5,3,13); imshow(img5);
subplot(5,3,14); imshow(img5_grayscale);
subplot(5,3,15); imshow(img5_biner);
OUTPUT
OUTPUT
PENJELASAN :
A) Proses Dilasi :
B) Proses Erosi :
C) Proses Opening :
D) Proses Closing :
3. A. Skeleton
img = imread('C:\Users\erlin\Downloads\UAS NOPA\er.jpg');
imgGray = rgb2gray(img);
imgEnhance = imadjust(imgGray,[0.15,0.9],[0,1]);
imgNeg = imcomplement (imgEnhance);
imgBW = im2bw(imgNeg, 0.9);
imgFill = imfill (imgBW, 'holes');
imgSkel = bwmorph (imgFill, 'skel', Inf);
figure, imshow(imgGray); title('Image Grayscale');
figure, imshow(imgEnhance); title('Image Enhancement');
figure, imshow(imgNeg); title('Image Complement');
figure, imshow(imgBW); title('Image Binary based on Treshold');
figure, imshow(imgSkel); title('Image Recontruction');
figure, imshow(imgSkel); title('Image Skeleton');
OUTPUT
B. Thinning
img = imread('C:\Users\erlin\Downloads\UAS NOPA\er.jpg');
imgGray = rgb2gray(img);
imgEnhance = imadjust(imgGray,[0.15,0.9],[0,1]);
imgThin1 = bwmorph (imgEnhance, 'thin', 1);
imgThin2 = bwmorph (imgEnhance, 'thin', 2);
imgThinInf = bwmorph (imgEnhance, 'thin', Inf);
figure, imshow(imgEnhance); title('Image Enhancement');
figure, imshow(imgThin1); title('Image Thinning 1');
figure, imshow(imgThin2); title('Image Thinning 2');
figure, imshow(imgGray); title('Image Thin Inf');
C. Thickening
img = imread('C:\Users\erlin\Downloads\UAS NOPA\er.jpg ');
imgGray = rgb2gray(img);
imgEnhance = imadjust(imgGray,[0.15,0.9],[0,1]);
imgThick1 = bwmorph (imgEnhance, 'thick', 1);
imgThick3 = bwmorph (imgEnhance, 'thick', 3);
imgThickInf = bwmorph (imgEnhance, 'thick', Inf);
figure, imshow(imgEnhance); title('Image Enhancement');
figure, imshow(imgThick1); title('Image Thickening 1');
figure, imshow(imgThick3); title('Image Thickening 3');
figure, imshow(imgThinInf); title('Image Thickening Inf');
4. SYNTAX
img = imread('C:\Users\erlin\Downloads\UAS NOPA\er.jpg');
imgGray= rgb2gray(img);
se=strel('ball',5,5);
dilasi=imdilate(imgGray, se);
erosi=imerode(imgGray, se);
opening=imdilate(erosi,se);
closing=imerode(dilasi,se);
imgNeg = imcomplement (closing);
imgBW = im2bw(imgNeg, 0.9);
imgFill = imfill (imgBW, 'holes');
imgSkel = bwmorph (imgFill, 'skel', 10);
imgThin2 = bwmorph (imgSkel, 'thin', 2);
imgThick3 = bwmorph (imgThin2, 'thick', 3);
figure, imshow(imgGray);title('Grayscale');
figure, imshow(dilasi);title('Dilasi');
figure, imshow(erosi);title('Erosi');
figure, imshow(opening);title('Opening');
figure, imshow(closing);title('Closing');
figure, imshow(imgSkel);title('Skeleton');
figure, imshow(imgThin2);title('Thinning');
figure, imshow(imgThick3);title('Thickening');
OUTPUT