From 3350533f4862a95602069341f68df18a1ea8d0b1 Mon Sep 17 00:00:00 2001 From: Daniel Angelov Date: Sat, 13 Jul 2013 04:50:03 +0300 Subject: [PATCH] Fixed ambiguouty error, signess compare. --- modules/imgproc/src/lsd.cpp | 6 +++--- modules/imgproc/test/test_lsd.cpp | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/imgproc/src/lsd.cpp b/modules/imgproc/src/lsd.cpp index e248ebbaf..fde40daa9 100644 --- a/modules/imgproc/src/lsd.cpp +++ b/modules/imgproc/src/lsd.cpp @@ -135,7 +135,7 @@ inline bool AsmallerB_XoverY(const edge& a, const edge& b) inline double log_gamma_windschitl(const double& x) { return 0.918938533204673 + (x-0.5)*log(x) - x - + 0.5*x*log( x*sinh(1/x) + 1/(810.0*pow(x,6.0))); + + 0.5*x*log(x*sinh(1/x) + 1/(810.0*pow(x, 6.0))); } /** @@ -221,7 +221,7 @@ void LSD::flsd(std::vector& lines, Mat gaussian_img; const double sigma = (SCALE < 1)?(SIGMA_SCALE / SCALE):(SIGMA_SCALE); const double sprec = 3; - const unsigned int h = (unsigned int)(ceil(sigma * sqrt(2 * sprec * log(10)))); + const unsigned int h = (unsigned int)(ceil(sigma * sqrt(2 * sprec * log(10.0)))); Size ksize(1 + 2 * h, 1 + 2 * h); // kernel size GaussianBlur(image, gaussian_img, ksize, sigma); // Scale image to needed size @@ -234,7 +234,7 @@ void LSD::flsd(std::vector& lines, ll_angle(rho, N_BINS, list); } - LOG_NT = 5 * (log10(double(img_width)) + log10(double(img_height))) / 2 + log10(11); + LOG_NT = 5 * (log10(double(img_width)) + log10(double(img_height))) / 2 + log10(11.0); const int min_reg_size = int(-LOG_NT/log10(p)); // minimal number of points in region that can give a meaningful event // // Initialize region only when needed diff --git a/modules/imgproc/test/test_lsd.cpp b/modules/imgproc/test/test_lsd.cpp index 3ed08ba24..1f0b5051a 100644 --- a/modules/imgproc/test/test_lsd.cpp +++ b/modules/imgproc/test/test_lsd.cpp @@ -109,7 +109,7 @@ TEST_F(LSD_ADV, whiteNoise) LSD detector(LSD_REFINE_ADV); detector.detect(test_image, lines); - ASSERT_GE(40, lines.size()); + ASSERT_GE((unsigned int)(40), lines.size()); } TEST_F(LSD_ADV, constColor) @@ -118,12 +118,12 @@ TEST_F(LSD_ADV, constColor) LSD detector(LSD_REFINE_ADV); detector.detect(test_image, lines); - ASSERT_EQ(0, lines.size()); + ASSERT_EQ((unsigned int)(0), lines.size()); } TEST_F(LSD_ADV, lines) { - const int numOfLines = 3; + const unsigned int numOfLines = 3; GenerateLines(test_image, numOfLines); LSD detector(LSD_REFINE_ADV); detector.detect(test_image, lines); @@ -136,7 +136,7 @@ TEST_F(LSD_ADV, rotatedRect) GenerateRotatedRect(test_image); LSD detector(LSD_REFINE_ADV); detector.detect(test_image, lines); - ASSERT_LE(4, lines.size()); + ASSERT_LE((unsigned int)(4), lines.size()); } TEST_F(LSD_STD, whiteNoise) @@ -145,7 +145,7 @@ TEST_F(LSD_STD, whiteNoise) LSD detector(LSD_REFINE_STD); detector.detect(test_image, lines); - ASSERT_GE(50, lines.size()); + ASSERT_GE((unsigned int)(50), lines.size()); } TEST_F(LSD_STD, constColor) @@ -154,12 +154,12 @@ TEST_F(LSD_STD, constColor) LSD detector(LSD_REFINE_STD); detector.detect(test_image, lines); - ASSERT_EQ(0, lines.size()); + ASSERT_EQ((unsigned int)(0), lines.size()); } TEST_F(LSD_STD, lines) { - const int numOfLines = 3; //1 + const unsigned int numOfLines = 3; //1 GenerateLines(test_image, numOfLines); LSD detector(LSD_REFINE_STD); detector.detect(test_image, lines); @@ -172,7 +172,7 @@ TEST_F(LSD_STD, rotatedRect) GenerateRotatedRect(test_image); LSD detector(LSD_REFINE_STD); detector.detect(test_image, lines); - ASSERT_EQ(8, lines.size()); + ASSERT_EQ((unsigned int)(8), lines.size()); } TEST_F(LSD_NONE, whiteNoise) @@ -181,7 +181,7 @@ TEST_F(LSD_NONE, whiteNoise) LSD detector(LSD_REFINE_NONE); detector.detect(test_image, lines); - ASSERT_GE(50, lines.size()); + ASSERT_GE((unsigned int)(50), lines.size()); } TEST_F(LSD_NONE, constColor) @@ -190,12 +190,12 @@ TEST_F(LSD_NONE, constColor) LSD detector(LSD_REFINE_NONE); detector.detect(test_image, lines); - ASSERT_EQ(0, lines.size()); + ASSERT_EQ((unsigned int)(0), lines.size()); } TEST_F(LSD_NONE, lines) { - const int numOfLines = 3; //1 + const unsigned int numOfLines = 3; //1 GenerateLines(test_image, numOfLines); LSD detector(LSD_REFINE_NONE); detector.detect(test_image, lines); @@ -208,5 +208,5 @@ TEST_F(LSD_NONE, rotatedRect) GenerateRotatedRect(test_image); LSD detector(LSD_REFINE_NONE); detector.detect(test_image, lines); - ASSERT_EQ(8, lines.size()); + ASSERT_EQ((unsigned int)(8), lines.size()); }