From ca81628a9a3fe8e82f5ba3348a3036e5b6475e45 Mon Sep 17 00:00:00 2001 From: "marina.kolpakova" Date: Mon, 15 Oct 2012 17:38:21 +0400 Subject: [PATCH] fix retrieval of detections count --- modules/gpu/src/cuda/isf-sc.cu | 2 +- modules/gpu/src/softcascade.cpp | 2 +- modules/gpu/test/test_softcascade.cpp | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/gpu/src/cuda/isf-sc.cu b/modules/gpu/src/cuda/isf-sc.cu index 74e47ba19..7aef41abc 100644 --- a/modules/gpu/src/cuda/isf-sc.cu +++ b/modules/gpu/src/cuda/isf-sc.cu @@ -313,7 +313,7 @@ namespace icf { dim3 block(32, 8); dim3 grid(fw, fh / 8, (scale == -1) ? downscales : 1); - uint* ctr = (uint*)counter.ptr(); + uint* ctr = (uint*)(counter.ptr(0)); Detection* det = (Detection*)objects.ptr(); uint max_det = objects.cols / sizeof(Detection); diff --git a/modules/gpu/src/softcascade.cpp b/modules/gpu/src/softcascade.cpp index e5d8cb9fb..560c25196 100644 --- a/modules/gpu/src/softcascade.cpp +++ b/modules/gpu/src/softcascade.cpp @@ -541,7 +541,7 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& colored, const GpuMat& flds.detect(specificScale, rois, objects, 0); cv::Mat out(flds.detCounter); - int ndetections = *(out.data); + int ndetections = *(out.ptr(0)); if (! ndetections) objects = GpuMat(); diff --git a/modules/gpu/test/test_softcascade.cpp b/modules/gpu/test/test_softcascade.cpp index 04fa9b181..04c38557c 100644 --- a/modules/gpu/test/test_softcascade.cpp +++ b/modules/gpu/test/test_softcascade.cpp @@ -257,5 +257,9 @@ TEST(SoftCascadeTest, detect) cv::gpu::transpose(rois, trois); cascade.detectMultiScale(colored, trois, objectBoxes); + + typedef cv::gpu::SoftCascade::Detection Detection; + cv::Mat detections(objectBoxes); + ASSERT_EQ(detections.cols / sizeof(Detection) ,3670U); } #endif \ No newline at end of file