From e3f3de84db5712e480b1620b7595845128715068 Mon Sep 17 00:00:00 2001 From: Anatoly Baksheev Date: Fri, 21 Jan 2011 09:00:19 +0000 Subject: [PATCH] warning fixed --- modules/gpu/src/cascadeclassifier.cpp | 60 +++++++++++++++++------------------ samples/gpu/cascadeclassifier.cpp | 4 +-- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/modules/gpu/src/cascadeclassifier.cpp b/modules/gpu/src/cascadeclassifier.cpp index ec24b28..15e5d7f 100644 --- a/modules/gpu/src/cascadeclassifier.cpp +++ b/modules/gpu/src/cascadeclassifier.cpp @@ -294,38 +294,38 @@ int cv::gpu::CascadeClassifier_GPU::detectMultiScale( const GpuMat& image, GpuMa return numDetections; } - struct RectConvert - { - Rect operator()(const NcvRect32u& nr) const { return Rect(nr.x, nr.y, nr.width, nr.height); } - NcvRect32u operator()(const Rect& nr) const - { - NcvRect32u rect; - rect.x = nr.x; - rect.y = nr.y; - rect.width = nr.width; - rect.height = nr.height; - return rect; - } - }; - - void groupRectangles(std::vector &hypotheses, int groupThreshold, double eps, std::vector *weights) +struct RectConvert +{ + Rect operator()(const NcvRect32u& nr) const { return Rect(nr.x, nr.y, nr.width, nr.height); } + NcvRect32u operator()(const Rect& nr) const + { + NcvRect32u rect; + rect.x = nr.x; + rect.y = nr.y; + rect.width = nr.width; + rect.height = nr.height; + return rect; + } +}; + +void groupRectangles(std::vector &hypotheses, int groupThreshold, double eps, std::vector *weights) +{ + vector rects(hypotheses.size()); + std::transform(hypotheses.begin(), hypotheses.end(), rects.begin(), RectConvert()); + + if (weights) { - vector rects(hypotheses.size()); - std::transform(hypotheses.begin(), hypotheses.end(), rects.begin(), RectConvert()); - - if (weights) - { - vector weights_int; - weights_int.assign(weights->begin(), weights->end()); - cv::groupRectangles(rects, weights_int, groupThreshold, eps); - } - else - { - cv::groupRectangles(rects, groupThreshold, eps); - } - std::transform(rects.begin(), rects.end(), hypotheses.begin(), RectConvert()); - hypotheses.resize(rects.size()); + vector weights_int; + weights_int.assign(weights->begin(), weights->end()); + cv::groupRectangles(rects, weights_int, groupThreshold, eps); } + else + { + cv::groupRectangles(rects, groupThreshold, eps); + } + std::transform(rects.begin(), rects.end(), hypotheses.begin(), RectConvert()); + hypotheses.resize(rects.size()); +} #if 1 /* loadFromXML implementation switch */ diff --git a/samples/gpu/cascadeclassifier.cpp b/samples/gpu/cascadeclassifier.cpp index 5a16568..5c4a525 100644 --- a/samples/gpu/cascadeclassifier.cpp +++ b/samples/gpu/cascadeclassifier.cpp @@ -190,8 +190,8 @@ int main( int argc, const char** argv ) case '3': font_scale*=1.05; printf("Fond scale = %g\n", font_scale); break; case 'e': case 'E':font_scale/=1.05; printf("Fond scale = %g\n", font_scale); break; - case '2': ++minNeighbors; printf("Min Neighbors = %g\n", minNeighbors); break; - case 'w': case 'W':minNeighbors = max(minNeighbors-1, 0); printf("Min Neighbors = %g\n", minNeighbors); break; + case '2': ++minNeighbors; printf("Min Neighbors = %d\n", minNeighbors); break; + case 'w': case 'W':minNeighbors = max(minNeighbors-1, 0); printf("Min Neighbors = %d\n", minNeighbors); break; } } -- 2.7.4