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

Corrects objects matrix in case of the absence of objects

parent 838842cc
......@@ -422,19 +422,15 @@ inline void cv::gpu::SoftCascade::Filds::calcLevels(const std::vector<device::ic
if (::fabs(scale - maxScale) < FLT_EPSILON) break;
scale = ::std::min(maxScale, ::expf(::log(scale) + logFactor));
// printf("level: %d (%f %f) [%f %f] (%d %d) (%d %d)\n", level.octave, level.relScale, level.shrScale,
// level.scaling[0], level.scaling[1], level.workRect.x, level.workRect.y, level.objSize.x,
//level.objSize.y);
std::cout << "level " << sc
<< " octeve "
<< vlevels[sc].octave
<< " relScale "
<< vlevels[sc].relScale
<< " " << vlevels[sc].shrScale
<< " [" << (int)vlevels[sc].objSize.x
<< " " << (int)vlevels[sc].objSize.y << "] ["
<< (int)vlevels[sc].workRect.x << " " << (int)vlevels[sc].workRect.y << "]" << std::endl;
// std::cout << "level " << sc
// << " octeve "
// << vlevels[sc].octave
// << " relScale "
// << vlevels[sc].relScale
// << " " << vlevels[sc].shrScale
// << " [" << (int)vlevels[sc].objSize.x
// << " " << (int)vlevels[sc].objSize.y << "] ["
// << (int)vlevels[sc].workRect.x << " " << (int)vlevels[sc].workRect.y << "]" << std::endl;
}
levels.upload(cv::Mat(1, vlevels.size() * sizeof(Level), CV_8UC1, (uchar*)&(vlevels[0]) ));
......@@ -578,7 +574,10 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& colored, const GpuMat&
cv::Mat out(flds.detCounter);
int ndetections = *(out.data);
objects = GpuMat(objects, cv::Rect(0, 0, ndetections * sizeof(Detection), 1));
if (! ndetections)
objects = GpuMat();
else
objects = GpuMat(objects, cv::Rect(0, 0, ndetections * sizeof(Detection), 1));
}
void cv::gpu::SoftCascade::detectMultiScale(const GpuMat&, const GpuMat&, GpuMat&, int, GpuMat&, Stream) const
......
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