From 723af152288019ffe7ef8970390146310dd3ad80 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 11 Oct 2013 18:42:17 +0400 Subject: [PATCH] ocl: fix warnings from GCC 4.8, update Haar --- modules/imgproc/test/test_convhull.cpp | 8 ++++---- modules/ocl/src/haar.cpp | 28 ++++++---------------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/modules/imgproc/test/test_convhull.cpp b/modules/imgproc/test/test_convhull.cpp index 64fe7f6..e20b1a2 100644 --- a/modules/imgproc/test/test_convhull.cpp +++ b/modules/imgproc/test/test_convhull.cpp @@ -1290,14 +1290,14 @@ void CV_FitLineTest::generate_point_set( void* pointsSet ) t = (float)((cvtest::randReal(rng)-0.5)*low_high_range*2); for( k = 0; k < n; k++ ) + { p[k] = (float)((cvtest::randReal(rng)-0.5)*max_noise*2 + t*line0[k] + line0[k+n]); - if( point_type == CV_32S ) - for( k = 0; k < n; k++ ) + if( point_type == CV_32S ) pi[k] = cvRound(p[k]); - else - for( k = 0; k < n; k++ ) + else pf[k] = p[k]; + } } } diff --git a/modules/ocl/src/haar.cpp b/modules/ocl/src/haar.cpp index 71777f1..40c1f2a 100644 --- a/modules/ocl/src/haar.cpp +++ b/modules/ocl/src/haar.cpp @@ -625,37 +625,21 @@ static void gpuSetHaarClassifierCascade( CvHaarClassifierCascade *_cascade) cascade->p3 = equRect.width ; for( i = 0; i < _cascade->count; i++ ) { - int j, k, l; + int j, l; for( j = 0; j < stage_classifier[i].count; j++ ) { for( l = 0; l < stage_classifier[i].classifier[j].count; l++ ) { - CvHaarFeature *feature = + const CvHaarFeature *feature = &_cascade->stage_classifier[i].classifier[j].haar_feature[l]; GpuHidHaarTreeNode *hidnode = &stage_classifier[i].classifier[j].node[l]; - CvRect r[3]; - - int nr; - - /* align blocks */ - for( k = 0; k < CV_HAAR_FEATURE_MAX; k++ ) + for( int k = 0; k < CV_HAAR_FEATURE_MAX; k++ ) { - if(!hidnode->p[k][0]) + const CvRect tr = feature->rect[k].r; + if (tr.width == 0) break; - r[k] = feature->rect[k].r; - } - - nr = k; - for( k = 0; k < nr; k++ ) - { - CvRect tr; - double correction_ratio; - tr.x = r[k].x; - tr.width = r[k].width; - tr.y = r[k].y ; - tr.height = r[k].height; - correction_ratio = weight_scale * (!feature->tilted ? 1 : 0.5); + double correction_ratio = weight_scale * (!feature->tilted ? 1 : 0.5); hidnode->p[k][0] = tr.x; hidnode->p[k][1] = tr.y; hidnode->p[k][2] = tr.width; -- 2.7.4