Explicitly use double precision sin & cos in hough implementation
authorAndrey Kamaev <andrey.kamaev@itseez.com>
Tue, 25 Dec 2012 14:05:05 +0000 (18:05 +0400)
committerAndrey Kamaev <andrey.kamaev@itseez.com>
Tue, 25 Dec 2012 14:05:05 +0000 (18:05 +0400)
On some platforms sin and cos are calculated in single precision resulting in
diversity of results.

modules/imgproc/src/hough.cpp

index 6b5c2e4..3e737d8 100644 (file)
@@ -118,8 +118,8 @@ icvHoughLinesStandard( const CvMat* img, float rho, float theta,
     float ang = 0;
     for(int n = 0; n < numangle; ang += theta, n++ )
     {
-        tabSin[n] = (float)(sin(ang) * irho);
-        tabCos[n] = (float)(cos(ang) * irho);
+        tabSin[n] = (float)(sin((double)ang) * irho);
+        tabCos[n] = (float)(cos((double)ang) * irho);
     }
 
     // stage 1. fill accumulator