Adding Canny edge detection as an alternative to simple thresholding