Skip to content

Commit 0698277

Browse files
committed
added NewMatFromPoint2fVector function
1 parent f737aab commit 0698277

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

core.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ Mat Mat_NewWithSizesFromBytes(IntVector sizes, int type, struct ByteArray buf) {
5858
return new cv::Mat(_sizes, type, buf.data);
5959
}
6060

61+
Mat Mat_NewFromPoint2fVector(Point2fVector pfv, bool copy_data) {
62+
return new cv::Mat(*pfv, copy_data);
63+
}
64+
6165
Mat Eye(int rows, int cols, int type) {
6266
cv::Mat* mat = new cv::Mat(rows, cols, type);
6367
*mat = cv::Mat::eye(rows, cols, type);

core.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func NewMatWithSizesWithScalar(sizes []int, mt MatType, s Scalar) Mat {
250250
return newMat(C.Mat_NewWithSizesFromScalar(sizesVector, C.int(mt), sVal))
251251
}
252252

253-
// NewMatWithSizesWithScalar returns a new multidimensional Mat with a specific size, type and preexisting data.
253+
// NewMatWithSizesFromBytes returns a new multidimensional Mat with a specific size, type and preexisting data.
254254
func NewMatWithSizesFromBytes(sizes []int, mt MatType, data []byte) (Mat, error) {
255255
cBytes, err := toByteArray(data)
256256
if err != nil {
@@ -312,6 +312,12 @@ func NewMatFromBytes(rows int, cols int, mt MatType, data []byte) (Mat, error) {
312312
return mat, nil
313313
}
314314

315+
// NewMatFromPoint2fVector returns a new Mat from a gocv.Point2fVector.
316+
func NewMatFromPoint2fVector(pfv Point2fVector, copyData bool) Mat {
317+
mat := newMat(C.Mat_NewFromPoint2fVector(pfv.p, C.bool(copyData)))
318+
return mat
319+
}
320+
315321
// Returns an identity matrix of the specified size and type.
316322
//
317323
// The method returns a Matlab-style identity matrix initializer, similarly to Mat::zeros. Similarly to Mat::ones.

core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ Mat Mat_NewWithSizesFromBytes(IntVector sizes, int type, struct ByteArray buf);
306306
Mat Mat_NewFromScalar(const Scalar ar, int type);
307307
Mat Mat_NewWithSizeFromScalar(const Scalar ar, int rows, int cols, int type);
308308
Mat Mat_NewFromBytes(int rows, int cols, int type, struct ByteArray buf);
309+
Mat Mat_NewFromPoint2fVector(Point2fVector pfv, bool copy_data);
309310
Mat Mat_FromPtr(Mat m, int rows, int cols, int type, int prows, int pcols);
310311
void Mat_Close(Mat m);
311312
int Mat_Empty(Mat m);

0 commit comments

Comments
 (0)