begin with clumping algorithm
....
head detection halfway ok. i think what's missing is a measurement of periphery, as well as a measurement of the relative position of an element within the heap. with the latter, the general bounds could be larger, and the relative position would be an additional second pass filter.
...