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

CUDA callers

parent 4aac1444
...@@ -40,4 +40,15 @@ ...@@ -40,4 +40,15 @@
// //
//M*/ //M*/
#include <icf.hpp> #include <icf.hpp>
\ No newline at end of file
void icf::Cascade::detect(const cv::gpu::PtrStepSzb& hogluv) const
{
// detection kernel
}
void icf::ChannelStorage::frame(const cv::gpu::PtrStepSz<uchar4>& image)
{
// color convertin kernel
// hog calculation kernel
}
\ No newline at end of file
...@@ -64,6 +64,8 @@ struct Cascade ...@@ -64,6 +64,8 @@ struct Cascade
const cv::gpu::PtrStepSzf& lvs, const cv::gpu::PtrStepSzb& fts, const cv::gpu::PtrStepSzb& lls) const cv::gpu::PtrStepSzf& lvs, const cv::gpu::PtrStepSzb& fts, const cv::gpu::PtrStepSzb& lls)
: octaves(octs), stages(sts), nodes(nds), leaves(lvs), features(fts), levels(lls) {} : octaves(octs), stages(sts), nodes(nds), leaves(lvs), features(fts), levels(lls) {}
void detect(const cv::gpu::PtrStepSzb& hogluv) const;
PtrStepSzb octaves; PtrStepSzb octaves;
PtrStepSzf stages; PtrStepSzf stages;
PtrStepSzb nodes; PtrStepSzb nodes;
...@@ -81,7 +83,7 @@ struct ChannelStorage ...@@ -81,7 +83,7 @@ struct ChannelStorage
const cv::gpu::PtrStepSzb& itg, const int s) const cv::gpu::PtrStepSzb& itg, const int s)
: dmem (buff), shrunk(shr), hogluv(itg), shrinkage(s) {} : dmem (buff), shrunk(shr), hogluv(itg), shrinkage(s) {}
void frame(const cv::gpu::PtrStepSzb& image) {} void frame(const cv::gpu::PtrStepSz<uchar4>& image);
PtrStepSzb dmem; PtrStepSzb dmem;
PtrStepSzb shrunk; PtrStepSzb shrunk;
......
...@@ -74,7 +74,7 @@ struct cv::gpu::SoftCascade::Filds ...@@ -74,7 +74,7 @@ struct cv::gpu::SoftCascade::Filds
GpuMat features; GpuMat features;
GpuMat levels; GpuMat levels;
// preallocated buffer 640x480x10 // preallocated buffer 640x480x10 + 640x480
GpuMat dmem; GpuMat dmem;
// 160x120x10 // 160x120x10
GpuMat shrunk; GpuMat shrunk;
...@@ -86,9 +86,6 @@ struct cv::gpu::SoftCascade::Filds ...@@ -86,9 +86,6 @@ struct cv::gpu::SoftCascade::Filds
icf::Cascade cascade; icf::Cascade cascade;
icf::ChannelStorage storage; icf::ChannelStorage storage;
bool fill(const FileNode &root, const float mins, const float maxs);
void detect() const {}
enum { BOOST = 0 }; enum { BOOST = 0 };
enum enum
{ {
...@@ -102,6 +99,12 @@ struct cv::gpu::SoftCascade::Filds ...@@ -102,6 +99,12 @@ struct cv::gpu::SoftCascade::Filds
HOG_LUV_BINS = 10 HOG_LUV_BINS = 10
}; };
bool fill(const FileNode &root, const float mins, const float maxs);
void detect() const
{
cascade.detect(hogluv);
}
private: private:
void calcLevels(const std::vector<icf::Octave>& octs, void calcLevels(const std::vector<icf::Octave>& octs,
int frameW, int frameH, int nscales); int frameW, int frameH, int nscales);
...@@ -278,7 +281,7 @@ inline bool cv::gpu::SoftCascade::Filds::fill(const FileNode &root, const float ...@@ -278,7 +281,7 @@ inline bool cv::gpu::SoftCascade::Filds::fill(const FileNode &root, const float
cascade = icf::Cascade(octaves, stages, nodes, leaves, features, levels); cascade = icf::Cascade(octaves, stages, nodes, leaves, features, levels);
// allocate buffers // allocate buffers
dmem.create(FRAME_HEIGHT * HOG_LUV_BINS, FRAME_WIDTH, CV_8UC1); dmem.create(FRAME_HEIGHT * (HOG_LUV_BINS + 1), FRAME_WIDTH, CV_8UC1);
shrunk.create(FRAME_HEIGHT / shrinkage * HOG_LUV_BINS, FRAME_WIDTH / shrinkage, CV_8UC1); shrunk.create(FRAME_HEIGHT / shrinkage * HOG_LUV_BINS, FRAME_WIDTH / shrinkage, CV_8UC1);
hogluv.create( (FRAME_HEIGHT / shrinkage * HOG_LUV_BINS) + 1, (FRAME_WIDTH / shrinkage) + 1, CV_16UC1); hogluv.create( (FRAME_HEIGHT / shrinkage * HOG_LUV_BINS) + 1, (FRAME_WIDTH / shrinkage) + 1, CV_16UC1);
...@@ -395,7 +398,7 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& image, const GpuMat& / ...@@ -395,7 +398,7 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& image, const GpuMat& /
GpuMat& /*objects*/, const int /*rejectfactor*/, Stream /*stream*/) GpuMat& /*objects*/, const int /*rejectfactor*/, Stream /*stream*/)
{ {
// only color images are supperted // only color images are supperted
CV_Assert(image.type() == CV_8UC3); CV_Assert(image.type() == CV_8UC4);
// only this window size allowed // only this window size allowed
CV_Assert(image.cols == 640 && image.rows == 480); CV_Assert(image.cols == 640 && image.rows == 480);
...@@ -406,4 +409,4 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& image, const GpuMat& / ...@@ -406,4 +409,4 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& image, const GpuMat& /
flds.detect(); flds.detect();
} }
#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