In openCV, the low and high thresholds for the canny operator are mandatory:
cvCanny(input,output,thresh1,thresh2)
In Matlab, there\'s an o
I have another approach to the same problem. This solution also involves selection of optimal thresholds for edge detection.
The following pseudo-code shows you how its done:
v = np.median(gray_img)
sigma = 0.33
#---- apply optimal Canny edge detection using the computed median----
lower_thresh = int(max(0, (1.0 - sigma) * v))
upper_thresh = int(min(255, (1.0 + sigma) * v))
Fix these thresholds as parameters in the canny edge detection function.
Illustration: If you observe a Gaussian curve in statistics, values between 0.33 from both sides of the curve are considered in the distribution. Any value outside these points are assumed to be outliers. Since images are considered to be data, this concept is assumed here as well.