% % % % thresholdings methods

clc
clear all
close all

% orig=imread('image15.jpeg');
 orig=imread('a003-org.jpg');
copy=orig;
copy=rgb2gray(copy);
copy=double(copy);
% copy2=(copy-min(copy(:)))/(max(copy(:))-min(copy(:)))*255;
h=histo(copy,2);
figure,plot(h),pixval;

o=otsu2(h);
t=thresh(copy,o);
se = strel('disk',2);
t_nou=imclose(t,se);
figure; imagesc(t_nou),colormap(gray(256)),axis off;

% oo=t_nou;

% minim=min(min(copy));
% maxim=max(max(copy));
% copy2=copy/(maxim-minim)*255;
% figure; imagesc(copy2),colormap(gray(256)),pixval;
% max(copy2(:))
% min(copy2(:))


% kk=loyd(copy,h);
% tk=thresh(copy,kk);
% se = strel('disk',2);
% t_nou=imclose(t,se);
% figure; imagesc(tk),colormap(gray(256));


kl = Pal(copy,h);
tp=thresh(copy,kl);
se = strel('disk',2);
% t_nou=imclose(t,se);
figure; imagesc(tp),colormap(gray(256)),axis off;



