Commit 41af8384d611a80ec89434b3c15329f46ccf2273

Authored by Josh Klontz
1 parent 7d8fb470

remove grid

openbr/plugins/metadata/grid.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 <opencv2/imgproc/imgproc.hpp>
18   -#include <openbr/plugins/openbr_internal.h>
19   -#include <openbr/core/opencvutils.h>
20   -
21   -using namespace cv;
22   -
23   -namespace br
24   -{
25   -
26   -/*!
27   - * \ingroup transforms
28   - * \brief Add landmarks to the Template in a grid layout
29   - * \author Josh Klontz \cite jklontz
30   - */
31   -class GridTransform : public UntrainableTransform
32   -{
33   - Q_OBJECT
34   - Q_PROPERTY(int rows READ get_rows WRITE set_rows RESET reset_rows STORED false)
35   - Q_PROPERTY(int columns READ get_columns WRITE set_columns RESET reset_columns STORED false)
36   - Q_PROPERTY(float border READ get_border WRITE set_border RESET reset_border STORED false)
37   - Q_PROPERTY(float angle READ get_angle WRITE set_angle RESET reset_angle STORED false)
38   - BR_PROPERTY(int, rows, 1)
39   - BR_PROPERTY(int, columns, 1)
40   - BR_PROPERTY(float, border, 0)
41   - BR_PROPERTY(float, angle, 0)
42   -
43   - void project(const Template &src, Template &dst) const
44   - {
45   - QList<QPointF> landmarks;
46   - const float row_border = (border < 1 ? src.m().rows*border : border);
47   - const float col_border = (border < 1 ? src.m().cols*border : border);
48   - const float row_step = (src.m().rows-row_border*2) / rows;
49   - const float column_step = (src.m().cols-col_border*2) / columns;
50   - for (float y=row_step/2+row_border; y<src.m().rows-row_border; y+=row_step)
51   - for (float x=column_step/2+col_border; x<src.m().cols-col_border; x+=column_step)
52   - landmarks.append(QPointF(x,y));
53   -
54   - if (angle > 0) {
55   - const Mat rotMatrix = getRotationMatrix2D(Point2f(src.m().cols / 2, src.m().rows / 2), angle, 1.0);
56   - landmarks = OpenCVUtils::rotatePoints(landmarks, rotMatrix);
57   - }
58   -
59   - dst = src;
60   - dst.file.setPoints(landmarks);
61   - }
62   -};
63   -
64   -BR_REGISTER(Transform, GridTransform)
65   -
66   -} // namespace br
67   -
68   -#include "metadata/grid.moc"