From 052b2c43c32651784f60eb736c5abb353af133af Mon Sep 17 00:00:00 2001 From: Diego1V Date: Thu, 9 Jan 2025 19:37:52 +0100 Subject: [PATCH] Update types inside HoughLinesProbabilistic in order to handle great images. --- modules/imgproc/src/hough.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/imgproc/src/hough.cpp b/modules/imgproc/src/hough.cpp index 1c52689da5..39bdecf2ea 100644 --- a/modules/imgproc/src/hough.cpp +++ b/modules/imgproc/src/hough.cpp @@ -575,7 +575,8 @@ HoughLinesProbabilistic( Mat& image, Point line_end[2]; float a, b; int* adata = accum.ptr(); - int i = point.y, j = point.x, k, x0, y0, dx0, dy0, xflag; + int i = point.y, j = point.x, k, xflag; + int64_t x0, y0, dx0, dy0; int good_line; const int shift = 16; @@ -626,8 +627,8 @@ HoughLinesProbabilistic( Mat& image, for( k = 0; k < 2; k++ ) { - int gap = 0, x = x0, y = y0, dx = dx0, dy = dy0; - + int gap = 0; + int64_t x = x0, y = y0, dx = dx0, dy = dy0 ; if( k > 0 ) dx = -dx, dy = -dy; @@ -636,7 +637,7 @@ HoughLinesProbabilistic( Mat& image, for( ;; x += dx, y += dy ) { uchar* mdata; - int i1, j1; + int64_t i1, j1; if( xflag ) { @@ -661,8 +662,8 @@ HoughLinesProbabilistic( Mat& image, if( *mdata ) { gap = 0; - line_end[k].y = i1; - line_end[k].x = j1; + line_end[k].y = static_cast(i1); + line_end[k].x = static_cast(j1); } else if( ++gap > lineGap ) break; @@ -674,7 +675,7 @@ HoughLinesProbabilistic( Mat& image, for( k = 0; k < 2; k++ ) { - int x = x0, y = y0, dx = dx0, dy = dy0; + int64_t x = x0, y = y0, dx = dx0, dy = dy0; if( k > 0 ) dx = -dx, dy = -dy; @@ -684,7 +685,7 @@ HoughLinesProbabilistic( Mat& image, for( ;; x += dx, y += dy ) { uchar* mdata; - int i1, j1; + int64_t i1, j1; if( xflag ) {