implemented static Mat.eye method

This commit is contained in:
Kirill Kornyakov 2011-07-01 13:11:03 +00:00
parent 837b733a0a
commit 7fed582d9f
2 changed files with 19 additions and 0 deletions

View File

@ -218,6 +218,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCross
*/
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nInv
(JNIEnv *, jclass, jlong);
/*
* Class: org_opencv_Mat
* Method: nEye
* Signature: (III)J
*/
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nEye
(JNIEnv *, jclass, jint, jint, jint);
#ifdef __cplusplus
}
@ -586,6 +594,12 @@ JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nInv
return 0; //NYI
}
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nEye
(JNIEnv* env, jclass cls, jint _rows, jint _cols, jint _type)
{
return (jlong) new cv::Mat(cv::Mat::eye( _rows, _cols, _type ));
}
JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCreateMat__III
(JNIEnv* env, jclass cls, jint _rows, jint _cols, jint _type)
{

View File

@ -383,6 +383,10 @@ public class Mat {
return nativeObj;
}
static public Mat eye(int rows, int cols, CvType type) {
return new Mat( nEye(rows, cols, type.toInt()) );
}
// native stuff
static { System.loadLibrary("opencv_java"); }
protected long nativeObj;
@ -414,5 +418,6 @@ public class Mat {
private static native double nDot(long self, long mat);
private static native long nCross(long self, long mat);
private static native long nInv(long self);
private static native long nEye(int rows, int cols, int type);
}