kaki_img=imread('ma_L_4_sita.jpg');
figure(2)
imshow(kaki_img,'Border','tight','InitialMagnification','fit');
kaki_red=kaki_img(:,:,1);
figure(3)
imshow(kaki_red,'Border','tight','InitialMagnification','fit');
kaki_th=kaki_red>63;
figure(4)
imshow(kaki_th,'Border','tight','InitialMagnification','fit');
kaki_th=imfill(kaki_th,'holes');
figure(5)
imshow(kaki_th,'Border','tight','InitialMagnification','fit');
kaki_th=bwareafilt(kaki_th,1);
figure(6)
imshow(kaki_th,'Border','tight','InitialMagnification','fit');
BW = kaki_th;
B=bwboundaries(kaki_th,'noholes');
figure(7)
imshow(BW)
hold on
for kk=1:numel(B)
plot(B{kk}(:,2),B{kk}(:,1),'c','LineWidth',2)
end
stats_x=regionprops('table',BW,'Perimeter');
title(sprintf('boundary length is %d',stats_x.Perimeter))
size1=stats_x.Perimeter*0.1003;
stats_2 = regionprops(BW, 'MajorAxisLength', 'MinorAxisLength');
size_Long=stats_2.MajorAxisLength*0.1003;
size_Short=stats_2.MinorAxisLength*0.1003;