Commit 38bc1dcbf7e16ce9f10e794e4eee8a68f5f7a0c9

Authored by Scott Klum
1 parent dfc6f1cf

Added PointsToMatrix function

openbr/core/opencvutils.cpp
... ... @@ -121,6 +121,17 @@ Mat OpenCVUtils::toMat(const QList<float> &src, int rows)
121 121 return dst;
122 122 }
123 123  
  124 +Mat OpenCVUtils::pointsToMatrix(const QList<QPointF> &qPoints)
  125 +{
  126 + QList<float> points;
  127 + foreach(const QPointF &point, qPoints) {
  128 + points.append(point.x());
  129 + points.append(point.y());
  130 + }
  131 +
  132 + return toMat(points);
  133 +}
  134 +
124 135 Mat OpenCVUtils::toMat(const QList<QList<float> > &srcs, int rows)
125 136 {
126 137 QList<float> flat;
... ...
openbr/core/opencvutils.h
... ... @@ -84,6 +84,7 @@ namespace OpenCVUtils
84 84 QPointF fromPoint(const cv::Point2f &cvPoint);
85 85 QList<cv::Point2f> toPoints(const QList<QPointF> &qPoints);
86 86 QList<QPointF> fromPoints(const QList<cv::Point2f> &cvPoints);
  87 + cv::Mat pointsToMatrix(const QList<QPointF> &qPoints);
87 88 cv::Rect toRect(const QRectF &qRect);
88 89 QRectF fromRect(const cv::Rect &cvRect);
89 90 QList<cv::Rect> toRects(const QList<QRectF> &qRects);
... ...