diff --git a/openbr/plugins/representation/gradienthistogram.cpp b/openbr/plugins/representation/gradienthistogram.cpp index a1de56e..58fd84d 100644 --- a/openbr/plugins/representation/gradienthistogram.cpp +++ b/openbr/plugins/representation/gradienthistogram.cpp @@ -41,7 +41,6 @@ class GradientHistogramRepresentation : public Representation void preprocess(const Mat &src, Mat &dst) const { - // Compute as is done in GradientTransform Mat dx, dy, magnitude, angle; Sobel(src, dx, CV_32F, 1, 0, CV_SCHARR); @@ -55,14 +54,17 @@ class GradientHistogramRepresentation : public Representation // Mask and compute integral image std::vector outputs; - for (int i=0; i<1; i++) { + for (int i=0; i(features[index].y+features[index].height)[(features[index].x+features[index].width)*channel]; - int one = image.ptr(features[index].y)[features[index].x*channel]; - int two = image.ptr(features[index].y)[(features[index].x+features[index].width)*channel]; - int three = image.ptr(features[index].y+features[index].height)[features[index].x*channel]; + int four = image.ptr(0)[(features[index].y+features[index].height)*(features[index].x+features[index].width)*bins+channel]; + int one = image.ptr(0)[features[index].y*features[index].x*bins+channel]; + int two = image.ptr(0)[features[index].y*(features[index].x+features[index].width)*bins+channel]; + int three = image.ptr(0)[(features[index].y+features[index].height)*features[index].x*bins+channel]; return four + one - (two + three); } @@ -109,7 +107,7 @@ class GradientHistogramRepresentation : public Representation int numFeatures() const { - return features.size(); + return features.size()*bins; } Size windowSize(int *dx, int *dy) const