A method and apparatus for locating the boundary of an object. An electronic image of the object is formed, having a plurality of image pixels. Groups of the image pixels are identified that represent edge segments of the object. Patches are formed around the image pixel groups, where each patch is dimensioned and positioned to entirely contain one of the image pixel groups. A patch merge process is preformed that merges any two of the patches together that overlap each other by a predetermined amount, to form a merged patch that is dimensioned and positioned to entirely contain the two merged patches. The merge process continues for any overlapping patches and merged patches until none of the patches and the merged patches overlap each other by the predetermined amount. All the edge segments contained within one of the merged patches are associated as representing the boundary of the object.