|
|
|
@ -69,12 +69,29 @@ namespace cv { namespace gpu { namespace device { |
|
|
|
|
namespace icf { |
|
|
|
|
void fillBins(cv::gpu::PtrStepSzb hogluv, const cv::gpu::PtrStepSzf& nangle, |
|
|
|
|
const int fw, const int fh, const int bins); |
|
|
|
|
void detect(const PtrStepSzb& levels, const PtrStepSzb& octaves, const PtrStepSzf& stages, |
|
|
|
|
const PtrStepSzb& nodes, const PtrStepSzf& leaves, const PtrStepSzi& hogluv, PtrStepSz<uchar4> objects, |
|
|
|
|
PtrStepSzi counter, const int downscales); |
|
|
|
|
void detectAtScale(const int scale, const PtrStepSzb& levels, const PtrStepSzb& octaves, const PtrStepSzf& stages, |
|
|
|
|
const PtrStepSzb& nodes, const PtrStepSzf& leaves, const PtrStepSzi& hogluv, PtrStepSz<uchar4> objects, |
|
|
|
|
PtrStepSzi counter, const int downscales); |
|
|
|
|
|
|
|
|
|
void detect(const PtrStepSzb& rois, |
|
|
|
|
const PtrStepSzb& levels, |
|
|
|
|
const PtrStepSzb& octaves, |
|
|
|
|
const PtrStepSzf& stages, |
|
|
|
|
const PtrStepSzb& nodes, |
|
|
|
|
const PtrStepSzf& leaves, |
|
|
|
|
const PtrStepSzi& hogluv, |
|
|
|
|
PtrStepSz<uchar4> objects, |
|
|
|
|
PtrStepSzi counter, |
|
|
|
|
const int downscales); |
|
|
|
|
|
|
|
|
|
void detectAtScale(const int scale, |
|
|
|
|
const PtrStepSzb& rois, |
|
|
|
|
const PtrStepSzb& levels, |
|
|
|
|
const PtrStepSzb& octaves, |
|
|
|
|
const PtrStepSzf& stages, |
|
|
|
|
const PtrStepSzb& nodes, |
|
|
|
|
const PtrStepSzf& leaves, |
|
|
|
|
const PtrStepSzi& hogluv, |
|
|
|
|
PtrStepSz<uchar4> objects, |
|
|
|
|
PtrStepSzi counter, |
|
|
|
|
const int downscales); |
|
|
|
|
} |
|
|
|
|
}}} |
|
|
|
|
|
|
|
|
@ -143,16 +160,16 @@ struct cv::gpu::SoftCascade::Filds |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
bool fill(const FileNode &root, const float mins, const float maxs); |
|
|
|
|
void detect(cv::gpu::GpuMat objects, cudaStream_t stream) const |
|
|
|
|
void detect(cv::gpu::GpuMat roi, cv::gpu::GpuMat objects, cudaStream_t stream) const |
|
|
|
|
{ |
|
|
|
|
cudaMemset(detCounter.data, 0, detCounter.step * detCounter.rows * sizeof(int)); |
|
|
|
|
device::icf::detect(levels, octaves, stages, nodes, leaves, hogluv, objects , detCounter, downscales); |
|
|
|
|
device::icf::detect(roi, levels, octaves, stages, nodes, leaves, hogluv, objects , detCounter, downscales); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void detectAtScale(int scale, cv::gpu::GpuMat objects, cudaStream_t stream) const |
|
|
|
|
void detectAtScale(int scale, cv::gpu::GpuMat roi, cv::gpu::GpuMat objects, cudaStream_t stream) const |
|
|
|
|
{ |
|
|
|
|
cudaMemset(detCounter.data, 0, detCounter.step * detCounter.rows * sizeof(int)); |
|
|
|
|
device::icf::detectAtScale(scale, levels, octaves, stages, nodes, leaves, hogluv, objects, |
|
|
|
|
device::icf::detectAtScale(scale, roi, levels, octaves, stages, nodes, leaves, hogluv, objects, |
|
|
|
|
detCounter, downscales); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -467,6 +484,9 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& colored, const GpuMat& |
|
|
|
|
// only color images are supperted
|
|
|
|
|
CV_Assert(colored.type() == CV_8UC3); |
|
|
|
|
|
|
|
|
|
// we guess user knows about shrincage
|
|
|
|
|
CV_Assert((rois.size() == getRoiSize()) && (rois.type() == CV_8UC1)); |
|
|
|
|
|
|
|
|
|
// only this window size allowed
|
|
|
|
|
CV_Assert(colored.cols == Filds::FRAME_WIDTH && colored.rows == Filds::FRAME_HEIGHT); |
|
|
|
|
|
|
|
|
@ -551,9 +571,9 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& colored, const GpuMat& |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (specificScale == -1) |
|
|
|
|
flds.detect(objects, 0); |
|
|
|
|
flds.detect(rois,objects, 0); |
|
|
|
|
else |
|
|
|
|
flds.detectAtScale(specificScale, objects, 0); |
|
|
|
|
flds.detectAtScale(specificScale, rois, objects, 0); |
|
|
|
|
|
|
|
|
|
cv::Mat out(flds.detCounter); |
|
|
|
|
int ndetections = *(out.data); |
|
|
|
|