diff --git a/sdk/plugins/reduce.cpp b/sdk/plugins/reduce.cpp index e052763..6038e61 100644 --- a/sdk/plugins/reduce.cpp +++ b/sdk/plugins/reduce.cpp @@ -122,6 +122,7 @@ BR_REGISTER(Transform, StatTransform) /*! * \ingroup transforms * \brief Downsample the rows and columns of a matrix. + * \author Lacey Best-Rowden \cite lbestrowden */ class DownsampleTransform : public UntrainableTransform { @@ -131,9 +132,15 @@ class DownsampleTransform : public UntrainableTransform void project(const Template &src, Template &dst) const { + if (src.m().channels() != 1) + qFatal("Expected 1 channel matrix."); Mat input = src.m(); - Mat output; - (void) input; // TODO: write me! + Mat output(ceil((double)input.rows/k), ceil((double)input.cols/k), CV_32FC1); + for (int r=0; r(r,c) = input.at(r*k,c*k); + } + } dst.m() = output; } }; diff --git a/share/openbr/openbr.bib b/share/openbr/openbr.bib index 71f922d..556446d 100644 --- a/share/openbr/openbr.bib +++ b/share/openbr/openbr.bib @@ -28,6 +28,11 @@ Author = {Charles A. Otto}, Howpublished = {https://github.com/caotto}, Title = {ottochar at gmail.com}} + +@misc{lbestrowden, + Author = {Lacey S. Best-Rowden}, + Howpublished = {https://github.com/lbestrowden}, + Title = {bestrow1 at msu.edu}} % Software