See http://en.wikipedia.org/wiki/Canny_edge_detector and http://homepages.inf.ed.ac.uk/rbf/HIPR2/canny.htm