Commit 93273b8ac8e6dfdf0db9e89f63ada983d645dc57

Authored by Josh Klontz
1 parent d6363dcb

remove draw properties

openbr/plugins/gui/drawpropertiespoint.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 -#include <openbr/core/opencvutils.h>  
19 -  
20 -#include <opencv2/imgproc.hpp>  
21 -  
22 -using namespace cv;  
23 -  
24 -namespace br  
25 -{  
26 -  
27 -/*!  
28 - * \ingroup transforms  
29 - * \brief Draw the values of a list of properties at the specified point on the image  
30 - *  
31 - * The inPlace argument controls whether or not the image is cloned before it is drawn on.  
32 - *  
33 - * \author Charles Otto \cite caotto  
34 - */  
35 -class DrawPropertiesPointTransform : public UntrainableTransform  
36 -{  
37 - Q_OBJECT  
38 - Q_PROPERTY(QStringList propNames READ get_propNames WRITE set_propNames RESET reset_propNames STORED false)  
39 - Q_PROPERTY(QString pointName READ get_pointName WRITE set_pointName RESET reset_pointName STORED false)  
40 - Q_PROPERTY(bool inPlace READ get_inPlace WRITE set_inPlace RESET reset_inPlace STORED false)  
41 - BR_PROPERTY(QStringList, propNames, QStringList())  
42 - BR_PROPERTY(QString, pointName, "")  
43 - BR_PROPERTY(bool, inPlace, false)  
44 -  
45 - void project(const Template &src, Template &dst) const  
46 - {  
47 - dst = src;  
48 - if (propNames.isEmpty() || pointName.isEmpty())  
49 - return;  
50 -  
51 - dst.m() = inPlace ? src.m() : src.m().clone();  
52 -  
53 - QVariant point = dst.file.value(pointName);  
54 -  
55 - if (!point.canConvert(QVariant::PointF))  
56 - return;  
57 -  
58 - QPointF targetPoint = point.toPointF();  
59 -  
60 - Point2f cvPoint = OpenCVUtils::toPoint(targetPoint);  
61 -  
62 - const Scalar textColor(255, 255, 0);  
63 -  
64 - std::string outString = "";  
65 - foreach (const QString &propName, propNames)  
66 - {  
67 - QVariant prop = dst.file.value(propName);  
68 -  
69 - if (!prop.canConvert(QVariant::String))  
70 - continue;  
71 - QString propString = prop.toString();  
72 - outString += propName.toStdString() + ": " + propString.toStdString() + " ";  
73 -  
74 - }  
75 - if (outString.empty())  
76 - return;  
77 -  
78 - putText(dst.m(), outString, cvPoint, FONT_HERSHEY_SIMPLEX, 0.5, textColor, 1);  
79 - }  
80 -  
81 -};  
82 -  
83 -BR_REGISTER(Transform, DrawPropertiesPointTransform)  
84 -  
85 -} // namespace br  
86 -  
87 -#include "gui/drawpropertiespoint.moc"  
openbr/plugins/gui/drawpropertypoint.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 -#include <openbr/core/opencvutils.h>  
19 -  
20 -#include <opencv2/imgproc.hpp>  
21 -  
22 -using namespace cv;  
23 -  
24 -namespace br  
25 -{  
26 -  
27 -/*!  
28 - * \ingroup transforms  
29 - * \brief Draw the value of the specified property at the specified point on the image  
30 - *  
31 - * The inPlace argument controls whether or not the image is cloned before it is drawn on.  
32 - *  
33 - * \author Charles Otto \cite caotto  
34 - */  
35 -class DrawPropertyPointTransform : public UntrainableTransform  
36 -{  
37 - Q_OBJECT  
38 - Q_PROPERTY(QString propName READ get_propName WRITE set_propName RESET reset_propName STORED false)  
39 - Q_PROPERTY(QString pointName READ get_pointName WRITE set_pointName RESET reset_pointName STORED false)  
40 - Q_PROPERTY(bool inPlace READ get_inPlace WRITE set_inPlace RESET reset_inPlace STORED false)  
41 - BR_PROPERTY(QString, propName, "")  
42 - BR_PROPERTY(QString, pointName, "")  
43 - BR_PROPERTY(bool, inPlace, false)  
44 -  
45 -  
46 - void project(const Template &src, Template &dst) const  
47 - {  
48 - dst = src;  
49 - if (propName.isEmpty() || pointName.isEmpty())  
50 - return;  
51 -  
52 - dst.m() = inPlace ? src.m() : src.m().clone();  
53 -  
54 - const Scalar textColor(255, 255, 0);  
55 -  
56 - QVariant prop = dst.file.value(propName);  
57 -  
58 -  
59 - if (!prop.canConvert(QVariant::String))  
60 - return;  
61 - QString propString = prop.toString();  
62 -  
63 - QVariant point = dst.file.value(pointName);  
64 -  
65 - if (!point.canConvert(QVariant::PointF))  
66 - return;  
67 -  
68 - QPointF targetPoint = point.toPointF();  
69 -  
70 - Point2f cvPoint = OpenCVUtils::toPoint(targetPoint);  
71 -  
72 - std::string text = propName.toStdString() + ": " + propString.toStdString();  
73 - putText(dst.m(), text, cvPoint, FONT_HERSHEY_SIMPLEX, 0.5, textColor, 1);  
74 - }  
75 -  
76 -};  
77 -BR_REGISTER(Transform, DrawPropertyPointTransform)  
78 -  
79 -} // namespace br  
80 -  
81 -#include "gui/drawpropertypoint.moc"