implemented static Mat.eye method
authorKirill Kornyakov <no@email>
Fri, 1 Jul 2011 13:11:03 +0000 (13:11 +0000)
committerKirill Kornyakov <no@email>
Fri, 1 Jul 2011 13:11:03 +0000 (13:11 +0000)
modules/java/src/cpp/Mat.cpp
modules/java/src/java/Mat.java

index 5ef7f19..b39ca1e 100644 (file)
@@ -218,6 +218,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCross
  */\r
 JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nInv\r
   (JNIEnv *, jclass, jlong);\r
+  \r
+/*\r
+ * Class:     org_opencv_Mat\r
+ * Method:    nEye\r
+ * Signature: (III)J\r
+ */\r
+JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nEye\r
+  (JNIEnv *, jclass, jint, jint, jint);\r
 \r
 #ifdef __cplusplus\r
 }\r
@@ -586,6 +594,12 @@ JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nInv
        return 0; //NYI\r
 }\r
 \r
+JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nEye\r
+    (JNIEnv* env, jclass cls, jint _rows, jint _cols, jint _type)\r
+{\r
+    return (jlong) new cv::Mat(cv::Mat::eye( _rows, _cols, _type ));\r
+}\r
+\r
 JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCreateMat__III\r
   (JNIEnv* env, jclass cls, jint _rows, jint _cols, jint _type)\r
 {\r
index ac85b4a..0b02858 100644 (file)
@@ -383,6 +383,10 @@ public class Mat {
                return nativeObj;\r
        }\r
        \r
+    static public Mat eye(int rows, int cols, CvType type) {\r
+        return new Mat( nEye(rows, cols, type.toInt()) );\r
+    }\r
+       \r
        // native stuff\r
        static { System.loadLibrary("opencv_java"); }\r
        protected long nativeObj;\r
@@ -414,5 +418,6 @@ public class Mat {
        private static native double nDot(long self, long mat);\r
        private static native long nCross(long self, long mat);\r
        private static native long nInv(long self);\r
+    private static native long nEye(int rows, int cols, int type);\r
 \r
 }\r