clear all;
close all;

fing_print = imread('rice.jpg');
imshow(fing_print);

figure;
[n, xnum] = imhist(fing_print);
stem(xnum,n)

k = 1;
for i = 1:size(n,1)-1     %A 2 x 2 matrix representing bins and frequencies is formed as a input 
    if n(i) == 0 & flag == 0 %for discrete curve evolution which gives us where the split occurs.
        continue
    end
    A(k,1) = xnum(i);
    A(k,2) = n(i);
    A(k,3) = xnum(i+1);
    A(k,4) = n(i+1);
    k = k+1;
    flag = 1;
end
A(k,1) = A(k-1,3);
A(k,2) = A(k-1,4);

answer = evo2_fprint(A) %The output answer has the six points in the image where split occurs

answer = sort(answer)

[imageRows, imageCols] = find(fing_print > answer);

for tempCount=1:size(imageRows,1)                
    fing_print(imageRows(tempCount),imageCols(tempCount)) = 255; 
end  

figure;
imshow(fing_print);



%figure;
%imshow(fing_print);