diff --git a/openbr/plugins/representation/gradienthistogram.cpp b/openbr/plugins/representation/gradienthistogram.cpp deleted file mode 100644 index 0958032..0000000 --- a/openbr/plugins/representation/gradienthistogram.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include -#include - -#include -#include - -using namespace cv; - -namespace br -{ - -/*! - * \ingroup representations - * \brief Computes first order gradient histogram features using an integral image - * \author Scott Klum \cite sklum - */ -class GradientHistogramRepresentation : public Representation -{ - Q_OBJECT - - Q_PROPERTY(int winWidth READ get_winWidth WRITE set_winWidth RESET reset_winWidth STORED false) - Q_PROPERTY(int winHeight READ get_winHeight WRITE set_winHeight RESET reset_winHeight STORED false) - Q_PROPERTY(int bins READ get_bins WRITE set_bins RESET reset_bins STORED false) - Q_PROPERTY(bool squareOnly READ get_squareOnly WRITE set_squareOnly RESET reset_squareOnly STORED false) - BR_PROPERTY(int, winWidth, 24) - BR_PROPERTY(int, winHeight, 24) - BR_PROPERTY(int, bins, 6) - BR_PROPERTY(bool, squareOnly, false) - - void init() - { - if (features.isEmpty()) { - int dx, dy; - Size size = windowSize(&dx,&dy); - - int width = size.width+dx, height = size.height+dy; - - // Enumerate all possible rectangles - for (int x=0; x 256 ? CV_16U : CV_8U, bins/360., floor); - - // Mask and compute integral image - std::vector outputs; - for (int i=0; i(); - - int four = ptr[((features[index].y+features[index].height)*(size.height+dy)+(features[index].x+features[index].width))*bins+channel]; - int one = ptr[(features[index].y*(size.height+dy)+features[index].x)*bins+channel]; - int two = ptr[(features[index].y*(size.height+dy)+(features[index].x+features[index].width))*bins+channel]; - int three = ptr[((features[index].y+features[index].height)*(size.height+dy)+features[index].x)*bins+channel]; - - return four + one - (two + three); - } - - Mat evaluate(const Mat &image, const QList &indices) const - { - int size = indices.empty() ? numFeatures() : indices.size(); - - Mat result(1, size, CV_32FC1); - for (int i = 0; i < size; i++) - result.at(i) = evaluate(image, indices.empty() ? i : indices[i]); - - return result; - } - - int numFeatures() const - { - return features.size()*bins; - } - - int numChannels() const - { - return bins; - } - - Size windowSize(int *dx, int *dy) const - { - if (dx && dy) - *dx = *dy = 1; - return Size(winWidth, winHeight); - } - - int maxCatCount() const { return 0; } - - QList features; -}; - -BR_REGISTER(Representation, GradientHistogramRepresentation) - -} // namespace br - -#include "representation/gradienthistogram.moc" - -