37 #pragma warning(push, 0) // no warnings from includes 38 #include <QSharedPointer> 39 #include <opencv2/core.hpp> 42 #pragma warning (disable: 4251) // inlined Qt functions in dll interface 45 #ifdef DLL_CORE_EXPORT 46 #define DllCoreExport Q_DECL_EXPORT 48 #define DllCoreExport Q_DECL_IMPORT 68 static int doubleEqual(
double a,
double b);
69 static double absAngleDiff(
double a,
double b);
70 static double signedAngleDiff(
double a,
double b);
73 static double min(
const QVector<double>& vec);
74 static double max(
const QVector<double>& vec);
76 static double normAngleRad(
double angle,
double startIvl = 0.0,
double endIvl = 2.0*CV_PI);
77 static double angleDist(
double angle1,
double angle2,
double maxAngle = 2.0*CV_PI);
88 template <
typename numFmt>
89 static double statMoment(
const QList<numFmt>& valuesIn,
double momentValue,
bool interpolated =
true) {
92 if (valuesIn.size() == 1)
96 if (valuesIn.size() == 2 && interpolated) {
97 return (valuesIn[0] + valuesIn[1]) / 2.0;
99 else if (valuesIn.size() == 2)
102 QList<numFmt> values = valuesIn;
105 size_t lSize = values.size();
107 unsigned int momIdx = cvCeil(lSize*momentValue);
108 unsigned int idx = 1;
111 for (
auto val : values) {
120 if (lSize % 2 == 0 && momIdx < lSize && interpolated)
121 moment = ((double)val + values[idx+1])*0.5;
123 moment = (double)val;
140 Line fitLineLMS()
const;
141 Line fitLine()
const;
148 double mMinLength = 2;
152 void sample(
const QVector<Vector2D>& pts, QVector<Vector2D>&
set,
int setSize = 2)
const;
153 double medianResiduals(
const QVector<Vector2D>& pts,
const Line& line)
const;
157 namespace PixelDistance {
DllCoreExport double euclidean(const PixelEdge *edge)
Definition: Algorithms.cpp:454
#define DllCoreExport
Definition: BaseImageElement.h:43
DllCoreExport typedef double(* PixelDistanceFunction)(const Pixel *px1, const Pixel *px2)
Definition: Algorithms.h:163
DllCoreExport double angleWeighted(const Pixel *px1, const Pixel *px2)
Angle weighted pixel distance. If the pixel's local orientations are not computed, this method defaults to the euclidean distance.
Definition: Algorithms.cpp:365
DllCoreExport typedef double(* EdgeWeightFunction)(const PixelEdge *edge)
Definition: Algorithms.h:168
Contains basic algorithms to manipulate images.
Definition: Algorithms.h:64
DllCoreExport double bhattacharyya(const Pixel *px1, const Pixel *px2)
Definition: Algorithms.cpp:331
DllCoreExport double mahalanobis(const Pixel *px1, const Pixel *px2)
Definition: Algorithms.cpp:315
A basic line class including stroke width (thickness).
Definition: Shapes.h:68
This class represents a single instance of super pixels which are needed for the layout analysis...
Definition: Pixel.h:188
static double statMoment(const QList< numFmt > &valuesIn, double momentValue, bool interpolated=true)
Computes robust statistical moments (quantiles).
Definition: Algorithms.h:89
Definition: Algorithms.cpp:45
QVector< Vector2D > mPts
Definition: Algorithms.h:150
Implements robust line fitting algorithms.
Definition: Algorithms.h:135
DllCoreExport double spacingWeighted(const PixelEdge *edge)
Returns the edge weight normalized by the line spacing. This function returns an edge weight that is ...
Definition: Algorithms.cpp:391
DllCoreExport double orientationWeighted(const PixelEdge *edge)
Definition: Algorithms.cpp:422