Commit ca81628a authored by marina.kolpakova's avatar marina.kolpakova

fix retrieval of detections count

parent 022a8b96
...@@ -313,7 +313,7 @@ namespace icf { ...@@ -313,7 +313,7 @@ namespace icf {
dim3 block(32, 8); dim3 block(32, 8);
dim3 grid(fw, fh / 8, (scale == -1) ? downscales : 1); 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(); Detection* det = (Detection*)objects.ptr();
uint max_det = objects.cols / sizeof(Detection); uint max_det = objects.cols / sizeof(Detection);
......
...@@ -541,7 +541,7 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& colored, const GpuMat& ...@@ -541,7 +541,7 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& colored, const GpuMat&
flds.detect(specificScale, rois, objects, 0); flds.detect(specificScale, rois, objects, 0);
cv::Mat out(flds.detCounter); cv::Mat out(flds.detCounter);
int ndetections = *(out.data); int ndetections = *(out.ptr<int>(0));
if (! ndetections) if (! ndetections)
objects = GpuMat(); objects = GpuMat();
......
...@@ -257,5 +257,9 @@ TEST(SoftCascadeTest, detect) ...@@ -257,5 +257,9 @@ TEST(SoftCascadeTest, detect)
cv::gpu::transpose(rois, trois); cv::gpu::transpose(rois, trois);
cascade.detectMultiScale(colored, trois, objectBoxes); cascade.detectMultiScale(colored, trois, objectBoxes);
typedef cv::gpu::SoftCascade::Detection Detection;
cv::Mat detections(objectBoxes);
ASSERT_EQ(detections.cols / sizeof(Detection) ,3670U);
} }
#endif #endif
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment