#include #include #include using namespace cv; namespace br { /*! * \ingroup transforms * \brief Computes integral image. * \author Josh Klontz \cite jklontz */ class IntegralTransform : public UntrainableTransform { Q_OBJECT void project(const Template &src, Template &dst) const { integral(src, dst); } }; BR_REGISTER(Transform, IntegralTransform) /*! * \ingroup transforms * \brief Sliding window object recognition from a multi-channel intergral image. * \author Josh Klontz \cite jklontz */ class IntegralSampler : public UntrainableTransform { Q_OBJECT Q_PROPERTY(int scales READ get_scales WRITE set_scales RESET reset_scales STORED false) Q_PROPERTY(float scaleFactor READ get_scaleFactor WRITE set_scaleFactor RESET reset_scaleFactor STORED false) Q_PROPERTY(float stepFactor READ get_stepFactor WRITE set_stepFactor RESET reset_stepFactor STORED false) Q_PROPERTY(int minSize READ get_minSize WRITE set_minSize RESET reset_minSize STORED false) BR_PROPERTY(int, scales, 1) BR_PROPERTY(float, scaleFactor, 1.25) BR_PROPERTY(float, stepFactor, 0.25) BR_PROPERTY(int, minSize, 8) void project(const Template &src, Template &dst) const { typedef Eigen::Map< const Eigen::Matrix > InputDescriptor; typedef Eigen::Map< Eigen::Matrix > OutputDescriptor; const Mat &m = src.m(); if (m.depth() != CV_32S) qFatal("Expected CV_32S matrix depth."); const int channels = m.channels(); const int rowStep = channels * m.cols; int descriptors = 0; int currentSize = min(m.rows, m.cols)-1; for (int scale=0; scale