Below is a sample result of an experiment implemented and executed to attempt to efficiently label individual sets of edges.
Labelling edges into separate sets is useful, specifically if one wants to have the edges grouped apart for purposes like featurization. Its also a lot faster and more memory efficient to featurize and label edges that are divided into small groups, as oppose to running algorithms on edges spread out across the entire image.
The original approach taken was to group edges based on the space they enclose by using a connected component algorithm on pixels labelled with edge values. This proved to be extremely difficult since it was impossible for the algorithm to separate edges that made up a boundary separating two neighbouring enclosed spaces. For example, this worked in an image with sparse edges scattered around in various locations. But in a noisy image, every pixel belonging to an edge was part of a boundary that enclosed at least two or more spaces.
The solution was to construct a membrane along side every boundary of edge pixels. The membrane, and hence the name of the idea, would have an outer wall touching the edge pixels, and an inner wall specifically bounding one enclosed space with a one to one ratio.
The first output includes the original image (Left) with the Canny Edge Detector applied (Right):
Next the edges get filtered by a threshold computed as a function of a variance (Left), and the median filter, along with an additional pruning algorithm that is then further applied:
Finally, the idea of the cell membrane is applied to the edges, so as to label them into separate edge clusters (Left. A simple algorithm is then applied to label the edges within those clusters (Right):