distance transform, corner detection, refac