Add automatic threshold in canny edge detector