Commit 38bc1dcbf7e16ce9f10e794e4eee8a68f5f7a0c9
1 parent
dfc6f1cf
Added PointsToMatrix function
Showing
2 changed files
with
12 additions
and
0 deletions
openbr/core/opencvutils.cpp
| @@ -121,6 +121,17 @@ Mat OpenCVUtils::toMat(const QList<float> &src, int rows) | @@ -121,6 +121,17 @@ Mat OpenCVUtils::toMat(const QList<float> &src, int rows) | ||
| 121 | return dst; | 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 | Mat OpenCVUtils::toMat(const QList<QList<float> > &srcs, int rows) | 135 | Mat OpenCVUtils::toMat(const QList<QList<float> > &srcs, int rows) |
| 125 | { | 136 | { |
| 126 | QList<float> flat; | 137 | QList<float> flat; |
openbr/core/opencvutils.h
| @@ -84,6 +84,7 @@ namespace OpenCVUtils | @@ -84,6 +84,7 @@ namespace OpenCVUtils | ||
| 84 | QPointF fromPoint(const cv::Point2f &cvPoint); | 84 | QPointF fromPoint(const cv::Point2f &cvPoint); |
| 85 | QList<cv::Point2f> toPoints(const QList<QPointF> &qPoints); | 85 | QList<cv::Point2f> toPoints(const QList<QPointF> &qPoints); |
| 86 | QList<QPointF> fromPoints(const QList<cv::Point2f> &cvPoints); | 86 | QList<QPointF> fromPoints(const QList<cv::Point2f> &cvPoints); |
| 87 | + cv::Mat pointsToMatrix(const QList<QPointF> &qPoints); | ||
| 87 | cv::Rect toRect(const QRectF &qRect); | 88 | cv::Rect toRect(const QRectF &qRect); |
| 88 | QRectF fromRect(const cv::Rect &cvRect); | 89 | QRectF fromRect(const cv::Rect &cvRect); |
| 89 | QList<cv::Rect> toRects(const QList<QRectF> &qRects); | 90 | QList<cv::Rect> toRects(const QList<QRectF> &qRects); |