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

empty cascade

parent 4881205b
This diff is collapsed.
...@@ -40,127 +40,127 @@ ...@@ -40,127 +40,127 @@
// //
//M*/ //M*/
#include <opencv2/gpu/device/common.hpp> // #include <opencv2/gpu/device/common.hpp>
#ifndef __OPENCV_ICF_HPP__ // #ifndef __OPENCV_ICF_HPP__
#define __OPENCV_ICF_HPP__ // #define __OPENCV_ICF_HPP__
#if defined __CUDACC__ // #if defined __CUDACC__
# define __device __device__ __forceinline__ // # define __device __device__ __forceinline__
#else // #else
# define __device // # define __device
#endif // #endif
namespace cv { namespace gpu { namespace icf { // namespace cv { namespace gpu { namespace icf {
using cv::gpu::PtrStepSzb; // using cv::gpu::PtrStepSzb;
using cv::gpu::PtrStepSzf; // using cv::gpu::PtrStepSzf;
typedef unsigned char uchar; // typedef unsigned char uchar;
struct __align__(16) Octave // struct __align__(16) Octave
{ // {
ushort index; // ushort index;
ushort stages; // ushort stages;
ushort shrinkage; // ushort shrinkage;
ushort2 size; // ushort2 size;
float scale; // float scale;
Octave(const ushort i, const ushort s, const ushort sh, const ushort2 sz, const float sc) // Octave(const ushort i, const ushort s, const ushort sh, const ushort2 sz, const float sc)
: index(i), stages(s), shrinkage(sh), size(sz), scale(sc) {} // : index(i), stages(s), shrinkage(sh), size(sz), scale(sc) {}
}; // };
struct __align__(8) Level //is actually 24 bytes // struct __align__(8) Level //is actually 24 bytes
{ // {
int octave; // int octave;
// float origScale; //not actually used // // float origScale; //not actually used
float relScale; // float relScale;
float shrScale; // used for marking detection // float shrScale; // used for marking detection
float scaling[2]; // calculated according to Dollal paper // float scaling[2]; // calculated according to Dollal paper
// for 640x480 we can not get overflow // // for 640x480 we can not get overflow
uchar2 workRect; // uchar2 workRect;
uchar2 objSize; // uchar2 objSize;
Level(int idx, const Octave& oct, const float scale, const int w, const int h) // Level(int idx, const Octave& oct, const float scale, const int w, const int h)
: octave(idx), relScale(scale / oct.scale), shrScale (relScale / (float)oct.shrinkage) // : octave(idx), relScale(scale / oct.scale), shrScale (relScale / (float)oct.shrinkage)
{ // {
workRect.x = round(w / (float)oct.shrinkage); // workRect.x = round(w / (float)oct.shrinkage);
workRect.y = round(h / (float)oct.shrinkage); // workRect.y = round(h / (float)oct.shrinkage);
objSize.x = round(oct.size.x * relScale); // objSize.x = round(oct.size.x * relScale);
objSize.y = round(oct.size.y * relScale); // objSize.y = round(oct.size.y * relScale);
} // }
}; // };
struct Cascade // struct Cascade
{ // {
Cascade() {} // Cascade() {}
Cascade(const cv::gpu::PtrStepSzb& octs, const cv::gpu::PtrStepSzf& sts, const cv::gpu::PtrStepSzb& nds, // Cascade(const cv::gpu::PtrStepSzb& octs, const cv::gpu::PtrStepSzf& sts, const cv::gpu::PtrStepSzb& nds,
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::PtrStepSzi& hogluv, cv::gpu::PtrStepSz<uchar4> objects, cudaStream_t stream) const; // void detect(const cv::gpu::PtrStepSzi& hogluv, cv::gpu::PtrStepSz<uchar4> objects, cudaStream_t stream) const;
void __device detectAt(const int* __restrict__ hogluv, const int pitch, PtrStepSz<uchar4>& objects) const; // void __device detectAt(const int* __restrict__ hogluv, const int pitch, PtrStepSz<uchar4>& objects) const;
float __device rescale(const icf::Level& level, uchar4& scaledRect, // float __device rescale(const icf::Level& level, uchar4& scaledRect,
const int channel, const float threshold) const; // const int channel, const float threshold) const;
PtrStepSzb octaves; // PtrStepSzb octaves;
PtrStepSzf stages; // PtrStepSzf stages;
PtrStepSzb nodes; // PtrStepSzb nodes;
PtrStepSzf leaves; // PtrStepSzf leaves;
PtrStepSzb features; // PtrStepSzb features;
PtrStepSzb levels; // PtrStepSzb levels;
}; // };
struct ChannelStorage // struct ChannelStorage
{ // {
ChannelStorage(){} // ChannelStorage(){}
ChannelStorage(const cv::gpu::PtrStepSzb& buff, const cv::gpu::PtrStepSzb& shr, // ChannelStorage(const cv::gpu::PtrStepSzb& buff, const cv::gpu::PtrStepSzb& shr,
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::PtrStepSz<uchar3>& rgb, cudaStream_t stream){} // void frame(const cv::gpu::PtrStepSz<uchar3>& rgb, cudaStream_t stream){}
PtrStepSzb dmem; // PtrStepSzb dmem;
PtrStepSzb shrunk; // PtrStepSzb shrunk;
PtrStepSzb hogluv; // PtrStepSzb hogluv;
enum // enum
{ // {
FRAME_WIDTH = 640, // FRAME_WIDTH = 640,
FRAME_HEIGHT = 480, // FRAME_HEIGHT = 480,
TOTAL_SCALES = 55, // TOTAL_SCALES = 55,
CLASSIFIERS = 5, // CLASSIFIERS = 5,
ORIG_OBJECT_WIDTH = 64, // ORIG_OBJECT_WIDTH = 64,
ORIG_OBJECT_HEIGHT = 128, // ORIG_OBJECT_HEIGHT = 128,
HOG_BINS = 6, // HOG_BINS = 6,
HOG_LUV_BINS = 10 // HOG_LUV_BINS = 10
}; // };
int shrinkage; // int shrinkage;
static const float magnitudeScaling = 1.f ;// / sqrt(2); // static const float magnitudeScaling = 1.f ;// / sqrt(2);
}; // };
struct __align__(8) Node // struct __align__(8) Node
{ // {
int feature; // int feature;
float threshold; // float threshold;
Node(const int f, const float t) : feature(f), threshold(t) {} // Node(const int f, const float t) : feature(f), threshold(t) {}
}; // };
struct __align__(8) Feature // struct __align__(8) Feature
{ // {
int channel; // int channel;
uchar4 rect; // uchar4 rect;
Feature(const int c, const uchar4 r) : channel(c), rect(r) {} // Feature(const int c, const uchar4 r) : channel(c), rect(r) {}
}; // };
}}} // }}}
#endif // #endif
\ No newline at end of file \ No newline at end of file
This diff is collapsed.
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