An Algorithm for Multi-scale Analysis in Edge Detection