
I = imread('IMG_8586.jpg');

%choose one of each pair
imshowpair(I, maskedImage, 'montage');
%imshowpair(I, Kmedian, 'montage');

noP2 = numel(maskedImage);
%noP2 = numel(Kmedian);

bw4 = imbinarize(maskedImage);
%bw4 = imbinarize(Kmedian);

white2 = sum(bw4(:)==1);
black2 = sum(bw4(:)==0);
percent2 = white2/noP2*100;
bw5 = imbinarize(fullmaskedImage);
white3 = sum(bw5(:)==1);
black3 = sum(bw5(:)==0);
purple = white3-white2;
percent3 = white3/noP2*100;
percent4 = white2/white3;

A=["IMG_8586",white2,purple,white3,percent2,percent3, percent4,noP2];
filename = 'testdata.xlsx';
%change this row and masked and binary
xlswrite(filename,A,1,'A65:H65');
imwrite(maskedImage,'masked_8586.jpg');
%imwrite(Kmedian,'medianmasked_8540.jpg');
imwrite(fullmaskedImage,'fullmasked_8586.jpg');

L=rgb2gray(maskedImage);
bw3 = imbinarize(L);
imwrite(bw3,'binary_8586.jpg');

%L=rgb2gray(Kmedian);
%bw3 = imbinarize(L);
%imwrite(bw3,'binary_8540.jpg');

L=rgb2gray(fullmaskedImage);
bw6 = imbinarize(L);
imwrite(bw6,'fullbinary_8586.jpg');




%holes = white1-white2;







