%
% E = binim2SortedEdge(binim)
%
% Dr. A. I. Hanna (2005);
function E = binim2SortedEdge(binim)
%E = edge(double(binim), 'canny');
E = bwboundaries(binim);
for i=1:size(E,1)
  length(i) = size(E{i},1);
end
E = E{find(length==max(length))};
N = 51;
E = E(round(linspace(1, size(E,1), N)),:);
E = E(1:end-1,:);
return

% E = edge(double(binim));
% [x, y] = find(E == 1);
% %x = x(1:2:end); y = y(1:2:end);
% E = double(image_sort(x, y));
% N = 51;
% E = E(round(linspace(1, size(E,1), N)),:);
% E = E(1:end-1,:);
% return;