% find leftmost edge of rightmost blob
function edgeposn = findlredge(binimage)

  labs=mybwlabel(binimage,4);  % get regions
  stats = regionprops(labs,['basic']); % basic properties
  [N,W] = size(stats); % get number of regions N
  if N < 1
    ['Jacobean cannot find a region']
    edgeposn = -1;
    return
  end

  % scan list to find rightmost bbox 
  com = -1;
  ind=1;
  for i = 1 : N
    lc = stats(i).Centroid; % compare box centroids
    if lc(1) > com
      com = lc(1);
      ind = i;
    end
  end

  % look at selected BB
  lbb = stats(ind).BoundingBox; % get BB parameters
  edgeposn=lbb(1); % get the leftmost edge
