Added Canny threshold detection.