35 #pragma warning(push, 0) // no warnings from includes 36 #include <QSharedPointer> 40 #include <opencv2/core.hpp> 43 #pragma warning (disable: 4251) // inlined Qt functions in dll interface 44 #pragma warning (disable: 4714) // force inline 47 #ifdef DLL_CORE_EXPORT 48 #define DllCoreExport Q_DECL_EXPORT 50 #define DllCoreExport Q_DECL_IMPORT 55 #define DK_DEG2RAD 0.017453292519943 56 #define DK_RAD2DEG 57.295779513082323 59 #define RDF_VERSION(major, minor, revision) (major << 16 | minor << 8 | revision) 60 #define RDF_OPENCV_VERSION RDF_VERSION(CV_MAJOR_VERSION, CV_MINOR_VERSION, CV_VERSION_REVISION) 67 #define WHO_IS_CUTE "Anna" 73 static Utils& instance();
75 void initFramework()
const;
76 void registerVersion()
const;
77 static int versionToInt(
char major,
char minor,
char revision);
82 static bool loadToBuffer(
const QString& filePath, QByteArray& ba);
83 static QString appDataPath();
84 static QString createFilePath(
const QString& filePath,
const QString& attribute,
const QString& newSuffix = QString());
85 static QString timeStampFileName(
const QString& attribute =
"",
const QString& suffix =
".txt");
86 static QString baseName(
const QString& filePath);
88 static QJsonObject readJson(
const QString& filePath);
89 static int64 writeJson(
const QString& filePath,
const QJsonObject& jo);
90 static void initDefaultFramework();
93 template<
typename num>
94 static num
clamp(num val, num min, num max) {
112 static QPolygon stringToPoly(
const QString& pointList);
113 static QString polyToString(
const QPolygon& poly);
115 static QPointF cvPointToQt(
const cv::Point& pt);
116 static cv::Point2d qPointToCv(
const QPointF& pt);
118 static QRectF cvRectToQt(
const cv::Rect& r);
119 static cv::Rect2d qRectToCv(
const QRectF& r);
140 QString getTotal()
const;
141 virtual QDataStream& put(QDataStream& s)
const;
142 QString stringifyTime(
int ct)
const;
165 template <
typename EnumType,
typename Underlying =
int>
167 typedef Underlying
Flags::* RestrictedBool;
189 return Flags(f1) |= f2;
193 return Flags(f1) &= f2;
202 operator RestrictedBool()
const {
Flags turns enums into typesave flags It is strongly related (copied) from Useage: enum mDrawFlags { ...
Definition: Utils.h:166
QDataStream & operator<<(QDataStream &s, const BaseElement &e)
Definition: BaseImageElement.cpp:81
Flags()
Definition: Utils.h:170
Flags(EnumType f)
Definition: Utils.h:172
QTime mTimer
Definition: Utils.h:147
static num clamp(num val, num min, num max)
Definition: Utils.h:94
Definition: Algorithms.cpp:45
#define DllCoreExport
Definition: Utils.h:50
Underlying value() const
Definition: Utils.h:206
Flags(const Flags &o)
Definition: Utils.h:175
Underlying mFlags
Definition: Utils.h:211