Clustering edge values for threshold selection