You are on page 1of 5

Arya dimas wardani

197003516006
UAS Komputasi Fisika Medik adalah membuat program ekstraksi segmen
clc
close all
clear all

c= imread('citrabaru.tiff');
imshow(c)
imhist (c)

%prosesing
e= medfilt2 (c);
figure, imshow (e), title 'Med'
AB= adapthisteq(e);
figure, imshow (AB), title 'med & clahe'
AC= imsharpen (AB);
figure, imshow (AC), title 'med & clahe sharp'

%segmentasi 1 th
AE= multithresh (c, 2);
AG= imquantize (c, AE);
figure, imshow (AG, []), title 'citra biner segmentasi thresh 1'

%segmentasi 3 th
AH= multithresh (c, 3)
AK= imquantize (c, AH);
figure, imshow (AK,[]), title 'citra biner segmentasi & thresh'

%mengembalikan ke citra grayscale


AN= AG./max (AG(:));
AM= AK./max (AK(:));
figure, imshow (AN), title 'hasil segmentasi 1 thresh'
figure, imshow (AM), title 'hasil segmentasi 3 thresh'
figure, imhist (AM)

%operasi Morfologi
st= strel ('disk', 20);
AL= imerode (AM, st);
AJ= imreconstruct (AL, AM);
figure, imshow (AJ), title 'hasil erode'

ac= imdilate (AJ, st);


ad= imreconstruct (ac, AJ);
figure, imshow (ad), title 'hasil dilate'

ax= imregionalmax (ad);


figure, imshow (ax), title 'segmen hasil erode+ dilate biner'

%karakteristik segmen
AR = bwlabel (ax);
AS = regionprops (AR, c,'all');
AT = size (AS,1);
fprintf {1, 'Blob MeanPiXal Area MajorAx MinorAX\n' }:
for k = 1 : AT
BlobMeanPixal= AS (k), Mean Intensity;
BlobArea= AS (k), Area;
BlobMajorAx= AS (k), MajorAxiaLenght;
BlobMinorAx= AS(k), MinorAxiaLenght;
fprintf (1, '%20 %15.if %10.if %5.if %12.if\n', 'k', BlobMeanPixal,
BlobArea, BlobMajorAx,BlobMinorAx);
end

figure, imagesc (ax);


title ('Blob di citra'); axis equal;
hold on
AU= bwboundaries(AR);
AV = size(AU,1) ;
for k = 1 : AV
thisBoundary= AD (k);
plot (thisBoundary (:,z), thisBoundary(:,1), 'm', 'LineWidht', 2);
end
hold off;

 Hasil Segmentasi
 Hasil Pengolahan Citra

You might also like