Commit 95460f72 authored by Thiago C. Santini's avatar Thiago C. Santini

Removes possible division by zero from hypot

parent 1ad0ce9f
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
/* /*
Version 1.0, 08.06.2015, Copyright University of Tbingen. Version 1.0, 08.06.2015, Copyright University of Tübingen.
The Code is created based on the method from the paper: The Code is created based on the method from the paper:
"ExCuSe: Robust Pupil Detection in Real-World Scenarios", W. Fuhl, T. C. Kbler, K. Sippel, W. Rosenstiel, E. Kasneci "ExCuSe: Robust Pupil Detection in Real-World Scenarios", W. Fuhl, T. C. Kübler, K. Sippel, W. Rosenstiel, E. Kasneci
CAIP 2015 : Computer Analysis of Images and Patterns CAIP 2015 : Computer Analysis of Images and Patterns
The code and the algorithm are for non-comercial use only. The code and the algorithm are for non-comercial use only.
...@@ -29,6 +29,9 @@ static float hypot(float a,float b) ...@@ -29,6 +29,9 @@ static float hypot(float a,float b)
float t=a<b?a:b; float t=a<b?a:b;
float x=a>b?a:b; float x=a>b?a:b;
if (x==0)
return 0;
t = t/x; t = t/x;
return x*sqrt(1+(t*t)); return x*sqrt(1+(t*t));
} }
...@@ -346,4 +349,4 @@ static cv::Mat canny_impl(cv::Mat *pic, cv::Mat *magni){ ...@@ -346,4 +349,4 @@ static cv::Mat canny_impl(cv::Mat *pic, cv::Mat *magni){
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment