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 ...@@ -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,7 +574,10 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& colored, const GpuMat& ...@@ -578,7 +574,10 @@ 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);
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 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