Commit a41b885ffa60e4493dbbfd89daf470fe0d6eb4f0
1 parent
c540330d
remove downsample
Showing
1 changed file
with
0 additions
and
54 deletions
openbr/plugins/imgproc/downsample.cpp deleted
| 1 | -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
| 2 | - * Copyright 2012 The MITRE Corporation * | |
| 3 | - * * | |
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); * | |
| 5 | - * you may not use this file except in compliance with the License. * | |
| 6 | - * You may obtain a copy of the License at * | |
| 7 | - * * | |
| 8 | - * http://www.apache.org/licenses/LICENSE-2.0 * | |
| 9 | - * * | |
| 10 | - * Unless required by applicable law or agreed to in writing, software * | |
| 11 | - * distributed under the License is distributed on an "AS IS" BASIS, * | |
| 12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * | |
| 13 | - * See the License for the specific language governing permissions and * | |
| 14 | - * limitations under the License. * | |
| 15 | - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | |
| 16 | - | |
| 17 | -#include <openbr/plugins/openbr_internal.h> | |
| 18 | - | |
| 19 | -using namespace cv; | |
| 20 | - | |
| 21 | -namespace br | |
| 22 | -{ | |
| 23 | - | |
| 24 | -/*! | |
| 25 | - * \ingroup transforms | |
| 26 | - * \brief Downsample the rows and columns of a matrix. | |
| 27 | - * \author Lacey Best-Rowden \cite lbestrowden | |
| 28 | - */ | |
| 29 | -class DownsampleTransform : public UntrainableTransform | |
| 30 | -{ | |
| 31 | - Q_OBJECT | |
| 32 | - Q_PROPERTY(int k READ get_k WRITE set_k RESET reset_k STORED false) | |
| 33 | - BR_PROPERTY(int, k, 1) | |
| 34 | - | |
| 35 | - void project(const Template &src, Template &dst) const | |
| 36 | - { | |
| 37 | - if (src.m().channels() != 1) | |
| 38 | - qFatal("Expected 1 channel matrix."); | |
| 39 | - Mat input = src.m(); | |
| 40 | - Mat output(ceil((double)input.rows/k), ceil((double)input.cols/k), CV_32FC1); | |
| 41 | - for (int r=0; r<output.rows; r++) { | |
| 42 | - for (int c=0; c<output.cols; c++) { | |
| 43 | - output.at<float>(r,c) = input.at<float>(r*k,c*k); | |
| 44 | - } | |
| 45 | - } | |
| 46 | - dst.m() = output; | |
| 47 | - } | |
| 48 | -}; | |
| 49 | - | |
| 50 | -BR_REGISTER(Transform, DownsampleTransform) | |
| 51 | - | |
| 52 | -} // namespace br | |
| 53 | - | |
| 54 | -#include "imgproc/downsample.moc" |