Commit 2eeaf11f authored by Davis King's avatar Davis King

Fixed improper normalization in the gaussian() functions. The

normalization constant was being computed incorrectly.
parent 30e073d6
...@@ -66,8 +66,8 @@ namespace dlib ...@@ -66,8 +66,8 @@ namespace dlib
<< "\n\t sig must be bigger than 0" << "\n\t sig must be bigger than 0"
<< "\n\t sig: " << sig << "\n\t sig: " << sig
); );
const double pi = 3.1415926535898; const double sqrt_2_pi = 2.5066282746310002416123552393401041626930;
return 1.0/(sig*sig*2*pi) * std::exp( -(x*x + y*y)/(2*sig*sig)); return 1.0/(sig*sqrt_2_pi) * std::exp( -(x*x + y*y)/(2*sig*sig));
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
...@@ -358,8 +358,8 @@ namespace dlib ...@@ -358,8 +358,8 @@ namespace dlib
<< "\n\t sigma must be bigger than 0" << "\n\t sigma must be bigger than 0"
<< "\n\t sigma: " << sigma << "\n\t sigma: " << sigma
); );
const double pi = 3.1415926535898; const double sqrt_2_pi = 2.5066282746310002416123552393401041626930;
return 1.0/(sigma*sigma*2*pi) * std::exp( -(x*x)/(2*sigma*sigma)); return 1.0/(sigma*sqrt_2_pi) * std::exp( -(x*x)/(2*sigma*sigma));
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
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