#define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, TEGRA_LOG_TAG, __VA_ARGS__))\r
*/\r
\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nCreateMat\r
- * Signature: ()J\r
- */\r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCreateMat__\r
- (JNIEnv *, jclass);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nCreateMat\r
- * Signature: (III)J\r
- */\r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCreateMat__III\r
- (JNIEnv *, jclass, jint, jint, jint);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nCreateMat\r
- * Signature: (IIIDDDD)J\r
- */\r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCreateMat__IIIDDDD\r
- (JNIEnv *, jclass, jint, jint, jint, jdouble, jdouble, jdouble, jdouble);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nDispose\r
- * Signature: (J)V\r
- */\r
-JNIEXPORT void JNICALL Java_org_opencv_Mat_nDispose\r
- (JNIEnv *, jclass, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nType\r
- * Signature: (J)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nType\r
- (JNIEnv *, jclass, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nRows\r
- * Signature: (J)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nRows\r
- (JNIEnv *, jclass, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nCols\r
- * Signature: (J)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nCols\r
- (JNIEnv *, jclass, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nData\r
- * Signature: (J)J\r
- */\r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nData\r
- (JNIEnv *, jclass, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nIsEmpty\r
- * Signature: (J)Z\r
- */\r
-JNIEXPORT jboolean JNICALL Java_org_opencv_Mat_nIsEmpty\r
- (JNIEnv *, jclass, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nIsCont\r
- * Signature: (J)Z\r
- */\r
-JNIEXPORT jboolean JNICALL Java_org_opencv_Mat_nIsCont\r
- (JNIEnv *, jclass, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nIsSubmat\r
- * Signature: (J)Z\r
- */\r
-JNIEXPORT jboolean JNICALL Java_org_opencv_Mat_nIsSubmat\r
- (JNIEnv *, jclass, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nSubmat\r
- * Signature: (JIIII)J\r
- */\r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nSubmat\r
- (JNIEnv *, jclass, jlong, jint, jint, jint, jint);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nClone\r
- * Signature: (J)J\r
- */\r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nClone\r
- (JNIEnv *, jclass, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nPutD\r
- * Signature: (JIII[D)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutD\r
- (JNIEnv *, jclass, jlong, jint, jint, jint, jdoubleArray);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nPutF\r
- * Signature: (JIII[F)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutF\r
- (JNIEnv *, jclass, jlong, jint, jint, jint, jfloatArray);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nPutI\r
- * Signature: (JIII[I)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutI\r
- (JNIEnv *, jclass, jlong, jint, jint, jint, jintArray);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nPutS\r
- * Signature: (JIII[S)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutS\r
- (JNIEnv *, jclass, jlong, jint, jint, jint, jshortArray);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nPutB\r
- * Signature: (JIII[B)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutB\r
- (JNIEnv *, jclass, jlong, jint, jint, jint, jbyteArray);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nGetB\r
- * Signature: (JIII[B)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetB\r
- (JNIEnv *, jclass, jlong, jint, jint, jint, jbyteArray);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nGetS\r
- * Signature: (JIII[S)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetS\r
- (JNIEnv *, jclass, jlong, jint, jint, jint, jshortArray);\r
\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nGetI\r
- * Signature: (JIII[I)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetI\r
- (JNIEnv *, jclass, jlong, jint, jint, jint, jintArray);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nGetF\r
- * Signature: (JIII[F)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetF\r
- (JNIEnv *, jclass, jlong, jint, jint, jint, jfloatArray);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nGetD\r
- * Signature: (JIII[D)I\r
- */\r
-JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetD\r
- (JNIEnv *, jclass, jlong, jint, jint, jint, jdoubleArray);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nSetTo\r
- * Signature: (JDDDD)V\r
- */\r
-JNIEXPORT void JNICALL Java_org_opencv_Mat_nSetTo\r
- (JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble, jdouble);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nCopyTo\r
- * Signature: (JJ)V\r
- */\r
-JNIEXPORT void JNICALL Java_org_opencv_Mat_nCopyTo\r
- (JNIEnv *, jclass, jlong, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nDot\r
- * Signature: (JJ)D\r
- */\r
-JNIEXPORT jdouble JNICALL Java_org_opencv_Mat_nDot\r
- (JNIEnv *, jclass, jlong, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nCross\r
- * Signature: (JJ)J\r
- */\r
-JNIEXPORT jlong JNICALL Java_org_opencv_Mat_nCross\r
- (JNIEnv *, jclass, jlong, jlong);\r
-\r
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nInv\r
- * Signature: (J)J\r
- */\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
-/*\r
- * Class: org_opencv_Mat\r
- * Method: nDump\r
- * Signature: (J)S\r
- */\r
-JNIEXPORT jstring JNICALL Java_org_opencv_Mat_nDump\r
- (JNIEnv *, jclass, jlong);\r
+#include "opencv2/core/core.hpp"\r
\r
#ifdef __cplusplus\r
-}\r
+extern "C" {\r
#endif\r
\r
-\r
-#include "opencv2/core/core.hpp"\r
-\r
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nType\r
(JNIEnv* env, jclass cls, jlong self)\r
{\r
}\r
\r
\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
template<typename T> static int mat_put(cv::Mat* m, int row, int col, int count, char* buff)\r
{\r
if(! m) return 0;\r
return res;\r
}\r
\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nPutB\r
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals)\r
{\r
}\r
\r
\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
\r
template<typename T> int mat_get(cv::Mat* m, int row, int col, int count, char* buff)\r
{\r
return res;\r
}\r
\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+\r
JNIEXPORT jint JNICALL Java_org_opencv_Mat_nGetB\r
(JNIEnv* env, jclass cls, jlong self, jint row, jint col, jint count, jbyteArray vals)\r
{\r
return (jlong) new cv::Mat( _rows, _cols, _type, cv::Scalar(v0, v1, v2, v3) );\r
}\r
\r
-JNIEXPORT void JNICALL Java_org_opencv_Mat_nDispose\r
+JNIEXPORT void JNICALL Java_org_opencv_Mat_nDelete\r
(JNIEnv* env, jclass cls, jlong self)\r
{\r
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
delete me;\r
}\r
\r
+JNIEXPORT void JNICALL Java_org_opencv_Mat_nRelease\r
+ (JNIEnv* env, jclass cls, jlong self)\r
+{\r
+ cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL\r
+ me->release();\r
+}\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
this( rows, cols, new CvType(depth, 1) );\r
}\r
\r
- public Mat(int rows, int cols, CvType type, double v0, double v1, double v2, double v3) {\r
- this( nCreateMat(rows, cols, type.toInt(), v0, v1, v2, v3) );\r
+ public Mat(int rows, int cols, CvType type, Scalar val) {\r
+ this( nCreateMat(rows, cols, type.toInt(), val.v0, val.v1, val.v2, val.v3) );\r
}\r
\r
- public Mat(int rows, int cols, CvType type, double v0, double v1, double v2) {\r
- this( nCreateMat(rows, cols, type.toInt(), v0, v1, v2, 0) );\r
- }\r
-\r
- public Mat(int rows, int cols, CvType type, double v0, double v1) {\r
- this( nCreateMat(rows, cols, type.toInt(), v0, v1, 0, 0) );\r
- }\r
-\r
- public Mat(int rows, int cols, CvType type, double v0) {\r
- this( nCreateMat(rows, cols, type.toInt(), v0, 0, 0, 0) );\r
+ public Mat(int rows, int cols, int depth, Scalar val) {\r
+ this( rows, cols, new CvType(depth, 1), val );\r
}\r
\r
public void dispose() {\r
- if(nativeObj != 0)\r
- nDispose(nativeObj);\r
- nativeObj = 0;\r
+ nRelease(nativeObj);\r
}\r
\r
@Override\r
protected void finalize() throws Throwable {\r
- dispose();\r
+ nDelete(nativeObj);\r
+ nativeObj = 0;\r
super.finalize();\r
}\r
\r
}\r
\r
\r
- public void setTo(double v0, double v1, double v2, double v3) {\r
+ public void setTo(Scalar val) {\r
checkNull();\r
- nSetTo(nativeObj, v0, v1, v2, v3);\r
+ nSetTo(nativeObj, val.v0, val.v1, val.v2, val.v3);\r
}\r
- public void setTo(double v0, double v1, double v2) { setTo(v0, v1, v2, 0); }\r
- public void setTo(double v0, double v1) { setTo(v0, v1, 0, 0); }\r
- public void setTo(double v0) { setTo(v0, 0, 0, 0); }\r
\r
public void copyTo(Mat m) {\r
checkNull();\r
private static native long nCreateMat();\r
private static native long nCreateMat(int rows, int cols, int type);\r
private static native long nCreateMat(int rows, int cols, int type, double v0, double v1, double v2, double v3);\r
- private static native void nDispose(long self);\r
+ private static native void nRelease(long self);\r
+ private static native void nDelete(long self);\r
private static native int nType(long self);\r
private static native int nRows(long self);\r
private static native int nCols(long self);\r