AD ALTA 

 

JOURNAL OF INTERDISCIPLINARY RESEARCH

 

 

 

We can argue that with a different setting of the Hough 
transform algorithm, the best setting of the Canny edge detector 
changes as well, but the experiments verified also, that even 
when the minimum number of intersections in Hough space for 
line detection is arbitrary, the range of intensity values is not 
always sufficient for the best result of line detection. The 
reduction of this minimum number of intersections in an image, 
where the edge detection was done inefficiently, often leads to 
poor identification of lines (Mukhopadhyay, Chaudhuri, 2015).  
 
Table 1: Information about the test images and the results of the 
experiments 
 
Image 

Maximum Mean 

Median 

3:1 

2:1 

Airplane 1034.2 

61.3 

28.0 

836–838 756–762 

Banana 

487.2 

25.1 

11.7 

408–487 380–487 

Basket 

659.5 

100.2 

81.0 

558–562 448–538 

Beehive 481.7 

42.5 

31.6 

276–352 226–352 

Briefcase 807.2 

53.4 

25.6 

581–599 401–455 

Brush 

567.3 

37.5 

16.0 

482–490 434–446 

Coffee 
Maker 

856.7 

42.2 

15.2 

348–394 288–294 

Feather 

821.4 

80.0 

58.1 

448–478 374–386 

Golf-cart 792.9 

62.9 

40.5 

528–550 370–384 

Grater 

786.5 

39.4 

15.6 

324–358 272–278 

Mailbox 782.3 

84.4 

61.1 

522–526 404–426 

Pillow 

584.2 

44.3 

27.8 

300–534 260–442 

Pitcher 

623.8 

44.4 

14.1 

428–520 300–354 

Grocery 
Cart 

910.8 

81.8 

55.3 

547–593 448–554 

Stairs 

775.5 

79.6 

48.8 

622–634 459–463 

Stapler 

575.0 

23.4 

11.4 

288–370 193–205 

Tire 

943.6 

61.1 

26.0 

631–735 421–543 

Traffic 
Cone 

802.9 

59.5 

41.2 

350–368 320–368 

Trashcan 862.1 

67.9 

38.9 

592–604 468–484 

Video 
Camera 

782.7 

43.5 

19.2 

500–502 500–518  

 
4 Discussion 
 
As we can see, the best threshold values often go beyond the 
range of intensity values of the original image. So if we want to 
apply statistical functions to determine the threshold values, we 
should work with all the values of the gradient image.  
 
The experiments also revealed that in some cases, the 2:1 ratio 
allowed a more accurate line detection and in most other cases, 
where the two tested ratios yielded comparable results, the 2:1 
ratio had a greater interval, thus a higher probability of correctly 
determined hysteresis thresholds. Based on the table I would 
suggest for line detection to use the 2:1 ratio between the upper 
and lower threshold for hysteresis of the Canny edge detector. 
Then, the upper threshold to be set around 55 % of the maximum 
value of gradient image. With this setting, namely 52 - 56 %, the 
thresholds scored the best results in seven experiments and 
provided sufficiently good results in many others (as we can see 
in figure 1).  

Similarly, we could also use the mean, where best results 
provided the upper threshold equal to approximately seven times 
the mean value of the gradient image, more precisely 691 - 696 
%. I do not recommend, however, to use the median, because 
good results were quite scattered.  
 
5 Conclusion 
 
Based on the results of this paper, I believe that it is a bad 
practice to determine the Canny edge detector hysteresis 
threshold values solely on the basis of the intensity values of the 
input image. The values of the gradient image after performing 
the convolution with the Sobel operator and then consequentially 
calculating the gradient magnitude, provide much better results 
when used with detection lines using the Hough transform. 
There is no reason to believe that these values would not provide 
better results in other cases.  
 
With the repetition of experiments on a larger set of test images, 
we could find the thresholds that give required results for many 
images, a sort of a starting point of setting for the Canny edge 
detector, which can be further modified according to the specific 
line detection problem.  
 
Resolving this problem would simplify the line detection not 
only in OpenCV by the Canny edge detector, but also it would 
be possible to apply the results to other edge detectors based on 
the hysteresis, more of which appear in literature (Heath et al., 
1997). It is likely that the results could also be used with a line 
detection algorithm other than the Hough transform, for example 
with the PClines method (Dubská et al., 2011).  
 
Literature: 
 
1. Canny, J.: A computational approach to edge detection. In: 
IEEE Transactions on pattern analysis and machine intelligence

VI. issue. IEEE, 1986. p. 679-698. ISSN 0162-8828. 
2. Dubská, M., Herout, A., Havel, J.: PClines—line detection 
using parallel coordinates. In: Computer Vision and Pattern 
Recognition (CVPR), 2011 IEEE Conference on
. IEEE, 2011. p. 
1489-1494. ISBN 978-1-4577-0394-2. 
3. Fang, M., Yue, G., Yu, Q.: The study on an application of otsu 
method in canny operator. In: International Symposium on 
Information Processing (ISIP)
. 2009. p. 109-112. 
4. Heath. M., et al.: A robust visual method for assessing the 
relative performance of edge-detection algorithms. In: IEEE 
Transactions on Pattern Analysis and Machine Intelligence
. XII. 
issue. IEEE, 1997. p. 1338-1359. ISSN 0162-8828. 
5. Medina-Carnicer, R., et al.: Solving the process of hysteresis 
without determining the optimal thresholds. In: Pattern 
Recognition
. IV. issue. 2010. p. 1224-1232. ISSN 0031-3203. 
6. Mukhopadhyay, P., Chaudhuri, B.: A survey of Hough 
Transform. In: Pattern Recognition
. III. issue. 2015. p. 993-
1010. ISSN 0031-3203. 
 
Primary Paper Section: I 
 
Secondary Paper Section: 
IN 

Figure 1: Results of the experiments with 2:1 ratio between the upper and lower threshold. Test images (x-axis) are described by intervals of 
the best upper thresholds to detect lines in range of possible gradient values (y-axis). Results (green line) are upper thresholds set to 55 % of 
the maximum value of gradient image. 

- 258 -