From 2505c33d5601886c2f19f7568df92c1395284eeb Mon Sep 17 00:00:00 2001 From: Samuel Audet Date: Tue, 2 Feb 2016 22:42:38 +0900 Subject: [PATCH] * Add a `Mat(CvArr arr)` constructor for convenience (issue bytedeco/javacv#317) --- CHANGELOG.md | 1 + opencv/src/main/java/org/bytedeco/javacpp/opencv_core.java | 1 + .../src/main/java/org/bytedeco/javacpp/presets/opencv_core.java | 1 + 3 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c3f66451ae..e7c81b6bc31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ + * Add a `Mat(CvArr arr)` constructor for convenience ([issue bytedeco/javacv#317](https://github.com/bytedeco/javacv/issues/317)) * Fix loading issue with `opencv_xfeatures2d` ([issue bytedeco/javacv#316](https://github.com/bytedeco/javacv/issues/316)) * Virtualize all `Solver` classes from Caffe ([issue #143](https://github.com/bytedeco/javacpp-presets/issues/143)) * Work around GSL not loading on Android ([issue bytedeco/javacpp#55](https://github.com/bytedeco/javacpp/issues/55)) diff --git a/opencv/src/main/java/org/bytedeco/javacpp/opencv_core.java b/opencv/src/main/java/org/bytedeco/javacpp/opencv_core.java index 06afc13471a..5da7200b9f0 100644 --- a/opencv/src/main/java/org/bytedeco/javacpp/opencv_core.java +++ b/opencv/src/main/java/org/bytedeco/javacpp/opencv_core.java @@ -14615,6 +14615,7 @@ the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no private native void allocate(int rows, int cols, int type, Pointer data, @Cast("size_t") long step/*=AUTO_STEP*/); private Pointer data; // a reference to prevent deallocation public Mat(int rows, int cols, int type, Pointer data) { this(rows, cols, type, data, AUTO_STEP); } + public Mat(CvArr arr) { super(cvarrToMat(arr)); this.data = arr; } public Mat(byte ... b) { this(b, false); } public Mat(byte[] b, boolean signed) { this(new BytePointer(b), signed); } public Mat(short ... s) { this(s, true); } diff --git a/opencv/src/main/java/org/bytedeco/javacpp/presets/opencv_core.java b/opencv/src/main/java/org/bytedeco/javacpp/presets/opencv_core.java index 489e6e62f3d..7f6cfb60b31 100644 --- a/opencv/src/main/java/org/bytedeco/javacpp/presets/opencv_core.java +++ b/opencv/src/main/java/org/bytedeco/javacpp/presets/opencv_core.java @@ -168,6 +168,7 @@ public void map(InfoMap infoMap) { + "private native void allocate(int rows, int cols, int type, Pointer data, @Cast(\"size_t\") long step/*=AUTO_STEP*/);\n" + "private Pointer data; // a reference to prevent deallocation\n" + "public Mat(int rows, int cols, int type, Pointer data) { this(rows, cols, type, data, AUTO_STEP); }\n" + + "public Mat(CvArr arr) { super(cvarrToMat(arr)); this.data = arr; }\n" + "public Mat(byte ... b) { this(b, false); }\n" + "public Mat(byte[] b, boolean signed) { this(new BytePointer(b), signed); }\n" + "public Mat(short ... s) { this(s, true); }\n"