Corrects objects matrix in case of the absence of objects
This commit is contained in:
parent
838842cc96
commit
fdef0adf95
@ -422,19 +422,15 @@ inline void cv::gpu::SoftCascade::Filds::calcLevels(const std::vector<device::ic
|
|||||||
if (::fabs(scale - maxScale) < FLT_EPSILON) break;
|
if (::fabs(scale - maxScale) < FLT_EPSILON) break;
|
||||||
scale = ::std::min(maxScale, ::expf(::log(scale) + logFactor));
|
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,
|
// std::cout << "level " << sc
|
||||||
// level.scaling[0], level.scaling[1], level.workRect.x, level.workRect.y, level.objSize.x,
|
// << " octeve "
|
||||||
//level.objSize.y);
|
// << vlevels[sc].octave
|
||||||
|
// << " relScale "
|
||||||
std::cout << "level " << sc
|
// << vlevels[sc].relScale
|
||||||
<< " octeve "
|
// << " " << vlevels[sc].shrScale
|
||||||
<< vlevels[sc].octave
|
// << " [" << (int)vlevels[sc].objSize.x
|
||||||
<< " relScale "
|
// << " " << (int)vlevels[sc].objSize.y << "] ["
|
||||||
<< vlevels[sc].relScale
|
// << (int)vlevels[sc].workRect.x << " " << (int)vlevels[sc].workRect.y << "]" << std::endl;
|
||||||
<< " " << 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]) ));
|
levels.upload(cv::Mat(1, vlevels.size() * sizeof(Level), CV_8UC1, (uchar*)&(vlevels[0]) ));
|
||||||
@ -578,6 +574,9 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& colored, const GpuMat&
|
|||||||
cv::Mat out(flds.detCounter);
|
cv::Mat out(flds.detCounter);
|
||||||
int ndetections = *(out.data);
|
int ndetections = *(out.data);
|
||||||
|
|
||||||
|
if (! ndetections)
|
||||||
|
objects = GpuMat();
|
||||||
|
else
|
||||||
objects = GpuMat(objects, cv::Rect(0, 0, ndetections * sizeof(Detection), 1));
|
objects = GpuMat(objects, cv::Rect(0, 0, ndetections * sizeof(Detection), 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user