feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试 2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程 3.重整权利声明文件,重整代码工程,确保最小化侵权风险 Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
This commit is contained in:
4
3rdparty/opencv-4.5.4/modules/core/misc/java/filelist
vendored
Normal file
4
3rdparty/opencv-4.5.4/modules/core/misc/java/filelist
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
include/opencv2/core/base.hpp
|
||||
include/opencv2/core.hpp
|
||||
include/opencv2/core/utility.hpp
|
||||
misc/java/src/cpp/core_manual.hpp
|
907
3rdparty/opencv-4.5.4/modules/core/misc/java/gen_dict.json
vendored
Normal file
907
3rdparty/opencv-4.5.4/modules/core/misc/java/gen_dict.json
vendored
Normal file
@ -0,0 +1,907 @@
|
||||
{
|
||||
"module_imports": [ "java.lang.String" ],
|
||||
"module_j_code": "src/java/core+Core.jcode.in",
|
||||
"class_ignore_list" : [
|
||||
"FileNode",
|
||||
"FileStorage",
|
||||
"KDTree",
|
||||
"KeyPoint",
|
||||
"DMatch"
|
||||
],
|
||||
"missing_consts" : {
|
||||
"Core" : {
|
||||
"private" : [
|
||||
["CV_8U", 0 ], ["CV_8S", 1 ],
|
||||
["CV_16U", 2 ], ["CV_16S", 3 ],
|
||||
["CV_32S", 4 ],
|
||||
["CV_32F", 5 ], ["CV_64F", 6 ],
|
||||
["CV_USRTYPE1", 7 ]
|
||||
],
|
||||
"public" : [
|
||||
["SVD_MODIFY_A", 1], ["SVD_NO_UV", 2], ["SVD_FULL_UV", 4],
|
||||
["FILLED", -1],
|
||||
["REDUCE_SUM", 0], ["REDUCE_AVG", 1], ["REDUCE_MAX", 2], ["REDUCE_MIN", 3]
|
||||
]
|
||||
}
|
||||
},
|
||||
"ManualFuncs" : {
|
||||
"Core" : {
|
||||
"minMaxLoc" : {
|
||||
"j_code" : [
|
||||
"// manual port",
|
||||
"public static class MinMaxLocResult {",
|
||||
" public double minVal;",
|
||||
" public double maxVal;",
|
||||
" public Point minLoc;",
|
||||
" public Point maxLoc;",
|
||||
"\n",
|
||||
" public MinMaxLocResult() {",
|
||||
" minVal=0; maxVal=0;",
|
||||
" minLoc=new Point();",
|
||||
" maxLoc=new Point();",
|
||||
" }",
|
||||
"}",
|
||||
"\n",
|
||||
"// C++: minMaxLoc(Mat src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, InputArray mask=noArray())",
|
||||
"\n",
|
||||
"//javadoc: minMaxLoc(src, mask)",
|
||||
"public static MinMaxLocResult minMaxLoc(Mat src, Mat mask) {",
|
||||
" MinMaxLocResult res = new MinMaxLocResult();",
|
||||
" long maskNativeObj=0;",
|
||||
" if (mask != null) {",
|
||||
" maskNativeObj=mask.nativeObj;",
|
||||
" }",
|
||||
" double resarr[] = n_minMaxLocManual(src.nativeObj, maskNativeObj);",
|
||||
" res.minVal=resarr[0];",
|
||||
" res.maxVal=resarr[1];",
|
||||
" res.minLoc.x=resarr[2];",
|
||||
" res.minLoc.y=resarr[3];",
|
||||
" res.maxLoc.x=resarr[4];",
|
||||
" res.maxLoc.y=resarr[5];",
|
||||
" return res;",
|
||||
"}",
|
||||
"\n",
|
||||
"//javadoc: minMaxLoc(src)",
|
||||
"public static MinMaxLocResult minMaxLoc(Mat src) {",
|
||||
" return minMaxLoc(src, null);",
|
||||
"}"
|
||||
],
|
||||
"jn_code" : [
|
||||
"private static native double[] n_minMaxLocManual(long src_nativeObj, long mask_nativeObj);\n"
|
||||
],
|
||||
"cpp_code" : [
|
||||
"// C++: minMaxLoc(Mat src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, InputArray mask=noArray())",
|
||||
"JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual (JNIEnv*, jclass, jlong, jlong);",
|
||||
"\n",
|
||||
"JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Core_n_1minMaxLocManual",
|
||||
" (JNIEnv* env, jclass, jlong src_nativeObj, jlong mask_nativeObj)",
|
||||
"{",
|
||||
" try {",
|
||||
" LOGD(\"Core::n_1minMaxLoc()\");",
|
||||
" jdoubleArray result;",
|
||||
" result = env->NewDoubleArray(6);",
|
||||
" if (result == NULL) {",
|
||||
" return NULL; /* out of memory error thrown */",
|
||||
" }",
|
||||
"\n",
|
||||
" Mat& src = *((Mat*)src_nativeObj);",
|
||||
"\n",
|
||||
" double minVal, maxVal;",
|
||||
" Point minLoc, maxLoc;",
|
||||
" if (mask_nativeObj != 0) {",
|
||||
" Mat& mask = *((Mat*)mask_nativeObj);",
|
||||
" minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc, mask);",
|
||||
" } else {",
|
||||
" minMaxLoc(src, &minVal, &maxVal, &minLoc, &maxLoc);",
|
||||
" }",
|
||||
"\n",
|
||||
" jdouble fill[6];",
|
||||
" fill[0]=minVal;",
|
||||
" fill[1]=maxVal;",
|
||||
" fill[2]=minLoc.x;",
|
||||
" fill[3]=minLoc.y;",
|
||||
" fill[4]=maxLoc.x;",
|
||||
" fill[5]=maxLoc.y;",
|
||||
"\n",
|
||||
" env->SetDoubleArrayRegion(result, 0, 6, fill);",
|
||||
"\n",
|
||||
" return result;",
|
||||
"\n",
|
||||
" } catch(const cv::Exception& e) {",
|
||||
" LOGD(\"Core::n_1minMaxLoc() caught cv::Exception: %s\", e.what());",
|
||||
" jclass je = env->FindClass(\"org/opencv/core/CvException\");",
|
||||
" if(!je) je = env->FindClass(\"java/lang/Exception\");",
|
||||
" env->ThrowNew(je, e.what());",
|
||||
" return NULL;",
|
||||
" } catch (...) {",
|
||||
" LOGD(\"Core::n_1minMaxLoc() caught unknown exception (...)\");",
|
||||
" jclass je = env->FindClass(\"java/lang/Exception\");",
|
||||
" env->ThrowNew(je, \"Unknown exception in JNI code {core::minMaxLoc()}\");",
|
||||
" return NULL;",
|
||||
" }",
|
||||
"}",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
"checkHardwareSupport" : {"j_code" : [""], "jn_code" : [""], "cpp_code" : [""] },
|
||||
"setUseOptimized" : {"j_code" : [""], "jn_code" : [""], "cpp_code" : [""] },
|
||||
"useOptimized" : {"j_code" : [""], "jn_code" : [""], "cpp_code" : [""] }
|
||||
}
|
||||
},
|
||||
"func_arg_fix" : {
|
||||
"randu" : { "low" : {"ctype" : "double"},
|
||||
"high" : {"ctype" : "double"} },
|
||||
"randn" : { "mean" : {"ctype" : "double"},
|
||||
"stddev" : {"ctype" : "double"} },
|
||||
"inRange" : { "lowerb" : {"ctype" : "Scalar"},
|
||||
"upperb" : {"ctype" : "Scalar"} },
|
||||
"boundingRect" : { "points" : {"ctype" : "vector_Point"} },
|
||||
"hconcat" : { "src" : {"ctype" : "vector_Mat"} },
|
||||
"vconcat" : { "src" : {"ctype" : "vector_Mat"} },
|
||||
"checkRange" : {"pos" : {"ctype" : "*"} },
|
||||
"meanStdDev" : { "mean" : {"ctype" : "vector_double"},
|
||||
"stddev" : {"ctype" : "vector_double"} },
|
||||
"mixChannels" : { "dst" : {"attrib" : []} }
|
||||
},
|
||||
"type_dict" : {
|
||||
"Algorithm": {
|
||||
"j_type": "Feature2D",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "Feature2D %(n)s",
|
||||
"suffix": "J",
|
||||
"j_import": "org.opencv.core.Algorithm"
|
||||
},
|
||||
"CvSlice": {
|
||||
"j_type": "Range",
|
||||
"jn_args": [
|
||||
[
|
||||
"int",
|
||||
".start"
|
||||
],
|
||||
[
|
||||
"int",
|
||||
".end"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Range %(n)s(%(n)s_start, %(n)s_end)",
|
||||
"suffix": "II",
|
||||
"j_import": "org.opencv.core.Range"
|
||||
},
|
||||
"CvTermCriteria": {
|
||||
"j_type": "TermCriteria",
|
||||
"jn_args": [
|
||||
[
|
||||
"int",
|
||||
".type"
|
||||
],
|
||||
[
|
||||
"int",
|
||||
".maxCount"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".epsilon"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "TermCriteria %(n)s(%(n)s_type, %(n)s_maxCount, %(n)s_epsilon)",
|
||||
"suffix": "IID",
|
||||
"j_import": "org.opencv.core.TermCriteria"
|
||||
},
|
||||
"DMatch": {
|
||||
"j_type": "DMatch",
|
||||
"jn_args": [
|
||||
[
|
||||
"int",
|
||||
"queryIdx"
|
||||
],
|
||||
[
|
||||
"int",
|
||||
"trainIdx"
|
||||
],
|
||||
[
|
||||
"int",
|
||||
"imgIdx"
|
||||
],
|
||||
[
|
||||
"float",
|
||||
"distance"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "DMatch %(n)s(%(n)s_queryIdx, %(n)s_trainIdx, %(n)s_imgIdx, %(n)s_distance)",
|
||||
"suffix": "IIIF",
|
||||
"j_import": "org.opencv.core.DMatch"
|
||||
},
|
||||
"KeyPoint": {
|
||||
"j_type": "KeyPoint",
|
||||
"jn_args": [
|
||||
[
|
||||
"float",
|
||||
".x"
|
||||
],
|
||||
[
|
||||
"float",
|
||||
".y"
|
||||
],
|
||||
[
|
||||
"float",
|
||||
".size"
|
||||
],
|
||||
[
|
||||
"float",
|
||||
".angle"
|
||||
],
|
||||
[
|
||||
"float",
|
||||
".response"
|
||||
],
|
||||
[
|
||||
"int",
|
||||
".octave"
|
||||
],
|
||||
[
|
||||
"int",
|
||||
".class_id"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "KeyPoint %(n)s(%(n)s_x, %(n)s_y, %(n)s_size, %(n)s_angle, %(n)s_response, %(n)s_octave, %(n)s_class_id)",
|
||||
"suffix": "FFFFFII",
|
||||
"j_import": "org.opencv.core.KeyPoint"
|
||||
},
|
||||
"Mat": {
|
||||
"j_type": "Mat",
|
||||
"jn_args": [
|
||||
[
|
||||
"__int64",
|
||||
".nativeObj"
|
||||
]
|
||||
],
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "Mat& %(n)s = *((Mat*)%(n)s_nativeObj)",
|
||||
"suffix": "J",
|
||||
"j_import": "org.opencv.core.Mat"
|
||||
},
|
||||
"Moments": {
|
||||
"j_type": "Moments",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".m00"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".m10"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".m01"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".m20"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".m11"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".m02"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".m30"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".m21"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".m12"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".m03"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Moments %(n)s(%(n)s_m00, %(n)s_m10, %(n)s_m01, %(n)s_m20, %(n)s_m11, %(n)s_m02, %(n)s_m30, %(n)s_m21, %(n)s_m12, %(n)s_m03)",
|
||||
"suffix": "DDDDDDDDDD"
|
||||
},
|
||||
"Point": {
|
||||
"j_type": "Point",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".x"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".y"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Point %(n)s((int)%(n)s_x, (int)%(n)s_y)",
|
||||
"suffix": "DD",
|
||||
"j_import": "org.opencv.core.Point"
|
||||
},
|
||||
"Point2d": {
|
||||
"j_type": "Point",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".x"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".y"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Point2d %(n)s(%(n)s_x, %(n)s_y)",
|
||||
"suffix": "DD",
|
||||
"j_import": "org.opencv.core.Point"
|
||||
},
|
||||
"Point2f": {
|
||||
"j_type": "Point",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".x"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".y"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Point2f %(n)s((float)%(n)s_x, (float)%(n)s_y)",
|
||||
"suffix": "DD",
|
||||
"j_import": "org.opencv.core.Point"
|
||||
},
|
||||
"Point3d": {
|
||||
"j_type": "Point3",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".x"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".y"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".z"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Point3d %(n)s(%(n)s_x, %(n)s_y, %(n)s_z)",
|
||||
"suffix": "DDD",
|
||||
"j_import": "org.opencv.core.Point3"
|
||||
},
|
||||
"Point3f": {
|
||||
"j_type": "Point3",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".x"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".y"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".z"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Point3f %(n)s((float)%(n)s_x, (float)%(n)s_y, (float)%(n)s_z)",
|
||||
"suffix": "DDD",
|
||||
"j_import": "org.opencv.core.Point3"
|
||||
},
|
||||
"Point3i": {
|
||||
"j_type": "Point3",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".x"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".y"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".z"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Point3i %(n)s((int)%(n)s_x, (int)%(n)s_y, (int)%(n)s_z)",
|
||||
"suffix": "DDD",
|
||||
"j_import": "org.opencv.core.Point3"
|
||||
},
|
||||
"Range": {
|
||||
"j_type": "Range",
|
||||
"jn_args": [
|
||||
[
|
||||
"int",
|
||||
".start"
|
||||
],
|
||||
[
|
||||
"int",
|
||||
".end"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Range %(n)s(%(n)s_start, %(n)s_end)",
|
||||
"suffix": "II",
|
||||
"j_import": "org.opencv.core.Range"
|
||||
},
|
||||
"Rect": {
|
||||
"j_type": "Rect",
|
||||
"jn_args": [
|
||||
[
|
||||
"int",
|
||||
".x"
|
||||
],
|
||||
[
|
||||
"int",
|
||||
".y"
|
||||
],
|
||||
[
|
||||
"int",
|
||||
".width"
|
||||
],
|
||||
[
|
||||
"int",
|
||||
".height"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Rect %(n)s(%(n)s_x, %(n)s_y, %(n)s_width, %(n)s_height)",
|
||||
"suffix": "IIII",
|
||||
"j_import": "org.opencv.core.Rect"
|
||||
},
|
||||
"Rect2d": {
|
||||
"j_type": "Rect2d",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".x"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".y"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".width"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".height"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Rect %(n)s(%(n)s_x, %(n)s_y, %(n)s_width, %(n)s_height)",
|
||||
"suffix": "DDDD",
|
||||
"j_import": "org.opencv.core.Rect2d"
|
||||
},
|
||||
"RotatedRect": {
|
||||
"j_type": "RotatedRect",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".center.x"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".center.y"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".size.width"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".size.height"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".angle"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "RotatedRect %(n)s(cv::Point2f(%(n)s_center_x, %(n)s_center_y), cv::Size2f(%(n)s_size_width, %(n)s_size_height), %(n)s_angle)",
|
||||
"suffix": "DDDDD",
|
||||
"j_import": "org.opencv.core.RotatedRect"
|
||||
},
|
||||
"Scalar": {
|
||||
"j_type": "Scalar",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".val[0]"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".val[1]"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".val[2]"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".val[3]"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Scalar %(n)s(%(n)s_val0, %(n)s_val1, %(n)s_val2, %(n)s_val3)",
|
||||
"suffix": "DDDD",
|
||||
"j_import": "org.opencv.core.Scalar"
|
||||
},
|
||||
"Size": {
|
||||
"j_type": "Size",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".width"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".height"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Size %(n)s((int)%(n)s_width, (int)%(n)s_height)",
|
||||
"suffix": "DD",
|
||||
"j_import": "org.opencv.core.Size"
|
||||
},
|
||||
"Size2f": {
|
||||
"j_type": "Size",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".width"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".height"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Size2f %(n)s((float)%(n)s_width, (float)%(n)s_height)",
|
||||
"suffix": "DD",
|
||||
"j_import": "org.opencv.core.Size"
|
||||
},
|
||||
"String": {
|
||||
"j_type": "String",
|
||||
"jn_type": "String",
|
||||
"jni_name": "n_%(n)s",
|
||||
"jni_type": "jstring",
|
||||
"jni_var": "const char* utf_%(n)s = env->GetStringUTFChars(%(n)s, 0); String n_%(n)s( utf_%(n)s ? utf_%(n)s : \"\" ); env->ReleaseStringUTFChars(%(n)s, utf_%(n)s)",
|
||||
"suffix": "Ljava_lang_String_2",
|
||||
"j_import": "java.lang.String"
|
||||
},
|
||||
"TermCriteria": {
|
||||
"j_type": "TermCriteria",
|
||||
"jn_args": [
|
||||
[
|
||||
"int",
|
||||
".type"
|
||||
],
|
||||
[
|
||||
"int",
|
||||
".maxCount"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".epsilon"
|
||||
]
|
||||
],
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "TermCriteria %(n)s(%(n)s_type, %(n)s_maxCount, %(n)s_epsilon)",
|
||||
"suffix": "IID",
|
||||
"j_import": "org.opencv.core.TermCriteria"
|
||||
},
|
||||
"Vec2d": {
|
||||
"j_type": "double[]",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".val[0]"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".val[1]"
|
||||
]
|
||||
],
|
||||
"jn_type": "double[]",
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Vec2d %(n)s(%(n)s_val0, %(n)s_val1)",
|
||||
"suffix": "DD"
|
||||
},
|
||||
"Vec3d": {
|
||||
"j_type": "double[]",
|
||||
"jn_args": [
|
||||
[
|
||||
"double",
|
||||
".val[0]"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".val[1]"
|
||||
],
|
||||
[
|
||||
"double",
|
||||
".val[2]"
|
||||
]
|
||||
],
|
||||
"jn_type": "double[]",
|
||||
"jni_type": "jdoubleArray",
|
||||
"jni_var": "Vec3d %(n)s(%(n)s_val0, %(n)s_val1, %(n)s_val2)",
|
||||
"suffix": "DDD"
|
||||
},
|
||||
"c_string": {
|
||||
"j_type": "String",
|
||||
"jn_type": "String",
|
||||
"jni_name": "n_%(n)s.c_str()",
|
||||
"jni_type": "jstring",
|
||||
"jni_var": "const char* utf_%(n)s = env->GetStringUTFChars(%(n)s, 0); String n_%(n)s( utf_%(n)s ? utf_%(n)s : \"\" ); env->ReleaseStringUTFChars(%(n)s, utf_%(n)s)",
|
||||
"suffix": "Ljava_lang_String_2",
|
||||
"j_import": "java.lang.String"
|
||||
},
|
||||
"size_t": {
|
||||
"j_type": "long",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"suffix": "J"
|
||||
},
|
||||
"vector_DMatch": {
|
||||
"j_type": "MatOfDMatch",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<DMatch> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfDMatch"
|
||||
},
|
||||
"vector_KeyPoint": {
|
||||
"j_type": "MatOfKeyPoint",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<KeyPoint> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfKeyPoint"
|
||||
},
|
||||
"vector_Mat": {
|
||||
"j_type": "List<Mat>",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Mat> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.Mat"
|
||||
},
|
||||
"vector_Point": {
|
||||
"j_type": "MatOfPoint",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Point> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfPoint"
|
||||
},
|
||||
"vector_Point2f": {
|
||||
"j_type": "MatOfPoint2f",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Point2f> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfPoint2f"
|
||||
},
|
||||
"vector_Point3f": {
|
||||
"j_type": "MatOfPoint3f",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Point3f> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfPoint3f"
|
||||
},
|
||||
"vector_Point2d": {
|
||||
"j_type": "MatOfPoint2f",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Point2f> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfPoint2f"
|
||||
},
|
||||
"vector_Point3d": {
|
||||
"j_type": "MatOfPoint3f",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Point3f> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfPoint3f"
|
||||
},
|
||||
"vector_Point3i": {
|
||||
"j_type": "MatOfPoint3",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Point3i> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfPoint3"
|
||||
},
|
||||
"vector_Rect": {
|
||||
"j_type": "MatOfRect",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Rect> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfRect"
|
||||
},
|
||||
"vector_Rect2d": {
|
||||
"j_type": "MatOfRect2d",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Rect2d> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfRect2d"
|
||||
},
|
||||
"vector_RotatedRect": {
|
||||
"j_type": "MatOfRotatedRect",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector< RotatedRect > %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfRotatedRect"
|
||||
},
|
||||
"vector_String": {
|
||||
"j_type": "List<String>",
|
||||
"jn_type": "List<String>",
|
||||
"jni_type": "jobject",
|
||||
"jni_var": "std::vector< String > %(n)s",
|
||||
"suffix": "Ljava_util_List",
|
||||
"v_type": "String",
|
||||
"j_import": "java.lang.String"
|
||||
},
|
||||
"vector_Vec4f": {
|
||||
"j_type": "MatOfFloat4",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Vec4f> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfFloat4"
|
||||
},
|
||||
"vector_Vec4i": {
|
||||
"j_type": "MatOfInt4",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Vec4i> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfInt4"
|
||||
},
|
||||
"vector_Vec6f": {
|
||||
"j_type": "MatOfFloat6",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<Vec6f> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfFloat6"
|
||||
},
|
||||
"vector_char": {
|
||||
"j_type": "MatOfByte",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<char> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfByte"
|
||||
},
|
||||
"vector_double": {
|
||||
"j_type": "MatOfDouble",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<double> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfDouble"
|
||||
},
|
||||
"vector_float": {
|
||||
"j_type": "MatOfFloat",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<float> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfFloat"
|
||||
},
|
||||
"vector_int": {
|
||||
"j_type": "MatOfInt",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<int> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfInt"
|
||||
},
|
||||
"vector_uchar": {
|
||||
"j_type": "MatOfByte",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector<uchar> %(n)s",
|
||||
"suffix": "J",
|
||||
"v_type": "Mat",
|
||||
"j_import": "org.opencv.core.MatOfByte"
|
||||
},
|
||||
"vector_vector_DMatch": {
|
||||
"j_type": "List<MatOfDMatch>",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector< std::vector<DMatch> > %(n)s",
|
||||
"v_type": "vector_Mat",
|
||||
"j_import": "org.opencv.core.MatOfDMatch"
|
||||
},
|
||||
"vector_vector_KeyPoint": {
|
||||
"j_type": "List<MatOfKeyPoint>",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector< std::vector<KeyPoint> > %(n)s",
|
||||
"v_type": "vector_Mat",
|
||||
"j_import": "org.opencv.core.MatOfKeyPoint"
|
||||
},
|
||||
"vector_vector_Point": {
|
||||
"j_type": "List<MatOfPoint>",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector< std::vector<Point> > %(n)s",
|
||||
"v_type": "vector_Mat",
|
||||
"j_import": "org.opencv.core.MatOfPoint"
|
||||
},
|
||||
"vector_vector_Point2f": {
|
||||
"j_type": "List<MatOfPoint2f>",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector< std::vector<Point2f> > %(n)s",
|
||||
"v_type": "vector_Mat",
|
||||
"j_import": "org.opencv.core.MatOfPoint2f"
|
||||
},
|
||||
"vector_vector_Point3f": {
|
||||
"j_type": "List<MatOfPoint3f>",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector< std::vector<Point3f> > %(n)s",
|
||||
"v_type": "vector_Mat",
|
||||
"j_import": "org.opencv.core.MatOfPoint3f"
|
||||
},
|
||||
"vector_vector_char": {
|
||||
"j_type": "List<MatOfByte>",
|
||||
"jn_type": "long",
|
||||
"jni_type": "jlong",
|
||||
"jni_var": "std::vector< std::vector<char> > %(n)s",
|
||||
"v_type": "vector_Mat",
|
||||
"j_import": "org.opencv.core.MatOfByte"
|
||||
}
|
||||
}
|
||||
}
|
21
3rdparty/opencv-4.5.4/modules/core/misc/java/src/cpp/core_manual.cpp
vendored
Normal file
21
3rdparty/opencv-4.5.4/modules/core/misc/java/src/cpp/core_manual.cpp
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
#define LOG_TAG "org.opencv.core.Core"
|
||||
#include "common.h"
|
||||
#include "core_manual.hpp"
|
||||
#include "opencv2/core/utility.hpp"
|
||||
|
||||
static int quietCallback( int, const char*, const char*, const char*, int, void* )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace cv {
|
||||
|
||||
void setErrorVerbosity(bool verbose)
|
||||
{
|
||||
if(verbose)
|
||||
cv::redirectError(0);
|
||||
else
|
||||
cv::redirectError((cv::ErrorCallback)quietCallback);
|
||||
}
|
||||
|
||||
}
|
33
3rdparty/opencv-4.5.4/modules/core/misc/java/src/cpp/core_manual.hpp
vendored
Normal file
33
3rdparty/opencv-4.5.4/modules/core/misc/java/src/cpp/core_manual.hpp
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "opencv2/core.hpp"
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
CV_EXPORTS_W void setErrorVerbosity(bool verbose);
|
||||
|
||||
}
|
||||
|
||||
#ifdef OPENCV_BINDINGS_PARSER
|
||||
|
||||
namespace cv
|
||||
{
|
||||
CV_EXPORTS_W void add(InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), int dtype=-1);
|
||||
|
||||
CV_EXPORTS_W void subtract(InputArray src1, Scalar src2, OutputArray dst, InputArray mask=noArray(), int dtype=-1);
|
||||
|
||||
CV_EXPORTS_W void multiply(InputArray src1, Scalar src2, OutputArray dst, double scale=1, int dtype=-1);
|
||||
|
||||
CV_EXPORTS_W void divide(InputArray src1, Scalar src2, OutputArray dst, double scale=1, int dtype=-1);
|
||||
|
||||
CV_EXPORTS_W void absdiff(InputArray src1, Scalar src2, OutputArray dst);
|
||||
|
||||
CV_EXPORTS_W void compare(InputArray src1, Scalar src2, OutputArray dst, int cmpop);
|
||||
|
||||
CV_EXPORTS_W void min(InputArray src1, Scalar src2, OutputArray dst);
|
||||
|
||||
CV_EXPORTS_W void max(InputArray src1, Scalar src2, OutputArray dst);
|
||||
|
||||
}
|
||||
#endif
|
14
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Core.jcode.in
vendored
Normal file
14
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Core.jcode.in
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// these constants are wrapped inside functions to prevent inlining
|
||||
private static String getVersion() { return "@OPENCV_VERSION@"; }
|
||||
private static String getNativeLibraryName() { return "opencv_java@OPENCV_VERSION_MAJOR@@OPENCV_VERSION_MINOR@@OPENCV_VERSION_PATCH@"; }
|
||||
private static int getVersionMajorJ() { return @OPENCV_VERSION_MAJOR@; }
|
||||
private static int getVersionMinorJ() { return @OPENCV_VERSION_MINOR@; }
|
||||
private static int getVersionRevisionJ() { return @OPENCV_VERSION_PATCH@; }
|
||||
private static String getVersionStatusJ() { return "@OPENCV_VERSION_STATUS@"; }
|
||||
|
||||
public static final String VERSION = getVersion();
|
||||
public static final String NATIVE_LIBRARY_NAME = getNativeLibraryName();
|
||||
public static final int VERSION_MAJOR = getVersionMajorJ();
|
||||
public static final int VERSION_MINOR = getVersionMinorJ();
|
||||
public static final int VERSION_REVISION = getVersionRevisionJ();
|
||||
public static final String VERSION_STATUS = getVersionStatusJ();
|
15
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+CvException.java
vendored
Normal file
15
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+CvException.java
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
package org.opencv.core;
|
||||
|
||||
public class CvException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CvException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CvException [" + super.toString() + "]";
|
||||
}
|
||||
}
|
150
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+CvType.java
vendored
Normal file
150
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+CvType.java
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
package org.opencv.core;
|
||||
|
||||
public final class CvType {
|
||||
|
||||
// type depth constants
|
||||
public static final int
|
||||
CV_8U = 0,
|
||||
CV_8S = 1,
|
||||
CV_16U = 2,
|
||||
CV_16S = 3,
|
||||
CV_32S = 4,
|
||||
CV_32F = 5,
|
||||
CV_64F = 6,
|
||||
CV_16F = 7;
|
||||
|
||||
/**
|
||||
* @deprecated please use {@link #CV_16F}
|
||||
*/
|
||||
@Deprecated
|
||||
public static final int CV_USRTYPE1 = CV_16F;
|
||||
|
||||
// predefined type constants
|
||||
public static final int
|
||||
CV_8UC1 = CV_8UC(1), CV_8UC2 = CV_8UC(2), CV_8UC3 = CV_8UC(3), CV_8UC4 = CV_8UC(4),
|
||||
CV_8SC1 = CV_8SC(1), CV_8SC2 = CV_8SC(2), CV_8SC3 = CV_8SC(3), CV_8SC4 = CV_8SC(4),
|
||||
CV_16UC1 = CV_16UC(1), CV_16UC2 = CV_16UC(2), CV_16UC3 = CV_16UC(3), CV_16UC4 = CV_16UC(4),
|
||||
CV_16SC1 = CV_16SC(1), CV_16SC2 = CV_16SC(2), CV_16SC3 = CV_16SC(3), CV_16SC4 = CV_16SC(4),
|
||||
CV_32SC1 = CV_32SC(1), CV_32SC2 = CV_32SC(2), CV_32SC3 = CV_32SC(3), CV_32SC4 = CV_32SC(4),
|
||||
CV_32FC1 = CV_32FC(1), CV_32FC2 = CV_32FC(2), CV_32FC3 = CV_32FC(3), CV_32FC4 = CV_32FC(4),
|
||||
CV_64FC1 = CV_64FC(1), CV_64FC2 = CV_64FC(2), CV_64FC3 = CV_64FC(3), CV_64FC4 = CV_64FC(4),
|
||||
CV_16FC1 = CV_16FC(1), CV_16FC2 = CV_16FC(2), CV_16FC3 = CV_16FC(3), CV_16FC4 = CV_16FC(4);
|
||||
|
||||
private static final int CV_CN_MAX = 512, CV_CN_SHIFT = 3, CV_DEPTH_MAX = (1 << CV_CN_SHIFT);
|
||||
|
||||
public static final int makeType(int depth, int channels) {
|
||||
if (channels <= 0 || channels >= CV_CN_MAX) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Channels count should be 1.." + (CV_CN_MAX - 1));
|
||||
}
|
||||
if (depth < 0 || depth >= CV_DEPTH_MAX) {
|
||||
throw new UnsupportedOperationException(
|
||||
"Data type depth should be 0.." + (CV_DEPTH_MAX - 1));
|
||||
}
|
||||
return (depth & (CV_DEPTH_MAX - 1)) + ((channels - 1) << CV_CN_SHIFT);
|
||||
}
|
||||
|
||||
public static final int CV_8UC(int ch) {
|
||||
return makeType(CV_8U, ch);
|
||||
}
|
||||
|
||||
public static final int CV_8SC(int ch) {
|
||||
return makeType(CV_8S, ch);
|
||||
}
|
||||
|
||||
public static final int CV_16UC(int ch) {
|
||||
return makeType(CV_16U, ch);
|
||||
}
|
||||
|
||||
public static final int CV_16SC(int ch) {
|
||||
return makeType(CV_16S, ch);
|
||||
}
|
||||
|
||||
public static final int CV_32SC(int ch) {
|
||||
return makeType(CV_32S, ch);
|
||||
}
|
||||
|
||||
public static final int CV_32FC(int ch) {
|
||||
return makeType(CV_32F, ch);
|
||||
}
|
||||
|
||||
public static final int CV_64FC(int ch) {
|
||||
return makeType(CV_64F, ch);
|
||||
}
|
||||
|
||||
public static final int CV_16FC(int ch) {
|
||||
return makeType(CV_16F, ch);
|
||||
}
|
||||
|
||||
public static final int channels(int type) {
|
||||
return (type >> CV_CN_SHIFT) + 1;
|
||||
}
|
||||
|
||||
public static final int depth(int type) {
|
||||
return type & (CV_DEPTH_MAX - 1);
|
||||
}
|
||||
|
||||
public static final boolean isInteger(int type) {
|
||||
return depth(type) < CV_32F;
|
||||
}
|
||||
|
||||
public static final int ELEM_SIZE(int type) {
|
||||
switch (depth(type)) {
|
||||
case CV_8U:
|
||||
case CV_8S:
|
||||
return channels(type);
|
||||
case CV_16U:
|
||||
case CV_16S:
|
||||
case CV_16F:
|
||||
return 2 * channels(type);
|
||||
case CV_32S:
|
||||
case CV_32F:
|
||||
return 4 * channels(type);
|
||||
case CV_64F:
|
||||
return 8 * channels(type);
|
||||
default:
|
||||
throw new UnsupportedOperationException(
|
||||
"Unsupported CvType value: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
public static final String typeToString(int type) {
|
||||
String s;
|
||||
switch (depth(type)) {
|
||||
case CV_8U:
|
||||
s = "CV_8U";
|
||||
break;
|
||||
case CV_8S:
|
||||
s = "CV_8S";
|
||||
break;
|
||||
case CV_16U:
|
||||
s = "CV_16U";
|
||||
break;
|
||||
case CV_16S:
|
||||
s = "CV_16S";
|
||||
break;
|
||||
case CV_32S:
|
||||
s = "CV_32S";
|
||||
break;
|
||||
case CV_32F:
|
||||
s = "CV_32F";
|
||||
break;
|
||||
case CV_64F:
|
||||
s = "CV_64F";
|
||||
break;
|
||||
case CV_16F:
|
||||
s = "CV_16F";
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException(
|
||||
"Unsupported CvType value: " + type);
|
||||
}
|
||||
|
||||
int ch = channels(type);
|
||||
if (ch <= 4)
|
||||
return s + "C" + ch;
|
||||
else
|
||||
return s + "C(" + ch + ")";
|
||||
}
|
||||
|
||||
}
|
58
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+DMatch.java
vendored
Normal file
58
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+DMatch.java
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
package org.opencv.core;
|
||||
|
||||
//C++: class DMatch
|
||||
|
||||
/**
|
||||
* Structure for matching: query descriptor index, train descriptor index, train
|
||||
* image index and distance between descriptors.
|
||||
*/
|
||||
public class DMatch {
|
||||
|
||||
/**
|
||||
* Query descriptor index.
|
||||
*/
|
||||
public int queryIdx;
|
||||
/**
|
||||
* Train descriptor index.
|
||||
*/
|
||||
public int trainIdx;
|
||||
/**
|
||||
* Train image index.
|
||||
*/
|
||||
public int imgIdx;
|
||||
|
||||
// javadoc: DMatch::distance
|
||||
public float distance;
|
||||
|
||||
// javadoc: DMatch::DMatch()
|
||||
public DMatch() {
|
||||
this(-1, -1, Float.MAX_VALUE);
|
||||
}
|
||||
|
||||
// javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _distance)
|
||||
public DMatch(int _queryIdx, int _trainIdx, float _distance) {
|
||||
queryIdx = _queryIdx;
|
||||
trainIdx = _trainIdx;
|
||||
imgIdx = -1;
|
||||
distance = _distance;
|
||||
}
|
||||
|
||||
// javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _imgIdx, _distance)
|
||||
public DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance) {
|
||||
queryIdx = _queryIdx;
|
||||
trainIdx = _trainIdx;
|
||||
imgIdx = _imgIdx;
|
||||
distance = _distance;
|
||||
}
|
||||
|
||||
public boolean lessThan(DMatch it) {
|
||||
return distance < it.distance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DMatch [queryIdx=" + queryIdx + ", trainIdx=" + trainIdx
|
||||
+ ", imgIdx=" + imgIdx + ", distance=" + distance + "]";
|
||||
}
|
||||
|
||||
}
|
77
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+KeyPoint.java
vendored
Normal file
77
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+KeyPoint.java
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import org.opencv.core.Point;
|
||||
|
||||
//javadoc: KeyPoint
|
||||
public class KeyPoint {
|
||||
|
||||
/**
|
||||
* Coordinates of the keypoint.
|
||||
*/
|
||||
public Point pt;
|
||||
/**
|
||||
* Diameter of the useful keypoint adjacent area.
|
||||
*/
|
||||
public float size;
|
||||
/**
|
||||
* Computed orientation of the keypoint (-1 if not applicable).
|
||||
*/
|
||||
public float angle;
|
||||
/**
|
||||
* The response, by which the strongest keypoints have been selected. Can
|
||||
* be used for further sorting or subsampling.
|
||||
*/
|
||||
public float response;
|
||||
/**
|
||||
* Octave (pyramid layer), from which the keypoint has been extracted.
|
||||
*/
|
||||
public int octave;
|
||||
/**
|
||||
* Object ID, that can be used to cluster keypoints by an object they
|
||||
* belong to.
|
||||
*/
|
||||
public int class_id;
|
||||
|
||||
// javadoc:KeyPoint::KeyPoint(x,y,_size,_angle,_response,_octave,_class_id)
|
||||
public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id) {
|
||||
pt = new Point(x, y);
|
||||
size = _size;
|
||||
angle = _angle;
|
||||
response = _response;
|
||||
octave = _octave;
|
||||
class_id = _class_id;
|
||||
}
|
||||
|
||||
// javadoc: KeyPoint::KeyPoint()
|
||||
public KeyPoint() {
|
||||
this(0, 0, 0, -1, 0, 0, -1);
|
||||
}
|
||||
|
||||
// javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response, _octave)
|
||||
public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave) {
|
||||
this(x, y, _size, _angle, _response, _octave, -1);
|
||||
}
|
||||
|
||||
// javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response)
|
||||
public KeyPoint(float x, float y, float _size, float _angle, float _response) {
|
||||
this(x, y, _size, _angle, _response, 0, -1);
|
||||
}
|
||||
|
||||
// javadoc: KeyPoint::KeyPoint(x, y, _size, _angle)
|
||||
public KeyPoint(float x, float y, float _size, float _angle) {
|
||||
this(x, y, _size, _angle, 0, 0, -1);
|
||||
}
|
||||
|
||||
// javadoc: KeyPoint::KeyPoint(x, y, _size)
|
||||
public KeyPoint(float x, float y, float _size) {
|
||||
this(x, y, _size, -1, 0, 0, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KeyPoint [pt=" + pt + ", size=" + size + ", angle=" + angle
|
||||
+ ", response=" + response + ", octave=" + octave
|
||||
+ ", class_id=" + class_id + "]";
|
||||
}
|
||||
|
||||
}
|
1886
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Mat.java
vendored
Normal file
1886
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Mat.java
vendored
Normal file
File diff suppressed because it is too large
Load Diff
160
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatAt.kt
vendored
Normal file
160
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatAt.kt
vendored
Normal file
@ -0,0 +1,160 @@
|
||||
package org.opencv.core
|
||||
|
||||
import org.opencv.core.Mat.*
|
||||
import java.lang.RuntimeException
|
||||
|
||||
fun Mat.get(row: Int, col: Int, data: UByteArray) = this.get(row, col, data.asByteArray())
|
||||
fun Mat.get(indices: IntArray, data: UByteArray) = this.get(indices, data.asByteArray())
|
||||
fun Mat.put(row: Int, col: Int, data: UByteArray) = this.put(row, col, data.asByteArray())
|
||||
fun Mat.put(indices: IntArray, data: UByteArray) = this.put(indices, data.asByteArray())
|
||||
|
||||
fun Mat.get(row: Int, col: Int, data: UShortArray) = this.get(row, col, data.asShortArray())
|
||||
fun Mat.get(indices: IntArray, data: UShortArray) = this.get(indices, data.asShortArray())
|
||||
fun Mat.put(row: Int, col: Int, data: UShortArray) = this.put(row, col, data.asShortArray())
|
||||
fun Mat.put(indices: IntArray, data: UShortArray) = this.put(indices, data.asShortArray())
|
||||
|
||||
/***
|
||||
* Example use:
|
||||
*
|
||||
* val (b, g, r) = mat.at<UByte>(50, 50).v3c
|
||||
* mat.at<UByte>(50, 50).val = T3(245u, 113u, 34u)
|
||||
*
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
inline fun <reified T> Mat.at(row: Int, col: Int) : Atable<T> =
|
||||
when (T::class) {
|
||||
Byte::class, Double::class, Float::class, Int::class, Short::class -> this.at(
|
||||
T::class.java,
|
||||
row,
|
||||
col
|
||||
)
|
||||
UByte::class -> AtableUByte(this, row, col) as Atable<T>
|
||||
UShort::class -> AtableUShort(this, row, col) as Atable<T>
|
||||
else -> throw RuntimeException("Unsupported class type")
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
inline fun <reified T> Mat.at(idx: IntArray) : Atable<T> =
|
||||
when (T::class) {
|
||||
Byte::class, Double::class, Float::class, Int::class, Short::class -> this.at(
|
||||
T::class.java,
|
||||
idx
|
||||
)
|
||||
UByte::class -> AtableUByte(this, idx) as Atable<T>
|
||||
UShort::class -> AtableUShort(this, idx) as Atable<T>
|
||||
else -> throw RuntimeException("Unsupported class type")
|
||||
}
|
||||
|
||||
class AtableUByte(val mat: Mat, val indices: IntArray): Atable<UByte> {
|
||||
|
||||
constructor(mat: Mat, row: Int, col: Int) : this(mat, intArrayOf(row, col))
|
||||
|
||||
override fun getV(): UByte {
|
||||
val data = UByteArray(1)
|
||||
mat.get(indices, data)
|
||||
return data[0]
|
||||
}
|
||||
|
||||
override fun setV(v: UByte) {
|
||||
val data = ubyteArrayOf(v)
|
||||
mat.put(indices, data)
|
||||
}
|
||||
|
||||
override fun getV2c(): Tuple2<UByte> {
|
||||
val data = UByteArray(2)
|
||||
mat.get(indices, data)
|
||||
return Tuple2(data[0], data[1])
|
||||
}
|
||||
|
||||
override fun setV2c(v: Tuple2<UByte>) {
|
||||
val data = ubyteArrayOf(v._0, v._1)
|
||||
mat.put(indices, data)
|
||||
}
|
||||
|
||||
override fun getV3c(): Tuple3<UByte> {
|
||||
val data = UByteArray(3)
|
||||
mat.get(indices, data)
|
||||
return Tuple3(data[0], data[1], data[2])
|
||||
}
|
||||
|
||||
override fun setV3c(v: Tuple3<UByte>) {
|
||||
val data = ubyteArrayOf(v._0, v._1, v._2)
|
||||
mat.put(indices, data)
|
||||
}
|
||||
|
||||
override fun getV4c(): Tuple4<UByte> {
|
||||
val data = UByteArray(4)
|
||||
mat.get(indices, data)
|
||||
return Tuple4(data[0], data[1], data[2], data[3])
|
||||
}
|
||||
|
||||
override fun setV4c(v: Tuple4<UByte>) {
|
||||
val data = ubyteArrayOf(v._0, v._1, v._2, v._3)
|
||||
mat.put(indices, data)
|
||||
}
|
||||
}
|
||||
|
||||
class AtableUShort(val mat: Mat, val indices: IntArray): Atable<UShort> {
|
||||
|
||||
constructor(mat: Mat, row: Int, col: Int) : this(mat, intArrayOf(row, col))
|
||||
|
||||
override fun getV(): UShort {
|
||||
val data = UShortArray(1)
|
||||
mat.get(indices, data)
|
||||
return data[0]
|
||||
}
|
||||
|
||||
override fun setV(v: UShort) {
|
||||
val data = ushortArrayOf(v)
|
||||
mat.put(indices, data)
|
||||
}
|
||||
|
||||
override fun getV2c(): Tuple2<UShort> {
|
||||
val data = UShortArray(2)
|
||||
mat.get(indices, data)
|
||||
return Tuple2(data[0], data[1])
|
||||
}
|
||||
|
||||
override fun setV2c(v: Tuple2<UShort>) {
|
||||
val data = ushortArrayOf(v._0, v._1)
|
||||
mat.put(indices, data)
|
||||
}
|
||||
|
||||
override fun getV3c(): Tuple3<UShort> {
|
||||
val data = UShortArray(3)
|
||||
mat.get(indices, data)
|
||||
return Tuple3(data[0], data[1], data[2])
|
||||
}
|
||||
|
||||
override fun setV3c(v: Tuple3<UShort>) {
|
||||
val data = ushortArrayOf(v._0, v._1, v._2)
|
||||
mat.put(indices, data)
|
||||
}
|
||||
|
||||
override fun getV4c(): Tuple4<UShort> {
|
||||
val data = UShortArray(4)
|
||||
mat.get(indices, data)
|
||||
return Tuple4(data[0], data[1], data[2], data[3])
|
||||
}
|
||||
|
||||
override fun setV4c(v: Tuple4<UShort>) {
|
||||
val data = ushortArrayOf(v._0, v._1, v._2, v._3)
|
||||
mat.put(indices, data)
|
||||
}
|
||||
}
|
||||
|
||||
operator fun <T> Tuple2<T>.component1(): T = this._0
|
||||
operator fun <T> Tuple2<T>.component2(): T = this._1
|
||||
|
||||
operator fun <T> Tuple3<T>.component1(): T = this._0
|
||||
operator fun <T> Tuple3<T>.component2(): T = this._1
|
||||
operator fun <T> Tuple3<T>.component3(): T = this._2
|
||||
|
||||
operator fun <T> Tuple4<T>.component1(): T = this._0
|
||||
operator fun <T> Tuple4<T>.component2(): T = this._1
|
||||
operator fun <T> Tuple4<T>.component3(): T = this._2
|
||||
operator fun <T> Tuple4<T>.component4(): T = this._3
|
||||
|
||||
fun <T> T2(_0: T, _1: T) : Tuple2<T> = Tuple2(_0, _1)
|
||||
fun <T> T3(_0: T, _1: T, _2: T) : Tuple3<T> = Tuple3(_0, _1, _2)
|
||||
fun <T> T4(_0: T, _1: T, _2: T, _3: T) : Tuple4<T> = Tuple4(_0, _1, _2, _3)
|
3
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatMatMul.kt
vendored
Normal file
3
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatMatMul.kt
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
package org.opencv.core
|
||||
|
||||
operator fun Mat.times(other: Mat): Mat = this.matMul(other)
|
98
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfByte.java
vendored
Normal file
98
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfByte.java
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfByte extends Mat {
|
||||
// 8UC(x)
|
||||
private static final int _depth = CvType.CV_8U;
|
||||
private static final int _channels = 1;
|
||||
|
||||
public MatOfByte() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfByte(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfByte fromNativeAddr(long addr) {
|
||||
return new MatOfByte(addr);
|
||||
}
|
||||
|
||||
public MatOfByte(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfByte(byte...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public MatOfByte(int offset, int length, byte...a) {
|
||||
super();
|
||||
fromArray(offset, length, a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(byte...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length / _channels;
|
||||
alloc(num);
|
||||
put(0, 0, a); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public void fromArray(int offset, int length, byte...a) {
|
||||
if (offset < 0)
|
||||
throw new IllegalArgumentException("offset < 0");
|
||||
if (a == null)
|
||||
throw new NullPointerException();
|
||||
if (length < 0 || length + offset > a.length)
|
||||
throw new IllegalArgumentException("invalid 'length' parameter: " + Integer.toString(length));
|
||||
if (a.length == 0)
|
||||
return;
|
||||
int num = length / _channels;
|
||||
alloc(num);
|
||||
put(0, 0, a, offset, length); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public byte[] toArray() {
|
||||
int num = checkVector(_channels, _depth);
|
||||
if(num < 0)
|
||||
throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
|
||||
byte[] a = new byte[num * _channels];
|
||||
if(num == 0)
|
||||
return a;
|
||||
get(0, 0, a); //TODO: check ret val!
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<Byte> lb) {
|
||||
if(lb==null || lb.size()==0)
|
||||
return;
|
||||
Byte ab[] = lb.toArray(new Byte[0]);
|
||||
byte a[] = new byte[ab.length];
|
||||
for(int i=0; i<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Byte> toList() {
|
||||
byte[] a = toArray();
|
||||
Byte ab[] = new Byte[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
83
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfDMatch.java
vendored
Normal file
83
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfDMatch.java
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.opencv.core.DMatch;
|
||||
|
||||
public class MatOfDMatch extends Mat {
|
||||
// 32FC4
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 4;
|
||||
|
||||
public MatOfDMatch() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfDMatch(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat: " + toString());
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfDMatch fromNativeAddr(long addr) {
|
||||
return new MatOfDMatch(addr);
|
||||
}
|
||||
|
||||
public MatOfDMatch(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat: " + toString());
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfDMatch(DMatch...ap) {
|
||||
super();
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
|
||||
public void fromArray(DMatch...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length;
|
||||
alloc(num);
|
||||
float buff[] = new float[num * _channels];
|
||||
for(int i=0; i<num; i++) {
|
||||
DMatch m = a[i];
|
||||
buff[_channels*i+0] = m.queryIdx;
|
||||
buff[_channels*i+1] = m.trainIdx;
|
||||
buff[_channels*i+2] = m.imgIdx;
|
||||
buff[_channels*i+3] = m.distance;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public DMatch[] toArray() {
|
||||
int num = (int) total();
|
||||
DMatch[] a = new DMatch[num];
|
||||
if(num == 0)
|
||||
return a;
|
||||
float buff[] = new float[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
a[i] = new DMatch((int) buff[_channels*i+0], (int) buff[_channels*i+1], (int) buff[_channels*i+2], buff[_channels*i+3]);
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<DMatch> ldm) {
|
||||
DMatch adm[] = ldm.toArray(new DMatch[0]);
|
||||
fromArray(adm);
|
||||
}
|
||||
|
||||
public List<DMatch> toList() {
|
||||
DMatch[] adm = toArray();
|
||||
return Arrays.asList(adm);
|
||||
}
|
||||
}
|
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfDouble.java
vendored
Normal file
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfDouble.java
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfDouble extends Mat {
|
||||
// 64FC(x)
|
||||
private static final int _depth = CvType.CV_64F;
|
||||
private static final int _channels = 1;
|
||||
|
||||
public MatOfDouble() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfDouble(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfDouble fromNativeAddr(long addr) {
|
||||
return new MatOfDouble(addr);
|
||||
}
|
||||
|
||||
public MatOfDouble(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfDouble(double...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(double...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length / _channels;
|
||||
alloc(num);
|
||||
put(0, 0, a); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public double[] toArray() {
|
||||
int num = checkVector(_channels, _depth);
|
||||
if(num < 0)
|
||||
throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
|
||||
double[] a = new double[num * _channels];
|
||||
if(num == 0)
|
||||
return a;
|
||||
get(0, 0, a); //TODO: check ret val!
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<Double> lb) {
|
||||
if(lb==null || lb.size()==0)
|
||||
return;
|
||||
Double ab[] = lb.toArray(new Double[0]);
|
||||
double a[] = new double[ab.length];
|
||||
for(int i=0; i<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Double> toList() {
|
||||
double[] a = toArray();
|
||||
Double ab[] = new Double[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfFloat.java
vendored
Normal file
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfFloat.java
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfFloat extends Mat {
|
||||
// 32FC1
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 1;
|
||||
|
||||
public MatOfFloat() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfFloat(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfFloat fromNativeAddr(long addr) {
|
||||
return new MatOfFloat(addr);
|
||||
}
|
||||
|
||||
public MatOfFloat(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfFloat(float...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(float...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length / _channels;
|
||||
alloc(num);
|
||||
put(0, 0, a); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public float[] toArray() {
|
||||
int num = checkVector(_channels, _depth);
|
||||
if(num < 0)
|
||||
throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
|
||||
float[] a = new float[num * _channels];
|
||||
if(num == 0)
|
||||
return a;
|
||||
get(0, 0, a); //TODO: check ret val!
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<Float> lb) {
|
||||
if(lb==null || lb.size()==0)
|
||||
return;
|
||||
Float ab[] = lb.toArray(new Float[0]);
|
||||
float a[] = new float[ab.length];
|
||||
for(int i=0; i<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Float> toList() {
|
||||
float[] a = toArray();
|
||||
Float ab[] = new Float[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfFloat4.java
vendored
Normal file
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfFloat4.java
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfFloat4 extends Mat {
|
||||
// 32FC4
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 4;
|
||||
|
||||
public MatOfFloat4() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfFloat4(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfFloat4 fromNativeAddr(long addr) {
|
||||
return new MatOfFloat4(addr);
|
||||
}
|
||||
|
||||
public MatOfFloat4(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfFloat4(float...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(float...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length / _channels;
|
||||
alloc(num);
|
||||
put(0, 0, a); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public float[] toArray() {
|
||||
int num = checkVector(_channels, _depth);
|
||||
if(num < 0)
|
||||
throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
|
||||
float[] a = new float[num * _channels];
|
||||
if(num == 0)
|
||||
return a;
|
||||
get(0, 0, a); //TODO: check ret val!
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<Float> lb) {
|
||||
if(lb==null || lb.size()==0)
|
||||
return;
|
||||
Float ab[] = lb.toArray(new Float[0]);
|
||||
float a[] = new float[ab.length];
|
||||
for(int i=0; i<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Float> toList() {
|
||||
float[] a = toArray();
|
||||
Float ab[] = new Float[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfFloat6.java
vendored
Normal file
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfFloat6.java
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfFloat6 extends Mat {
|
||||
// 32FC6
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 6;
|
||||
|
||||
public MatOfFloat6() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfFloat6(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfFloat6 fromNativeAddr(long addr) {
|
||||
return new MatOfFloat6(addr);
|
||||
}
|
||||
|
||||
public MatOfFloat6(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfFloat6(float...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(float...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length / _channels;
|
||||
alloc(num);
|
||||
put(0, 0, a); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public float[] toArray() {
|
||||
int num = checkVector(_channels, _depth);
|
||||
if(num < 0)
|
||||
throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
|
||||
float[] a = new float[num * _channels];
|
||||
if(num == 0)
|
||||
return a;
|
||||
get(0, 0, a); //TODO: check ret val!
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<Float> lb) {
|
||||
if(lb==null || lb.size()==0)
|
||||
return;
|
||||
Float ab[] = lb.toArray(new Float[0]);
|
||||
float a[] = new float[ab.length];
|
||||
for(int i=0; i<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Float> toList() {
|
||||
float[] a = toArray();
|
||||
Float ab[] = new Float[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
80
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfInt.java
vendored
Normal file
80
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfInt.java
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MatOfInt extends Mat {
|
||||
// 32SC1
|
||||
private static final int _depth = CvType.CV_32S;
|
||||
private static final int _channels = 1;
|
||||
|
||||
public MatOfInt() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfInt(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfInt fromNativeAddr(long addr) {
|
||||
return new MatOfInt(addr);
|
||||
}
|
||||
|
||||
public MatOfInt(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfInt(int...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(int...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length / _channels;
|
||||
alloc(num);
|
||||
put(0, 0, a); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public int[] toArray() {
|
||||
int num = checkVector(_channels, _depth);
|
||||
if(num < 0)
|
||||
throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
|
||||
int[] a = new int[num * _channels];
|
||||
if(num == 0)
|
||||
return a;
|
||||
get(0, 0, a); //TODO: check ret val!
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<Integer> lb) {
|
||||
if(lb==null || lb.size()==0)
|
||||
return;
|
||||
Integer ab[] = lb.toArray(new Integer[0]);
|
||||
int a[] = new int[ab.length];
|
||||
for(int i=0; i<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Integer> toList() {
|
||||
int[] a = toArray();
|
||||
Integer ab[] = new Integer[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
80
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfInt4.java
vendored
Normal file
80
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfInt4.java
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MatOfInt4 extends Mat {
|
||||
// 32SC4
|
||||
private static final int _depth = CvType.CV_32S;
|
||||
private static final int _channels = 4;
|
||||
|
||||
public MatOfInt4() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfInt4(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfInt4 fromNativeAddr(long addr) {
|
||||
return new MatOfInt4(addr);
|
||||
}
|
||||
|
||||
public MatOfInt4(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfInt4(int...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(int...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length / _channels;
|
||||
alloc(num);
|
||||
put(0, 0, a); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public int[] toArray() {
|
||||
int num = checkVector(_channels, _depth);
|
||||
if(num < 0)
|
||||
throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
|
||||
int[] a = new int[num * _channels];
|
||||
if(num == 0)
|
||||
return a;
|
||||
get(0, 0, a); //TODO: check ret val!
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<Integer> lb) {
|
||||
if(lb==null || lb.size()==0)
|
||||
return;
|
||||
Integer ab[] = lb.toArray(new Integer[0]);
|
||||
int a[] = new int[ab.length];
|
||||
for(int i=0; i<ab.length; i++)
|
||||
a[i] = ab[i];
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public List<Integer> toList() {
|
||||
int[] a = toArray();
|
||||
Integer ab[] = new Integer[a.length];
|
||||
for(int i=0; i<a.length; i++)
|
||||
ab[i] = a[i];
|
||||
return Arrays.asList(ab);
|
||||
}
|
||||
}
|
86
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfKeyPoint.java
vendored
Normal file
86
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfKeyPoint.java
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.opencv.core.KeyPoint;
|
||||
|
||||
public class MatOfKeyPoint extends Mat {
|
||||
// 32FC7
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 7;
|
||||
|
||||
public MatOfKeyPoint() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfKeyPoint(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfKeyPoint fromNativeAddr(long addr) {
|
||||
return new MatOfKeyPoint(addr);
|
||||
}
|
||||
|
||||
public MatOfKeyPoint(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfKeyPoint(KeyPoint...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(KeyPoint...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length;
|
||||
alloc(num);
|
||||
float buff[] = new float[num * _channels];
|
||||
for(int i=0; i<num; i++) {
|
||||
KeyPoint kp = a[i];
|
||||
buff[_channels*i+0] = (float) kp.pt.x;
|
||||
buff[_channels*i+1] = (float) kp.pt.y;
|
||||
buff[_channels*i+2] = kp.size;
|
||||
buff[_channels*i+3] = kp.angle;
|
||||
buff[_channels*i+4] = kp.response;
|
||||
buff[_channels*i+5] = kp.octave;
|
||||
buff[_channels*i+6] = kp.class_id;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public KeyPoint[] toArray() {
|
||||
int num = (int) total();
|
||||
KeyPoint[] a = new KeyPoint[num];
|
||||
if(num == 0)
|
||||
return a;
|
||||
float buff[] = new float[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
|
||||
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<KeyPoint> lkp) {
|
||||
KeyPoint akp[] = lkp.toArray(new KeyPoint[0]);
|
||||
fromArray(akp);
|
||||
}
|
||||
|
||||
public List<KeyPoint> toList() {
|
||||
KeyPoint[] akp = toArray();
|
||||
return Arrays.asList(akp);
|
||||
}
|
||||
}
|
78
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfPoint.java
vendored
Normal file
78
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfPoint.java
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfPoint extends Mat {
|
||||
// 32SC2
|
||||
private static final int _depth = CvType.CV_32S;
|
||||
private static final int _channels = 2;
|
||||
|
||||
public MatOfPoint() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfPoint(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfPoint fromNativeAddr(long addr) {
|
||||
return new MatOfPoint(addr);
|
||||
}
|
||||
|
||||
public MatOfPoint(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfPoint(Point...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(Point...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length;
|
||||
alloc(num);
|
||||
int buff[] = new int[num * _channels];
|
||||
for(int i=0; i<num; i++) {
|
||||
Point p = a[i];
|
||||
buff[_channels*i+0] = (int) p.x;
|
||||
buff[_channels*i+1] = (int) p.y;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public Point[] toArray() {
|
||||
int num = (int) total();
|
||||
Point[] ap = new Point[num];
|
||||
if(num == 0)
|
||||
return ap;
|
||||
int buff[] = new int[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
ap[i] = new Point(buff[i*_channels], buff[i*_channels+1]);
|
||||
return ap;
|
||||
}
|
||||
|
||||
public void fromList(List<Point> lp) {
|
||||
Point ap[] = lp.toArray(new Point[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Point> toList() {
|
||||
Point[] ap = toArray();
|
||||
return Arrays.asList(ap);
|
||||
}
|
||||
}
|
78
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfPoint2f.java
vendored
Normal file
78
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfPoint2f.java
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfPoint2f extends Mat {
|
||||
// 32FC2
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 2;
|
||||
|
||||
public MatOfPoint2f() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfPoint2f(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfPoint2f fromNativeAddr(long addr) {
|
||||
return new MatOfPoint2f(addr);
|
||||
}
|
||||
|
||||
public MatOfPoint2f(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfPoint2f(Point...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(Point...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length;
|
||||
alloc(num);
|
||||
float buff[] = new float[num * _channels];
|
||||
for(int i=0; i<num; i++) {
|
||||
Point p = a[i];
|
||||
buff[_channels*i+0] = (float) p.x;
|
||||
buff[_channels*i+1] = (float) p.y;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public Point[] toArray() {
|
||||
int num = (int) total();
|
||||
Point[] ap = new Point[num];
|
||||
if(num == 0)
|
||||
return ap;
|
||||
float buff[] = new float[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
ap[i] = new Point(buff[i*_channels], buff[i*_channels+1]);
|
||||
return ap;
|
||||
}
|
||||
|
||||
public void fromList(List<Point> lp) {
|
||||
Point ap[] = lp.toArray(new Point[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Point> toList() {
|
||||
Point[] ap = toArray();
|
||||
return Arrays.asList(ap);
|
||||
}
|
||||
}
|
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfPoint3.java
vendored
Normal file
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfPoint3.java
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfPoint3 extends Mat {
|
||||
// 32SC3
|
||||
private static final int _depth = CvType.CV_32S;
|
||||
private static final int _channels = 3;
|
||||
|
||||
public MatOfPoint3() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfPoint3(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfPoint3 fromNativeAddr(long addr) {
|
||||
return new MatOfPoint3(addr);
|
||||
}
|
||||
|
||||
public MatOfPoint3(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfPoint3(Point3...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(Point3...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length;
|
||||
alloc(num);
|
||||
int buff[] = new int[num * _channels];
|
||||
for(int i=0; i<num; i++) {
|
||||
Point3 p = a[i];
|
||||
buff[_channels*i+0] = (int) p.x;
|
||||
buff[_channels*i+1] = (int) p.y;
|
||||
buff[_channels*i+2] = (int) p.z;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public Point3[] toArray() {
|
||||
int num = (int) total();
|
||||
Point3[] ap = new Point3[num];
|
||||
if(num == 0)
|
||||
return ap;
|
||||
int buff[] = new int[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
ap[i] = new Point3(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2]);
|
||||
return ap;
|
||||
}
|
||||
|
||||
public void fromList(List<Point3> lp) {
|
||||
Point3 ap[] = lp.toArray(new Point3[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Point3> toList() {
|
||||
Point3[] ap = toArray();
|
||||
return Arrays.asList(ap);
|
||||
}
|
||||
}
|
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfPoint3f.java
vendored
Normal file
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfPoint3f.java
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MatOfPoint3f extends Mat {
|
||||
// 32FC3
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 3;
|
||||
|
||||
public MatOfPoint3f() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfPoint3f(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfPoint3f fromNativeAddr(long addr) {
|
||||
return new MatOfPoint3f(addr);
|
||||
}
|
||||
|
||||
public MatOfPoint3f(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfPoint3f(Point3...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(Point3...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length;
|
||||
alloc(num);
|
||||
float buff[] = new float[num * _channels];
|
||||
for(int i=0; i<num; i++) {
|
||||
Point3 p = a[i];
|
||||
buff[_channels*i+0] = (float) p.x;
|
||||
buff[_channels*i+1] = (float) p.y;
|
||||
buff[_channels*i+2] = (float) p.z;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public Point3[] toArray() {
|
||||
int num = (int) total();
|
||||
Point3[] ap = new Point3[num];
|
||||
if(num == 0)
|
||||
return ap;
|
||||
float buff[] = new float[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
ap[i] = new Point3(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2]);
|
||||
return ap;
|
||||
}
|
||||
|
||||
public void fromList(List<Point3> lp) {
|
||||
Point3 ap[] = lp.toArray(new Point3[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Point3> toList() {
|
||||
Point3[] ap = toArray();
|
||||
return Arrays.asList(ap);
|
||||
}
|
||||
}
|
81
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfRect.java
vendored
Normal file
81
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfRect.java
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MatOfRect extends Mat {
|
||||
// 32SC4
|
||||
private static final int _depth = CvType.CV_32S;
|
||||
private static final int _channels = 4;
|
||||
|
||||
public MatOfRect() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfRect(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfRect fromNativeAddr(long addr) {
|
||||
return new MatOfRect(addr);
|
||||
}
|
||||
|
||||
public MatOfRect(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfRect(Rect...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(Rect...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length;
|
||||
alloc(num);
|
||||
int buff[] = new int[num * _channels];
|
||||
for(int i=0; i<num; i++) {
|
||||
Rect r = a[i];
|
||||
buff[_channels*i+0] = (int) r.x;
|
||||
buff[_channels*i+1] = (int) r.y;
|
||||
buff[_channels*i+2] = (int) r.width;
|
||||
buff[_channels*i+3] = (int) r.height;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
|
||||
public Rect[] toArray() {
|
||||
int num = (int) total();
|
||||
Rect[] a = new Rect[num];
|
||||
if(num == 0)
|
||||
return a;
|
||||
int buff[] = new int[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
a[i] = new Rect(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2], buff[i*_channels+3]);
|
||||
return a;
|
||||
}
|
||||
public void fromList(List<Rect> lr) {
|
||||
Rect ap[] = lr.toArray(new Rect[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Rect> toList() {
|
||||
Rect[] ar = toArray();
|
||||
return Arrays.asList(ar);
|
||||
}
|
||||
}
|
81
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfRect2d.java
vendored
Normal file
81
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfRect2d.java
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class MatOfRect2d extends Mat {
|
||||
// 64FC4
|
||||
private static final int _depth = CvType.CV_64F;
|
||||
private static final int _channels = 4;
|
||||
|
||||
public MatOfRect2d() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfRect2d(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfRect2d fromNativeAddr(long addr) {
|
||||
return new MatOfRect2d(addr);
|
||||
}
|
||||
|
||||
public MatOfRect2d(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfRect2d(Rect2d...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(Rect2d...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length;
|
||||
alloc(num);
|
||||
double buff[] = new double[num * _channels];
|
||||
for(int i=0; i<num; i++) {
|
||||
Rect2d r = a[i];
|
||||
buff[_channels*i+0] = (double) r.x;
|
||||
buff[_channels*i+1] = (double) r.y;
|
||||
buff[_channels*i+2] = (double) r.width;
|
||||
buff[_channels*i+3] = (double) r.height;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
|
||||
public Rect2d[] toArray() {
|
||||
int num = (int) total();
|
||||
Rect2d[] a = new Rect2d[num];
|
||||
if(num == 0)
|
||||
return a;
|
||||
double buff[] = new double[num * _channels];
|
||||
get(0, 0, buff); //TODO: check ret val!
|
||||
for(int i=0; i<num; i++)
|
||||
a[i] = new Rect2d(buff[i*_channels], buff[i*_channels+1], buff[i*_channels+2], buff[i*_channels+3]);
|
||||
return a;
|
||||
}
|
||||
public void fromList(List<Rect2d> lr) {
|
||||
Rect2d ap[] = lr.toArray(new Rect2d[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<Rect2d> toList() {
|
||||
Rect2d[] ar = toArray();
|
||||
return Arrays.asList(ar);
|
||||
}
|
||||
}
|
86
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfRotatedRect.java
vendored
Normal file
86
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+MatOfRotatedRect.java
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
package org.opencv.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.opencv.core.RotatedRect;
|
||||
|
||||
|
||||
|
||||
public class MatOfRotatedRect extends Mat {
|
||||
// 32FC5
|
||||
private static final int _depth = CvType.CV_32F;
|
||||
private static final int _channels = 5;
|
||||
|
||||
public MatOfRotatedRect() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected MatOfRotatedRect(long addr) {
|
||||
super(addr);
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public static MatOfRotatedRect fromNativeAddr(long addr) {
|
||||
return new MatOfRotatedRect(addr);
|
||||
}
|
||||
|
||||
public MatOfRotatedRect(Mat m) {
|
||||
super(m, Range.all());
|
||||
if( !empty() && checkVector(_channels, _depth) < 0 )
|
||||
throw new IllegalArgumentException("Incompatible Mat");
|
||||
//FIXME: do we need release() here?
|
||||
}
|
||||
|
||||
public MatOfRotatedRect(RotatedRect...a) {
|
||||
super();
|
||||
fromArray(a);
|
||||
}
|
||||
|
||||
public void alloc(int elemNumber) {
|
||||
if(elemNumber>0)
|
||||
super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
|
||||
}
|
||||
|
||||
public void fromArray(RotatedRect...a) {
|
||||
if(a==null || a.length==0)
|
||||
return;
|
||||
int num = a.length;
|
||||
alloc(num);
|
||||
float buff[] = new float[num * _channels];
|
||||
for(int i=0; i<num; i++) {
|
||||
RotatedRect r = a[i];
|
||||
buff[_channels*i+0] = (float) r.center.x;
|
||||
buff[_channels*i+1] = (float) r.center.y;
|
||||
buff[_channels*i+2] = (float) r.size.width;
|
||||
buff[_channels*i+3] = (float) r.size.height;
|
||||
buff[_channels*i+4] = (float) r.angle;
|
||||
}
|
||||
put(0, 0, buff); //TODO: check ret val!
|
||||
}
|
||||
|
||||
public RotatedRect[] toArray() {
|
||||
int num = (int) total();
|
||||
RotatedRect[] a = new RotatedRect[num];
|
||||
if(num == 0)
|
||||
return a;
|
||||
float buff[] = new float[_channels];
|
||||
for(int i=0; i<num; i++) {
|
||||
get(i, 0, buff); //TODO: check ret val!
|
||||
a[i] = new RotatedRect(new Point(buff[0],buff[1]),new Size(buff[2],buff[3]),buff[4]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public void fromList(List<RotatedRect> lr) {
|
||||
RotatedRect ap[] = lr.toArray(new RotatedRect[0]);
|
||||
fromArray(ap);
|
||||
}
|
||||
|
||||
public List<RotatedRect> toList() {
|
||||
RotatedRect[] ar = toArray();
|
||||
return Arrays.asList(ar);
|
||||
}
|
||||
}
|
68
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Point.java
vendored
Normal file
68
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Point.java
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Point_
|
||||
public class Point {
|
||||
|
||||
public double x, y;
|
||||
|
||||
public Point(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Point() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
public Point(double[] vals) {
|
||||
this();
|
||||
set(vals);
|
||||
}
|
||||
|
||||
public void set(double[] vals) {
|
||||
if (vals != null) {
|
||||
x = vals.length > 0 ? vals[0] : 0;
|
||||
y = vals.length > 1 ? vals[1] : 0;
|
||||
} else {
|
||||
x = 0;
|
||||
y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Point clone() {
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
public double dot(Point p) {
|
||||
return x * p.x + y * p.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Point)) return false;
|
||||
Point it = (Point) obj;
|
||||
return x == it.x && y == it.y;
|
||||
}
|
||||
|
||||
public boolean inside(Rect r) {
|
||||
return r.contains(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + x + ", " + y + "}";
|
||||
}
|
||||
}
|
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Point3.java
vendored
Normal file
79
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Point3.java
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Point3_
|
||||
public class Point3 {
|
||||
|
||||
public double x, y, z;
|
||||
|
||||
public Point3(double x, double y, double z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Point3() {
|
||||
this(0, 0, 0);
|
||||
}
|
||||
|
||||
public Point3(Point p) {
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
z = 0;
|
||||
}
|
||||
|
||||
public Point3(double[] vals) {
|
||||
this();
|
||||
set(vals);
|
||||
}
|
||||
|
||||
public void set(double[] vals) {
|
||||
if (vals != null) {
|
||||
x = vals.length > 0 ? vals[0] : 0;
|
||||
y = vals.length > 1 ? vals[1] : 0;
|
||||
z = vals.length > 2 ? vals[2] : 0;
|
||||
} else {
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Point3 clone() {
|
||||
return new Point3(x, y, z);
|
||||
}
|
||||
|
||||
public double dot(Point3 p) {
|
||||
return x * p.x + y * p.y + z * p.z;
|
||||
}
|
||||
|
||||
public Point3 cross(Point3 p) {
|
||||
return new Point3(y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(z);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Point3)) return false;
|
||||
Point3 it = (Point3) obj;
|
||||
return x == it.x && y == it.y && z == it.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + x + ", " + y + ", " + z + "}";
|
||||
}
|
||||
}
|
82
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Range.java
vendored
Normal file
82
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Range.java
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Range
|
||||
public class Range {
|
||||
|
||||
public int start, end;
|
||||
|
||||
public Range(int s, int e) {
|
||||
this.start = s;
|
||||
this.end = e;
|
||||
}
|
||||
|
||||
public Range() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
public Range(double[] vals) {
|
||||
set(vals);
|
||||
}
|
||||
|
||||
public void set(double[] vals) {
|
||||
if (vals != null) {
|
||||
start = vals.length > 0 ? (int) vals[0] : 0;
|
||||
end = vals.length > 1 ? (int) vals[1] : 0;
|
||||
} else {
|
||||
start = 0;
|
||||
end = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return empty() ? 0 : end - start;
|
||||
}
|
||||
|
||||
public boolean empty() {
|
||||
return end <= start;
|
||||
}
|
||||
|
||||
public static Range all() {
|
||||
return new Range(Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public Range intersection(Range r1) {
|
||||
Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end));
|
||||
r.end = Math.max(r.end, r.start);
|
||||
return r;
|
||||
}
|
||||
|
||||
public Range shift(int delta) {
|
||||
return new Range(start + delta, end + delta);
|
||||
}
|
||||
|
||||
public Range clone() {
|
||||
return new Range(start, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(start);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(end);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Range)) return false;
|
||||
Range it = (Range) obj;
|
||||
return start == it.start && end == it.end;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + start + ", " + end + ")";
|
||||
}
|
||||
}
|
104
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Rect.java
vendored
Normal file
104
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Rect.java
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Rect_
|
||||
public class Rect {
|
||||
|
||||
public int x, y, width, height;
|
||||
|
||||
public Rect(int x, int y, int width, int height) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Rect() {
|
||||
this(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Rect(Point p1, Point p2) {
|
||||
x = (int) (p1.x < p2.x ? p1.x : p2.x);
|
||||
y = (int) (p1.y < p2.y ? p1.y : p2.y);
|
||||
width = (int) (p1.x > p2.x ? p1.x : p2.x) - x;
|
||||
height = (int) (p1.y > p2.y ? p1.y : p2.y) - y;
|
||||
}
|
||||
|
||||
public Rect(Point p, Size s) {
|
||||
this((int) p.x, (int) p.y, (int) s.width, (int) s.height);
|
||||
}
|
||||
|
||||
public Rect(double[] vals) {
|
||||
set(vals);
|
||||
}
|
||||
|
||||
public void set(double[] vals) {
|
||||
if (vals != null) {
|
||||
x = vals.length > 0 ? (int) vals[0] : 0;
|
||||
y = vals.length > 1 ? (int) vals[1] : 0;
|
||||
width = vals.length > 2 ? (int) vals[2] : 0;
|
||||
height = vals.length > 3 ? (int) vals[3] : 0;
|
||||
} else {
|
||||
x = 0;
|
||||
y = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Rect clone() {
|
||||
return new Rect(x, y, width, height);
|
||||
}
|
||||
|
||||
public Point tl() {
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
public Point br() {
|
||||
return new Point(x + width, y + height);
|
||||
}
|
||||
|
||||
public Size size() {
|
||||
return new Size(width, height);
|
||||
}
|
||||
|
||||
public double area() {
|
||||
return width * height;
|
||||
}
|
||||
|
||||
public boolean empty() {
|
||||
return width <= 0 || height <= 0;
|
||||
}
|
||||
|
||||
public boolean contains(Point p) {
|
||||
return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(height);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(width);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Rect)) return false;
|
||||
Rect it = (Rect) obj;
|
||||
return x == it.x && y == it.y && width == it.width && height == it.height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + x + ", " + y + ", " + width + "x" + height + "}";
|
||||
}
|
||||
}
|
104
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Rect2d.java
vendored
Normal file
104
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Rect2d.java
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Rect2d_
|
||||
public class Rect2d {
|
||||
|
||||
public double x, y, width, height;
|
||||
|
||||
public Rect2d(double x, double y, double width, double height) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Rect2d() {
|
||||
this(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Rect2d(Point p1, Point p2) {
|
||||
x = (double) (p1.x < p2.x ? p1.x : p2.x);
|
||||
y = (double) (p1.y < p2.y ? p1.y : p2.y);
|
||||
width = (double) (p1.x > p2.x ? p1.x : p2.x) - x;
|
||||
height = (double) (p1.y > p2.y ? p1.y : p2.y) - y;
|
||||
}
|
||||
|
||||
public Rect2d(Point p, Size s) {
|
||||
this((double) p.x, (double) p.y, (double) s.width, (double) s.height);
|
||||
}
|
||||
|
||||
public Rect2d(double[] vals) {
|
||||
set(vals);
|
||||
}
|
||||
|
||||
public void set(double[] vals) {
|
||||
if (vals != null) {
|
||||
x = vals.length > 0 ? (double) vals[0] : 0;
|
||||
y = vals.length > 1 ? (double) vals[1] : 0;
|
||||
width = vals.length > 2 ? (double) vals[2] : 0;
|
||||
height = vals.length > 3 ? (double) vals[3] : 0;
|
||||
} else {
|
||||
x = 0;
|
||||
y = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Rect2d clone() {
|
||||
return new Rect2d(x, y, width, height);
|
||||
}
|
||||
|
||||
public Point tl() {
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
public Point br() {
|
||||
return new Point(x + width, y + height);
|
||||
}
|
||||
|
||||
public Size size() {
|
||||
return new Size(width, height);
|
||||
}
|
||||
|
||||
public double area() {
|
||||
return width * height;
|
||||
}
|
||||
|
||||
public boolean empty() {
|
||||
return width <= 0 || height <= 0;
|
||||
}
|
||||
|
||||
public boolean contains(Point p) {
|
||||
return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(height);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(width);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Rect2d)) return false;
|
||||
Rect2d it = (Rect2d) obj;
|
||||
return x == it.x && y == it.y && width == it.width && height == it.height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + x + ", " + y + ", " + width + "x" + height + "}";
|
||||
}
|
||||
}
|
113
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+RotatedRect.java
vendored
Normal file
113
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+RotatedRect.java
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:RotatedRect_
|
||||
public class RotatedRect {
|
||||
|
||||
public Point center;
|
||||
public Size size;
|
||||
public double angle;
|
||||
|
||||
public RotatedRect() {
|
||||
this.center = new Point();
|
||||
this.size = new Size();
|
||||
this.angle = 0;
|
||||
}
|
||||
|
||||
public RotatedRect(Point c, Size s, double a) {
|
||||
this.center = c.clone();
|
||||
this.size = s.clone();
|
||||
this.angle = a;
|
||||
}
|
||||
|
||||
public RotatedRect(double[] vals) {
|
||||
this();
|
||||
set(vals);
|
||||
}
|
||||
|
||||
public void set(double[] vals) {
|
||||
if (vals != null) {
|
||||
center.x = vals.length > 0 ? (double) vals[0] : 0;
|
||||
center.y = vals.length > 1 ? (double) vals[1] : 0;
|
||||
size.width = vals.length > 2 ? (double) vals[2] : 0;
|
||||
size.height = vals.length > 3 ? (double) vals[3] : 0;
|
||||
angle = vals.length > 4 ? (double) vals[4] : 0;
|
||||
} else {
|
||||
center.x = 0;
|
||||
center.y = 0;
|
||||
size.width = 0;
|
||||
size.height = 0;
|
||||
angle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void points(Point pt[])
|
||||
{
|
||||
double _angle = angle * Math.PI / 180.0;
|
||||
double b = (double) Math.cos(_angle) * 0.5f;
|
||||
double a = (double) Math.sin(_angle) * 0.5f;
|
||||
|
||||
pt[0] = new Point(
|
||||
center.x - a * size.height - b * size.width,
|
||||
center.y + b * size.height - a * size.width);
|
||||
|
||||
pt[1] = new Point(
|
||||
center.x + a * size.height - b * size.width,
|
||||
center.y - b * size.height - a * size.width);
|
||||
|
||||
pt[2] = new Point(
|
||||
2 * center.x - pt[0].x,
|
||||
2 * center.y - pt[0].y);
|
||||
|
||||
pt[3] = new Point(
|
||||
2 * center.x - pt[1].x,
|
||||
2 * center.y - pt[1].y);
|
||||
}
|
||||
|
||||
public Rect boundingRect()
|
||||
{
|
||||
Point pt[] = new Point[4];
|
||||
points(pt);
|
||||
Rect r = new Rect((int) Math.floor(Math.min(Math.min(Math.min(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
|
||||
(int) Math.floor(Math.min(Math.min(Math.min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
|
||||
(int) Math.ceil(Math.max(Math.max(Math.max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
|
||||
(int) Math.ceil(Math.max(Math.max(Math.max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
|
||||
r.width -= r.x - 1;
|
||||
r.height -= r.y - 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
public RotatedRect clone() {
|
||||
return new RotatedRect(center, size, angle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(center.x);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(center.y);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(size.width);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(size.height);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(angle);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof RotatedRect)) return false;
|
||||
RotatedRect it = (RotatedRect) obj;
|
||||
return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{ " + center + " " + size + " * " + angle + " }";
|
||||
}
|
||||
}
|
90
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Scalar.java
vendored
Normal file
90
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Scalar.java
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Scalar_
|
||||
public class Scalar {
|
||||
|
||||
public double val[];
|
||||
|
||||
public Scalar(double v0, double v1, double v2, double v3) {
|
||||
val = new double[] { v0, v1, v2, v3 };
|
||||
}
|
||||
|
||||
public Scalar(double v0, double v1, double v2) {
|
||||
val = new double[] { v0, v1, v2, 0 };
|
||||
}
|
||||
|
||||
public Scalar(double v0, double v1) {
|
||||
val = new double[] { v0, v1, 0, 0 };
|
||||
}
|
||||
|
||||
public Scalar(double v0) {
|
||||
val = new double[] { v0, 0, 0, 0 };
|
||||
}
|
||||
|
||||
public Scalar(double[] vals) {
|
||||
if (vals != null && vals.length == 4)
|
||||
val = vals.clone();
|
||||
else {
|
||||
val = new double[4];
|
||||
set(vals);
|
||||
}
|
||||
}
|
||||
|
||||
public void set(double[] vals) {
|
||||
if (vals != null) {
|
||||
val[0] = vals.length > 0 ? vals[0] : 0;
|
||||
val[1] = vals.length > 1 ? vals[1] : 0;
|
||||
val[2] = vals.length > 2 ? vals[2] : 0;
|
||||
val[3] = vals.length > 3 ? vals[3] : 0;
|
||||
} else
|
||||
val[0] = val[1] = val[2] = val[3] = 0;
|
||||
}
|
||||
|
||||
public static Scalar all(double v) {
|
||||
return new Scalar(v, v, v, v);
|
||||
}
|
||||
|
||||
public Scalar clone() {
|
||||
return new Scalar(val);
|
||||
}
|
||||
|
||||
public Scalar mul(Scalar it, double scale) {
|
||||
return new Scalar(val[0] * it.val[0] * scale, val[1] * it.val[1] * scale,
|
||||
val[2] * it.val[2] * scale, val[3] * it.val[3] * scale);
|
||||
}
|
||||
|
||||
public Scalar mul(Scalar it) {
|
||||
return mul(it, 1);
|
||||
}
|
||||
|
||||
public Scalar conj() {
|
||||
return new Scalar(val[0], -val[1], -val[2], -val[3]);
|
||||
}
|
||||
|
||||
public boolean isReal() {
|
||||
return val[1] == 0 && val[2] == 0 && val[3] == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + java.util.Arrays.hashCode(val);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Scalar)) return false;
|
||||
Scalar it = (Scalar) obj;
|
||||
if (!java.util.Arrays.equals(val, it.val)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + val[0] + ", " + val[1] + ", " + val[2] + ", " + val[3] + "]";
|
||||
}
|
||||
|
||||
}
|
73
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Size.java
vendored
Normal file
73
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+Size.java
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:Size_
|
||||
public class Size {
|
||||
|
||||
public double width, height;
|
||||
|
||||
public Size(double width, double height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Size() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
public Size(Point p) {
|
||||
width = p.x;
|
||||
height = p.y;
|
||||
}
|
||||
|
||||
public Size(double[] vals) {
|
||||
set(vals);
|
||||
}
|
||||
|
||||
public void set(double[] vals) {
|
||||
if (vals != null) {
|
||||
width = vals.length > 0 ? vals[0] : 0;
|
||||
height = vals.length > 1 ? vals[1] : 0;
|
||||
} else {
|
||||
width = 0;
|
||||
height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double area() {
|
||||
return width * height;
|
||||
}
|
||||
|
||||
public boolean empty() {
|
||||
return width <= 0 || height <= 0;
|
||||
}
|
||||
|
||||
public Size clone() {
|
||||
return new Size(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(height);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(width);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof Size)) return false;
|
||||
Size it = (Size) obj;
|
||||
return width == it.width && height == it.height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (int)width + "x" + (int)height;
|
||||
}
|
||||
|
||||
}
|
92
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+TermCriteria.java
vendored
Normal file
92
3rdparty/opencv-4.5.4/modules/core/misc/java/src/java/core+TermCriteria.java
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
package org.opencv.core;
|
||||
|
||||
//javadoc:TermCriteria
|
||||
public class TermCriteria {
|
||||
|
||||
/**
|
||||
* The maximum number of iterations or elements to compute
|
||||
*/
|
||||
public static final int COUNT = 1;
|
||||
/**
|
||||
* The maximum number of iterations or elements to compute
|
||||
*/
|
||||
public static final int MAX_ITER = COUNT;
|
||||
/**
|
||||
* The desired accuracy threshold or change in parameters at which the iterative algorithm is terminated.
|
||||
*/
|
||||
public static final int EPS = 2;
|
||||
|
||||
public int type;
|
||||
public int maxCount;
|
||||
public double epsilon;
|
||||
|
||||
/**
|
||||
* Termination criteria for iterative algorithms.
|
||||
*
|
||||
* @param type
|
||||
* the type of termination criteria: COUNT, EPS or COUNT + EPS.
|
||||
* @param maxCount
|
||||
* the maximum number of iterations/elements.
|
||||
* @param epsilon
|
||||
* the desired accuracy.
|
||||
*/
|
||||
public TermCriteria(int type, int maxCount, double epsilon) {
|
||||
this.type = type;
|
||||
this.maxCount = maxCount;
|
||||
this.epsilon = epsilon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Termination criteria for iterative algorithms.
|
||||
*/
|
||||
public TermCriteria() {
|
||||
this(0, 0, 0.0);
|
||||
}
|
||||
|
||||
public TermCriteria(double[] vals) {
|
||||
set(vals);
|
||||
}
|
||||
|
||||
public void set(double[] vals) {
|
||||
if (vals != null) {
|
||||
type = vals.length > 0 ? (int) vals[0] : 0;
|
||||
maxCount = vals.length > 1 ? (int) vals[1] : 0;
|
||||
epsilon = vals.length > 2 ? (double) vals[2] : 0;
|
||||
} else {
|
||||
type = 0;
|
||||
maxCount = 0;
|
||||
epsilon = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public TermCriteria clone() {
|
||||
return new TermCriteria(type, maxCount, epsilon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(type);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(maxCount);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(epsilon);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (!(obj instanceof TermCriteria)) return false;
|
||||
TermCriteria it = (TermCriteria) obj;
|
||||
return type == it.type && maxCount == it.maxCount && epsilon == it.epsilon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{ type: " + type + ", maxCount: " + maxCount + ", epsilon: " + epsilon + "}";
|
||||
}
|
||||
}
|
2062
3rdparty/opencv-4.5.4/modules/core/misc/java/test/CoreTest.java
vendored
Normal file
2062
3rdparty/opencv-4.5.4/modules/core/misc/java/test/CoreTest.java
vendored
Normal file
File diff suppressed because it is too large
Load Diff
71
3rdparty/opencv-4.5.4/modules/core/misc/java/test/CvTypeTest.java
vendored
Normal file
71
3rdparty/opencv-4.5.4/modules/core/misc/java/test/CvTypeTest.java
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class CvTypeTest extends OpenCVTestCase {
|
||||
|
||||
public void testMakeType() {
|
||||
assertEquals(CvType.CV_8UC4, CvType.makeType(CvType.CV_8U, 4));
|
||||
}
|
||||
|
||||
public void testCV_8UC() {
|
||||
assertEquals(CvType.CV_8UC4, CvType.CV_8UC(4));
|
||||
}
|
||||
|
||||
public void testCV_8SC() {
|
||||
assertEquals(CvType.CV_8SC4, CvType.CV_8SC(4));
|
||||
}
|
||||
|
||||
public void testCV_16UC() {
|
||||
assertEquals(CvType.CV_16UC4, CvType.CV_16UC(4));
|
||||
}
|
||||
|
||||
public void testCV_16SC() {
|
||||
assertEquals(CvType.CV_16SC4, CvType.CV_16SC(4));
|
||||
}
|
||||
|
||||
public void testCV_32SC() {
|
||||
assertEquals(CvType.CV_32SC4, CvType.CV_32SC(4));
|
||||
}
|
||||
|
||||
public void testCV_32FC() {
|
||||
assertEquals(CvType.CV_32FC4, CvType.CV_32FC(4));
|
||||
}
|
||||
|
||||
public void testCV_64FC() {
|
||||
assertEquals(CvType.CV_64FC4, CvType.CV_64FC(4));
|
||||
}
|
||||
|
||||
public void testCV_16FC() {
|
||||
assertEquals(CvType.CV_16FC1, CvType.CV_16FC(1));
|
||||
assertEquals(CvType.CV_16FC2, CvType.CV_16FC(2));
|
||||
assertEquals(CvType.CV_16FC3, CvType.CV_16FC(3));
|
||||
assertEquals(CvType.CV_16FC4, CvType.CV_16FC(4));
|
||||
}
|
||||
|
||||
public void testChannels() {
|
||||
assertEquals(1, CvType.channels(CvType.CV_64F));
|
||||
}
|
||||
|
||||
public void testDepth() {
|
||||
assertEquals(CvType.CV_64F, CvType.depth(CvType.CV_64FC3));
|
||||
}
|
||||
|
||||
public void testIsInteger() {
|
||||
assertFalse(CvType.isInteger(CvType.CV_32FC3));
|
||||
assertTrue(CvType.isInteger(CvType.CV_16S));
|
||||
}
|
||||
|
||||
public void testELEM_SIZE() {
|
||||
assertEquals(3 * 8, CvType.ELEM_SIZE(CvType.CV_64FC3));
|
||||
assertEquals(3 * 2, CvType.ELEM_SIZE(CvType.CV_16FC3));
|
||||
}
|
||||
|
||||
public void testTypeToString() {
|
||||
assertEquals("CV_32FC1", CvType.typeToString(CvType.CV_32F));
|
||||
assertEquals("CV_32FC3", CvType.typeToString(CvType.CV_32FC3));
|
||||
assertEquals("CV_32FC(128)", CvType.typeToString(CvType.CV_32FC(128)));
|
||||
}
|
||||
|
||||
}
|
44
3rdparty/opencv-4.5.4/modules/core/misc/java/test/DMatchTest.java
vendored
Normal file
44
3rdparty/opencv-4.5.4/modules/core/misc/java/test/DMatchTest.java
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import org.opencv.core.DMatch;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class DMatchTest extends TestCase {
|
||||
public void testDMatch() {
|
||||
new DMatch();
|
||||
}
|
||||
|
||||
public void testDMatchIntIntFloat() {
|
||||
DMatch dm1 = new DMatch(1, 4, 4.0f);
|
||||
|
||||
assertEquals(1, dm1.queryIdx);
|
||||
assertEquals(4, dm1.trainIdx);
|
||||
assertEquals(4.0f, dm1.distance);
|
||||
}
|
||||
|
||||
public void testDMatchIntIntIntFloat() {
|
||||
DMatch dm2 = new DMatch(2, 6, -1, 8.0f);
|
||||
|
||||
assertEquals(2, dm2.queryIdx);
|
||||
assertEquals(6, dm2.trainIdx);
|
||||
assertEquals(-1, dm2.imgIdx);
|
||||
assertEquals(8.0f, dm2.distance);
|
||||
}
|
||||
|
||||
public void testLessThan() {
|
||||
DMatch dm1 = new DMatch(1, 4, 4.0f);
|
||||
DMatch dm2 = new DMatch(2, 6, -1, 8.0f);
|
||||
assertTrue(dm1.lessThan(dm2));
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
DMatch dm2 = new DMatch(2, 6, -1, 8.0f);
|
||||
|
||||
String actual = dm2.toString();
|
||||
|
||||
String expected = "DMatch [queryIdx=2, trainIdx=6, imgIdx=-1, distance=8.0]";
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
}
|
71
3rdparty/opencv-4.5.4/modules/core/misc/java/test/KeyPointTest.java
vendored
Normal file
71
3rdparty/opencv-4.5.4/modules/core/misc/java/test/KeyPointTest.java
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.core.KeyPoint;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class KeyPointTest extends OpenCVTestCase {
|
||||
|
||||
private float angle;
|
||||
private int classId;
|
||||
private KeyPoint keyPoint;
|
||||
private int octave;
|
||||
private float response;
|
||||
private float size;
|
||||
private float x;
|
||||
private float y;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
keyPoint = null;
|
||||
x = 1.0f;
|
||||
y = 2.0f;
|
||||
size = 3.0f;
|
||||
angle = 30.0f;
|
||||
response = 2.0f;
|
||||
octave = 1;
|
||||
classId = 1;
|
||||
}
|
||||
|
||||
public void testKeyPoint() {
|
||||
keyPoint = new KeyPoint();
|
||||
assertPointEquals(new Point(0, 0), keyPoint.pt, EPS);
|
||||
}
|
||||
|
||||
public void testKeyPointFloatFloatFloat() {
|
||||
keyPoint = new KeyPoint(x, y, size);
|
||||
assertPointEquals(new Point(1, 2), keyPoint.pt, EPS);
|
||||
}
|
||||
|
||||
public void testKeyPointFloatFloatFloatFloat() {
|
||||
keyPoint = new KeyPoint(x, y, size, 10.0f);
|
||||
assertEquals(10.0f, keyPoint.angle);
|
||||
}
|
||||
|
||||
public void testKeyPointFloatFloatFloatFloatFloat() {
|
||||
keyPoint = new KeyPoint(x, y, size, 1.0f, 1.0f);
|
||||
assertEquals(1.0f, keyPoint.response);
|
||||
}
|
||||
|
||||
public void testKeyPointFloatFloatFloatFloatFloatInt() {
|
||||
keyPoint = new KeyPoint(x, y, size, 1.0f, 1.0f, 1);
|
||||
assertEquals(1, keyPoint.octave);
|
||||
}
|
||||
|
||||
public void testKeyPointFloatFloatFloatFloatFloatIntInt() {
|
||||
keyPoint = new KeyPoint(x, y, size, 1.0f, 1.0f, 1, 1);
|
||||
assertEquals(1, keyPoint.class_id);
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
keyPoint = new KeyPoint(x, y, size, angle, response, octave, classId);
|
||||
|
||||
String actual = keyPoint.toString();
|
||||
|
||||
String expected = "KeyPoint [pt={1.0, 2.0}, size=3.0, angle=30.0, response=2.0, octave=1, class_id=1]";
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
}
|
70
3rdparty/opencv-4.5.4/modules/core/misc/java/test/MatOfByteTest.java
vendored
Normal file
70
3rdparty/opencv-4.5.4/modules/core/misc/java/test/MatOfByteTest.java
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.CvException;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.MatOfByte;
|
||||
import org.opencv.core.MatOfDouble;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
import org.opencv.imgcodecs.Imgcodecs;
|
||||
|
||||
public class MatOfByteTest extends OpenCVTestCase {
|
||||
|
||||
public void testMatOfSubByteArray() {
|
||||
byte[] inputBytes = { 1,2,3,4,5 };
|
||||
|
||||
MatOfByte m0 = new MatOfByte(inputBytes);
|
||||
MatOfByte m1 = new MatOfByte(0, inputBytes.length, inputBytes);
|
||||
MatOfByte m2 = new MatOfByte(1, inputBytes.length - 2, inputBytes);
|
||||
|
||||
assertEquals(5.0, m0.size().height);
|
||||
assertEquals(1.0, m0.size().width);
|
||||
|
||||
assertEquals(m0.get(0, 0)[0], m1.get(0, 0)[0]);
|
||||
assertEquals(m0.get((int) m0.size().height - 1, 0)[0], m1.get((int) m1.size().height - 1, 0)[0]);
|
||||
|
||||
assertEquals(3.0, m2.size().height);
|
||||
assertEquals(1.0, m2.size().width);
|
||||
|
||||
assertEquals(2.0, m2.get(0, 0)[0]);
|
||||
assertEquals(3.0, m2.get(1, 0)[0]);
|
||||
assertEquals(4.0, m2.get(2, 0)[0]);
|
||||
}
|
||||
|
||||
|
||||
public void testMatOfSubByteArray_BadArg() {
|
||||
byte[] inputBytes = { 1,2,3,4,5 };
|
||||
|
||||
try {
|
||||
MatOfByte m1 = new MatOfByte(-1, inputBytes.length, inputBytes);
|
||||
fail("Missing check: offset < 0");
|
||||
} catch (IllegalArgumentException e) {
|
||||
// pass
|
||||
}
|
||||
|
||||
try {
|
||||
MatOfByte m1 = new MatOfByte(0, inputBytes.length, null);
|
||||
fail("Missing check: NullPointerException");
|
||||
} catch (NullPointerException e) {
|
||||
// pass
|
||||
}
|
||||
|
||||
try {
|
||||
MatOfByte m1 = new MatOfByte(0, -1, inputBytes);
|
||||
fail("Missing check: length < 0");
|
||||
} catch (IllegalArgumentException e) {
|
||||
// pass
|
||||
}
|
||||
|
||||
try {
|
||||
MatOfByte m1 = new MatOfByte(1, inputBytes.length, inputBytes);
|
||||
fail("Missing check: buffer bounds");
|
||||
} catch (IllegalArgumentException e) {
|
||||
// pass
|
||||
}
|
||||
}
|
||||
|
||||
}
|
1325
3rdparty/opencv-4.5.4/modules/core/misc/java/test/MatTest.java
vendored
Normal file
1325
3rdparty/opencv-4.5.4/modules/core/misc/java/test/MatTest.java
vendored
Normal file
File diff suppressed because it is too large
Load Diff
107
3rdparty/opencv-4.5.4/modules/core/misc/java/test/Point3Test.java
vendored
Normal file
107
3rdparty/opencv-4.5.4/modules/core/misc/java/test/Point3Test.java
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.core.Point3;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class Point3Test extends OpenCVTestCase {
|
||||
|
||||
private Point3 p1;
|
||||
private Point3 p2;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
p1 = new Point3(2, 2, 2);
|
||||
p2 = new Point3(1, 1, 1);
|
||||
}
|
||||
|
||||
public void testClone() {
|
||||
Point3 truth = new Point3(1, 1, 1);
|
||||
p1 = truth.clone();
|
||||
assertEquals(truth, p1);
|
||||
}
|
||||
|
||||
public void testCross() {
|
||||
Point3 dstPoint = p1.cross(p2);
|
||||
Point3 truth = new Point3(0, 0, 0);
|
||||
assertEquals(truth, dstPoint);
|
||||
}
|
||||
|
||||
public void testDot() {
|
||||
double result = p1.dot(p2);
|
||||
assertEquals(6.0, result);
|
||||
}
|
||||
|
||||
public void testEqualsObject() {
|
||||
boolean flag = p1.equals(p1);
|
||||
assertTrue(flag);
|
||||
|
||||
flag = p1.equals(p2);
|
||||
assertFalse(flag);
|
||||
}
|
||||
|
||||
public void testHashCode() {
|
||||
assertEquals(p1.hashCode(), p1.hashCode());
|
||||
}
|
||||
|
||||
public void testPoint3() {
|
||||
p1 = new Point3();
|
||||
|
||||
assertNotNull(p1);
|
||||
assertTrue(0 == p1.x);
|
||||
assertTrue(0 == p1.y);
|
||||
assertTrue(0 == p1.z);
|
||||
}
|
||||
|
||||
public void testPoint3DoubleArray() {
|
||||
double[] vals = { 1, 2, 3 };
|
||||
p1 = new Point3(vals);
|
||||
|
||||
assertTrue(1 == p1.x);
|
||||
assertTrue(2 == p1.y);
|
||||
assertTrue(3 == p1.z);
|
||||
}
|
||||
|
||||
public void testPoint3DoubleDoubleDouble() {
|
||||
p1 = new Point3(1, 2, 3);
|
||||
|
||||
assertEquals(1., p1.x);
|
||||
assertEquals(2., p1.y);
|
||||
assertEquals(3., p1.z);
|
||||
}
|
||||
|
||||
public void testPoint3Point() {
|
||||
Point p = new Point(2, 3);
|
||||
p1 = new Point3(p);
|
||||
|
||||
assertEquals(2., p1.x);
|
||||
assertEquals(3., p1.y);
|
||||
assertEquals(0., p1.z);
|
||||
}
|
||||
|
||||
public void testSet() {
|
||||
double[] vals1 = {};
|
||||
p1.set(vals1);
|
||||
|
||||
assertEquals(0., p1.x);
|
||||
assertEquals(0., p1.y);
|
||||
assertEquals(0., p1.z);
|
||||
|
||||
double[] vals2 = { 3, 6, 10 };
|
||||
p1.set(vals2);
|
||||
|
||||
assertEquals(3., p1.x);
|
||||
assertEquals(6., p1.y);
|
||||
assertEquals(10., p1.z);
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
String actual = p1.toString();
|
||||
String expected = "{2.0, 2.0, 2.0}";
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
|
||||
}
|
93
3rdparty/opencv-4.5.4/modules/core/misc/java/test/PointTest.java
vendored
Normal file
93
3rdparty/opencv-4.5.4/modules/core/misc/java/test/PointTest.java
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.core.Rect;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class PointTest extends OpenCVTestCase {
|
||||
|
||||
private Point p1;
|
||||
private Point p2;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
p1 = new Point(2, 2);
|
||||
p2 = new Point(1, 1);
|
||||
}
|
||||
|
||||
public void testClone() {
|
||||
Point truth = new Point(1, 1);
|
||||
Point dstPoint = truth.clone();
|
||||
assertEquals(truth, dstPoint);
|
||||
}
|
||||
|
||||
public void testDot() {
|
||||
double result = p1.dot(p2);
|
||||
assertEquals(4.0, result);
|
||||
}
|
||||
|
||||
public void testEqualsObject() {
|
||||
boolean flag = p1.equals(p1);
|
||||
assertTrue(flag);
|
||||
|
||||
flag = p1.equals(p2);
|
||||
assertFalse(flag);
|
||||
}
|
||||
|
||||
public void testHashCode() {
|
||||
assertEquals(p1.hashCode(), p1.hashCode());
|
||||
}
|
||||
|
||||
public void testInside() {
|
||||
Rect rect = new Rect(0, 0, 5, 3);
|
||||
assertTrue(p1.inside(rect));
|
||||
|
||||
Point p2 = new Point(3, 3);
|
||||
assertFalse(p2.inside(rect));
|
||||
}
|
||||
|
||||
public void testPoint() {
|
||||
Point p = new Point();
|
||||
|
||||
assertNotNull(p);
|
||||
assertEquals(0.0, p.x);
|
||||
assertEquals(0.0, p.y);
|
||||
}
|
||||
|
||||
public void testPointDoubleArray() {
|
||||
double[] vals = { 2, 4 };
|
||||
Point p = new Point(vals);
|
||||
|
||||
assertEquals(2.0, p.x);
|
||||
assertEquals(4.0, p.y);
|
||||
}
|
||||
|
||||
public void testPointDoubleDouble() {
|
||||
p1 = new Point(7, 5);
|
||||
|
||||
assertNotNull(p1);
|
||||
assertEquals(7.0, p1.x);
|
||||
assertEquals(5.0, p1.y);
|
||||
}
|
||||
|
||||
public void testSet() {
|
||||
double[] vals1 = {};
|
||||
p1.set(vals1);
|
||||
assertEquals(0.0, p1.x);
|
||||
assertEquals(0.0, p1.y);
|
||||
|
||||
double[] vals2 = { 6, 10 };
|
||||
p2.set(vals2);
|
||||
assertEquals(6.0, p2.x);
|
||||
assertEquals(10.0, p2.y);
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
String actual = p1.toString();
|
||||
String expected = "{2.0, 2.0}";
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
}
|
113
3rdparty/opencv-4.5.4/modules/core/misc/java/test/RangeTest.java
vendored
Normal file
113
3rdparty/opencv-4.5.4/modules/core/misc/java/test/RangeTest.java
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import org.opencv.core.Range;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class RangeTest extends OpenCVTestCase {
|
||||
|
||||
Range r1;
|
||||
Range r2;
|
||||
Range range;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
range = new Range();
|
||||
r1 = new Range(1, 11);
|
||||
r2 = new Range(1, 1);
|
||||
}
|
||||
|
||||
public void testAll() {
|
||||
range = Range.all();
|
||||
assertEquals(Integer.MIN_VALUE, range.start);
|
||||
assertEquals(Integer.MAX_VALUE, range.end);
|
||||
}
|
||||
|
||||
public void testClone() {
|
||||
Range dstRange = new Range();
|
||||
dstRange = r1.clone();
|
||||
assertEquals(r1, dstRange);
|
||||
}
|
||||
|
||||
public void testEmpty() {
|
||||
boolean flag;
|
||||
|
||||
flag = r1.empty();
|
||||
assertFalse(flag);
|
||||
|
||||
flag = r2.empty();
|
||||
assertTrue(flag);
|
||||
}
|
||||
|
||||
public void testEqualsObject() {
|
||||
assertFalse(r2.equals(r1));
|
||||
|
||||
range = r1.clone();
|
||||
assertTrue(r1.equals(range));
|
||||
}
|
||||
|
||||
public void testHashCode() {
|
||||
assertEquals(r1.hashCode(), r1.hashCode());
|
||||
}
|
||||
|
||||
public void testIntersection() {
|
||||
range = r1.intersection(r2);
|
||||
assertEquals(r2, range);
|
||||
}
|
||||
|
||||
public void testRange() {
|
||||
range = new Range();
|
||||
|
||||
assertNotNull(range);
|
||||
assertEquals(0, range.start);
|
||||
assertEquals(0, range.end);
|
||||
}
|
||||
|
||||
public void testRangeDoubleArray() {
|
||||
double[] vals = { 2, 4 };
|
||||
Range r = new Range(vals);
|
||||
|
||||
assertTrue(2 == r.start);
|
||||
assertTrue(4 == r.end);
|
||||
}
|
||||
|
||||
public void testRangeIntInt() {
|
||||
r1 = new Range(12, 13);
|
||||
|
||||
assertNotNull(r1);
|
||||
assertEquals(12, r1.start);
|
||||
assertEquals(13, r1.end);
|
||||
}
|
||||
|
||||
public void testSet() {
|
||||
double[] vals1 = {};
|
||||
r1.set(vals1);
|
||||
assertEquals(0, r1.start);
|
||||
assertEquals(0, r1.end);
|
||||
|
||||
double[] vals2 = { 6, 10 };
|
||||
r2.set(vals2);
|
||||
assertEquals(6, r2.start);
|
||||
assertEquals(10, r2.end);
|
||||
}
|
||||
|
||||
public void testShift() {
|
||||
int delta = 1;
|
||||
range = range.shift(delta);
|
||||
assertEquals(r2, range);
|
||||
}
|
||||
|
||||
public void testSize() {
|
||||
assertEquals(10, r1.size());
|
||||
|
||||
assertEquals(0, r2.size());
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
String actual = r1.toString();
|
||||
String expected = "[1, 11)";
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
}
|
163
3rdparty/opencv-4.5.4/modules/core/misc/java/test/RectTest.java
vendored
Normal file
163
3rdparty/opencv-4.5.4/modules/core/misc/java/test/RectTest.java
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.core.Rect;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class RectTest extends OpenCVTestCase {
|
||||
|
||||
private Rect r;
|
||||
private Rect rect;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
r = new Rect();
|
||||
rect = new Rect(0, 0, 10, 10);
|
||||
}
|
||||
|
||||
public void testArea() {
|
||||
double area;
|
||||
area = rect.area();
|
||||
assertEquals(100.0, area);
|
||||
}
|
||||
|
||||
public void testBr() {
|
||||
Point p_br = new Point();
|
||||
p_br = rect.br();
|
||||
Point truth = new Point(10, 10);
|
||||
assertEquals(truth, p_br);
|
||||
}
|
||||
|
||||
public void testClone() {
|
||||
r = rect.clone();
|
||||
assertEquals(rect, r);
|
||||
}
|
||||
|
||||
public void testContains() {
|
||||
Rect rect = new Rect(0, 0, 10, 10);
|
||||
|
||||
Point p_inner = new Point(5, 5);
|
||||
Point p_outer = new Point(5, 55);
|
||||
Point p_bl = new Point(0, 0);
|
||||
Point p_br = new Point(10, 0);
|
||||
Point p_tl = new Point(0, 10);
|
||||
Point p_tr = new Point(10, 10);
|
||||
|
||||
assertTrue(rect.contains(p_inner));
|
||||
assertTrue(rect.contains(p_bl));
|
||||
|
||||
assertFalse(rect.contains(p_outer));
|
||||
assertFalse(rect.contains(p_br));
|
||||
assertFalse(rect.contains(p_tl));
|
||||
assertFalse(rect.contains(p_tr));
|
||||
}
|
||||
|
||||
public void testEqualsObject() {
|
||||
boolean flag;
|
||||
flag = rect.equals(r);
|
||||
assertFalse(flag);
|
||||
|
||||
r = rect.clone();
|
||||
flag = rect.equals(r);
|
||||
assertTrue(flag);
|
||||
}
|
||||
|
||||
public void testHashCode() {
|
||||
assertEquals(rect.hashCode(), rect.hashCode());
|
||||
}
|
||||
|
||||
public void testRect() {
|
||||
r = new Rect();
|
||||
|
||||
assertEquals(0, r.x);
|
||||
assertEquals(0, r.y);
|
||||
assertEquals(0, r.width);
|
||||
assertEquals(0, r.height);
|
||||
}
|
||||
|
||||
public void testRectDoubleArray() {
|
||||
double[] vals = { 1, 3, 5, 2 };
|
||||
r = new Rect(vals);
|
||||
|
||||
assertEquals(1, r.x);
|
||||
assertEquals(3, r.y);
|
||||
assertEquals(5, r.width);
|
||||
assertEquals(2, r.height);
|
||||
}
|
||||
|
||||
public void testRectIntIntIntInt() {
|
||||
r = new Rect(1, 3, 5, 2);
|
||||
|
||||
assertNotNull(rect);
|
||||
assertEquals(0, rect.x);
|
||||
assertEquals(0, rect.y);
|
||||
assertEquals(10, rect.width);
|
||||
assertEquals(10, rect.height);
|
||||
}
|
||||
|
||||
public void testRectPointPoint() {
|
||||
Point p1 = new Point(4, 4);
|
||||
Point p2 = new Point(2, 3);
|
||||
|
||||
r = new Rect(p1, p2);
|
||||
assertNotNull(r);
|
||||
assertEquals(2, r.x);
|
||||
assertEquals(3, r.y);
|
||||
assertEquals(2, r.width);
|
||||
assertEquals(1, r.height);
|
||||
}
|
||||
|
||||
public void testRectPointSize() {
|
||||
Point p1 = new Point(4, 4);
|
||||
Size sz = new Size(3, 1);
|
||||
r = new Rect(p1, sz);
|
||||
|
||||
assertEquals(4, r.x);
|
||||
assertEquals(4, r.y);
|
||||
assertEquals(3, r.width);
|
||||
assertEquals(1, r.height);
|
||||
}
|
||||
|
||||
public void testSet() {
|
||||
double[] vals1 = {};
|
||||
Rect r1 = new Rect(vals1);
|
||||
|
||||
assertEquals(0, r1.x);
|
||||
assertEquals(0, r1.y);
|
||||
assertEquals(0, r1.width);
|
||||
assertEquals(0, r1.height);
|
||||
|
||||
double[] vals2 = { 2, 2, 10, 5 };
|
||||
r = new Rect(vals2);
|
||||
|
||||
assertEquals(2, r.x);
|
||||
assertEquals(2, r.y);
|
||||
assertEquals(10, r.width);
|
||||
assertEquals(5, r.height);
|
||||
}
|
||||
|
||||
public void testSize() {
|
||||
Size s1 = new Size(0, 0);
|
||||
assertEquals(s1, r.size());
|
||||
|
||||
Size s2 = new Size(10, 10);
|
||||
assertEquals(s2, rect.size());
|
||||
}
|
||||
|
||||
public void testTl() {
|
||||
Point p_tl = new Point();
|
||||
p_tl = rect.tl();
|
||||
Point truth = new Point(0, 0);
|
||||
assertEquals(truth, p_tl);
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
String actual = rect.toString();
|
||||
String expected = "{0, 0, 10x10}";
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
}
|
213
3rdparty/opencv-4.5.4/modules/core/misc/java/test/RotatedRectTest.java
vendored
Normal file
213
3rdparty/opencv-4.5.4/modules/core/misc/java/test/RotatedRectTest.java
vendored
Normal file
@ -0,0 +1,213 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.core.Rect;
|
||||
import org.opencv.core.RotatedRect;
|
||||
import org.opencv.core.MatOfRotatedRect;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class RotatedRectTest extends OpenCVTestCase {
|
||||
|
||||
private double angle;
|
||||
private Point center;
|
||||
private Size size;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
center = new Point(matSize / 2, matSize / 2);
|
||||
size = new Size(matSize / 4, matSize / 2);
|
||||
angle = 40;
|
||||
}
|
||||
|
||||
public void testBoundingRect() {
|
||||
size = new Size(matSize / 2, matSize / 2);
|
||||
assertEquals(size.height, size.width);
|
||||
double length = size.height;
|
||||
|
||||
angle = 45;
|
||||
RotatedRect rr = new RotatedRect(center, size, angle);
|
||||
|
||||
Rect r = rr.boundingRect();
|
||||
double halfDiagonal = length * Math.sqrt(2) / 2;
|
||||
|
||||
assertTrue((r.x == Math.floor(center.x - halfDiagonal)) && (r.y == Math.floor(center.y - halfDiagonal)));
|
||||
|
||||
assertTrue((r.br().x >= Math.ceil(center.x + halfDiagonal)) && (r.br().y >= Math.ceil(center.y + halfDiagonal)));
|
||||
|
||||
assertTrue((r.br().x - Math.ceil(center.x + halfDiagonal)) <= 1 && (r.br().y - Math.ceil(center.y + halfDiagonal)) <= 1);
|
||||
}
|
||||
|
||||
public void testClone() {
|
||||
RotatedRect rrect = new RotatedRect(center, size, angle);
|
||||
RotatedRect clone = rrect.clone();
|
||||
|
||||
assertNotNull(clone);
|
||||
assertTrue(rrect.center.equals(clone.center));
|
||||
assertTrue(rrect.size.equals(clone.size));
|
||||
assertTrue(rrect.angle == clone.angle);
|
||||
}
|
||||
|
||||
public void testEqualsObject() {
|
||||
Point center2 = new Point(matSize / 3, matSize / 1.5);
|
||||
Size size2 = new Size(matSize / 2, matSize / 4);
|
||||
double angle2 = 0;
|
||||
|
||||
RotatedRect rrect1 = new RotatedRect(center, size, angle);
|
||||
RotatedRect rrect2 = new RotatedRect(center2, size2, angle2);
|
||||
RotatedRect rrect3 = rrect1;
|
||||
RotatedRect clone1 = rrect1.clone();
|
||||
RotatedRect clone2 = rrect2.clone();
|
||||
|
||||
assertTrue(rrect1.equals(rrect3));
|
||||
assertFalse(rrect1.equals(rrect2));
|
||||
|
||||
assertTrue(rrect2.equals(clone2));
|
||||
clone2.angle = 10;
|
||||
assertFalse(rrect2.equals(clone2));
|
||||
|
||||
assertTrue(rrect1.equals(clone1));
|
||||
|
||||
clone1.center.x += 1;
|
||||
assertFalse(rrect1.equals(clone1));
|
||||
|
||||
clone1.center.x -= 1;
|
||||
assertTrue(rrect1.equals(clone1));
|
||||
|
||||
clone1.size.width += 1;
|
||||
assertFalse(rrect1.equals(clone1));
|
||||
|
||||
assertFalse(rrect1.equals(size));
|
||||
}
|
||||
|
||||
public void testHashCode() {
|
||||
RotatedRect rr = new RotatedRect(center, size, angle);
|
||||
assertEquals(rr.hashCode(), rr.hashCode());
|
||||
}
|
||||
|
||||
public void testPoints() {
|
||||
RotatedRect rrect = new RotatedRect(center, size, angle);
|
||||
|
||||
Point p[] = new Point[4];
|
||||
rrect.points(p);
|
||||
|
||||
boolean is_p0_irrational = (100 * p[0].x != (int) (100 * p[0].x)) && (100 * p[0].y != (int) (100 * p[0].y));
|
||||
boolean is_p1_irrational = (100 * p[1].x != (int) (100 * p[1].x)) && (100 * p[1].y != (int) (100 * p[1].y));
|
||||
boolean is_p2_irrational = (100 * p[2].x != (int) (100 * p[2].x)) && (100 * p[2].y != (int) (100 * p[2].y));
|
||||
boolean is_p3_irrational = (100 * p[3].x != (int) (100 * p[3].x)) && (100 * p[3].y != (int) (100 * p[3].y));
|
||||
|
||||
assertTrue(is_p0_irrational && is_p1_irrational && is_p2_irrational && is_p3_irrational);
|
||||
|
||||
assertTrue("Symmetric points 0 and 2",
|
||||
Math.abs((p[0].x + p[2].x) / 2 - center.x) + Math.abs((p[0].y + p[2].y) / 2 - center.y) < EPS);
|
||||
|
||||
assertTrue("Symmetric points 1 and 3",
|
||||
Math.abs((p[1].x + p[3].x) / 2 - center.x) + Math.abs((p[1].y + p[3].y) / 2 - center.y) < EPS);
|
||||
|
||||
assertTrue("Orthogonal vectors 01 and 12",
|
||||
Math.abs((p[1].x - p[0].x) * (p[2].x - p[1].x) +
|
||||
(p[1].y - p[0].y) * (p[2].y - p[1].y)) < EPS);
|
||||
|
||||
assertTrue("Orthogonal vectors 12 and 23",
|
||||
Math.abs((p[2].x - p[1].x) * (p[3].x - p[2].x) +
|
||||
(p[2].y - p[1].y) * (p[3].y - p[2].y)) < EPS);
|
||||
|
||||
assertTrue("Orthogonal vectors 23 and 30",
|
||||
Math.abs((p[3].x - p[2].x) * (p[0].x - p[3].x) +
|
||||
(p[3].y - p[2].y) * (p[0].y - p[3].y)) < EPS);
|
||||
|
||||
assertTrue("Orthogonal vectors 30 and 01",
|
||||
Math.abs((p[0].x - p[3].x) * (p[1].x - p[0].x) +
|
||||
(p[0].y - p[3].y) * (p[1].y - p[0].y)) < EPS);
|
||||
|
||||
assertTrue("Length of the vector 01",
|
||||
Math.abs((p[1].x - p[0].x) * (p[1].x - p[0].x) +
|
||||
(p[1].y - p[0].y) * (p[1].y - p[0].y) - size.height * size.height) < EPS);
|
||||
|
||||
assertTrue("Length of the vector 21",
|
||||
Math.abs((p[1].x - p[2].x) * (p[1].x - p[2].x) +
|
||||
(p[1].y - p[2].y) * (p[1].y - p[2].y) - size.width * size.width) < EPS);
|
||||
|
||||
assertTrue("Angle of the vector 21 with the axes", Math.abs((p[2].x - p[1].x) / size.width - Math.cos(angle * Math.PI / 180)) < EPS);
|
||||
}
|
||||
|
||||
public void testRotatedRect() {
|
||||
RotatedRect rr = new RotatedRect();
|
||||
|
||||
assertNotNull(rr);
|
||||
assertNotNull(rr.center);
|
||||
assertNotNull(rr.size);
|
||||
assertEquals(0.0, rr.angle);
|
||||
}
|
||||
|
||||
public void testRotatedRectDoubleArray() {
|
||||
double[] vals = { 1.5, 2.6, 3.7, 4.2, 5.1 };
|
||||
RotatedRect rr = new RotatedRect(vals);
|
||||
|
||||
assertNotNull(rr);
|
||||
assertEquals(1.5, rr.center.x);
|
||||
assertEquals(2.6, rr.center.y);
|
||||
assertEquals(3.7, rr.size.width);
|
||||
assertEquals(4.2, rr.size.height);
|
||||
assertEquals(5.1, rr.angle);
|
||||
}
|
||||
|
||||
public void testRotatedRectPointSizeDouble() {
|
||||
RotatedRect rr = new RotatedRect(center, size, 40);
|
||||
|
||||
assertNotNull(rr);
|
||||
assertNotNull(rr.center);
|
||||
assertNotNull(rr.size);
|
||||
assertEquals(40.0, rr.angle);
|
||||
}
|
||||
|
||||
public void testSet() {
|
||||
double[] vals1 = {};
|
||||
RotatedRect r1 = new RotatedRect(center, size, 40);
|
||||
|
||||
r1.set(vals1);
|
||||
|
||||
assertEquals(0., r1.angle);
|
||||
assertPointEquals(new Point(0, 0), r1.center, EPS);
|
||||
assertSizeEquals(new Size(0, 0), r1.size, EPS);
|
||||
|
||||
double[] vals2 = { 1, 2, 3, 4, 5 };
|
||||
RotatedRect r2 = new RotatedRect(center, size, 40);
|
||||
|
||||
r2.set(vals2);
|
||||
|
||||
assertEquals(5., r2.angle);
|
||||
assertPointEquals(new Point(1, 2), r2.center, EPS);
|
||||
assertSizeEquals(new Size(3, 4), r2.size, EPS);
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
String actual = new RotatedRect(new Point(1, 2), new Size(10, 12), 4.5).toString();
|
||||
String expected = "{ {1.0, 2.0} 10x12 * 4.5 }";
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
public void testMatOfRotatedRect() {
|
||||
RotatedRect a = new RotatedRect(new Point(1,2),new Size(3,4),5.678);
|
||||
RotatedRect b = new RotatedRect(new Point(9,8),new Size(7,6),5.432);
|
||||
MatOfRotatedRect m = new MatOfRotatedRect(a,b,a,b,a,b,a,b);
|
||||
assertEquals(m.rows(), 8);
|
||||
assertEquals(m.cols(), 1);
|
||||
assertEquals(m.type(), CvType.CV_32FC(5));
|
||||
RotatedRect[] arr = m.toArray();
|
||||
assertEquals(arr[2].angle, a.angle, EPS);
|
||||
assertEquals(arr[3].center.x, b.center.x);
|
||||
assertEquals(arr[3].size.width, b.size.width);
|
||||
List<RotatedRect> li = m.toList();
|
||||
assertEquals(li.size(), 8);
|
||||
RotatedRect rr = li.get(7);
|
||||
assertEquals(rr.angle, b.angle, EPS);
|
||||
assertEquals(rr.center.y, b.center.y);
|
||||
}
|
||||
}
|
110
3rdparty/opencv-4.5.4/modules/core/misc/java/test/ScalarTest.java
vendored
Normal file
110
3rdparty/opencv-4.5.4/modules/core/misc/java/test/ScalarTest.java
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import org.opencv.core.Scalar;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class ScalarTest extends OpenCVTestCase {
|
||||
|
||||
private Scalar dstScalar;
|
||||
private Scalar s1;
|
||||
private Scalar s2;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
s1 = new Scalar(1.0);
|
||||
s2 = Scalar.all(1.0);
|
||||
dstScalar = null;
|
||||
}
|
||||
|
||||
public void testAll() {
|
||||
dstScalar = Scalar.all(2.0);
|
||||
Scalar truth = new Scalar(2.0, 2.0, 2.0, 2.0);
|
||||
assertEquals(truth, dstScalar);
|
||||
}
|
||||
|
||||
public void testClone() {
|
||||
dstScalar = s2.clone();
|
||||
assertEquals(s2, dstScalar);
|
||||
}
|
||||
|
||||
public void testConj() {
|
||||
dstScalar = s2.conj();
|
||||
Scalar truth = new Scalar(1, -1, -1, -1);
|
||||
assertEquals(truth, dstScalar);
|
||||
}
|
||||
|
||||
public void testEqualsObject() {
|
||||
dstScalar = s2.clone();
|
||||
assertTrue(s2.equals(dstScalar));
|
||||
|
||||
assertFalse(s2.equals(s1));
|
||||
}
|
||||
|
||||
public void testHashCode() {
|
||||
assertEquals(s2.hashCode(), s2.hashCode());
|
||||
}
|
||||
|
||||
public void testIsReal() {
|
||||
assertTrue(s1.isReal());
|
||||
|
||||
assertFalse(s2.isReal());
|
||||
}
|
||||
|
||||
public void testMulScalar() {
|
||||
dstScalar = s2.mul(s1);
|
||||
assertEquals(s1, dstScalar);
|
||||
}
|
||||
|
||||
public void testMulScalarDouble() {
|
||||
double multiplier = 2.0;
|
||||
dstScalar = s2.mul(s1, multiplier);
|
||||
Scalar truth = new Scalar(2);
|
||||
assertEquals(truth, dstScalar);
|
||||
}
|
||||
|
||||
public void testScalarDouble() {
|
||||
Scalar truth = new Scalar(1);
|
||||
assertEquals(truth, s1);
|
||||
}
|
||||
|
||||
public void testScalarDoubleArray() {
|
||||
double[] vals = { 2.0, 4.0, 5.0, 3.0 };
|
||||
dstScalar = new Scalar(vals);
|
||||
|
||||
Scalar truth = new Scalar(2.0, 4.0, 5.0, 3.0);
|
||||
assertEquals(truth, dstScalar);
|
||||
}
|
||||
|
||||
public void testScalarDoubleDouble() {
|
||||
dstScalar = new Scalar(2, 5);
|
||||
Scalar truth = new Scalar(2.0, 5.0, 0.0, 0.0);
|
||||
assertEquals(truth, dstScalar);
|
||||
}
|
||||
|
||||
public void testScalarDoubleDoubleDouble() {
|
||||
dstScalar = new Scalar(2.0, 5.0, 5.0);
|
||||
Scalar truth = new Scalar(2.0, 5.0, 5.0, 0.0);
|
||||
assertEquals(truth, dstScalar);
|
||||
}
|
||||
|
||||
public void testScalarDoubleDoubleDoubleDouble() {
|
||||
dstScalar = new Scalar(2.0, 5.0, 5.0, 9.0);
|
||||
Scalar truth = new Scalar(2.0, 5.0, 5.0, 9.0);
|
||||
assertEquals(truth, dstScalar);
|
||||
}
|
||||
|
||||
public void testSet() {
|
||||
double[] vals = { 1.0, 1.0, 1.0, 1.0 };
|
||||
s1.set(vals);
|
||||
assertEquals(s2, s1);
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
String actual = s2.toString();
|
||||
String expected = "[1.0, 1.0, 1.0, 1.0]";
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
}
|
93
3rdparty/opencv-4.5.4/modules/core/misc/java/test/SizeTest.java
vendored
Normal file
93
3rdparty/opencv-4.5.4/modules/core/misc/java/test/SizeTest.java
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import org.opencv.core.Point;
|
||||
import org.opencv.core.Size;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class SizeTest extends OpenCVTestCase {
|
||||
|
||||
Size dstSize;
|
||||
Size sz1;
|
||||
Size sz2;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
sz1 = new Size(10.0, 10.0);
|
||||
sz2 = new Size(-1, -1);
|
||||
dstSize = null;
|
||||
}
|
||||
|
||||
public void testArea() {
|
||||
double area = sz1.area();
|
||||
assertEquals(100.0, area);
|
||||
}
|
||||
|
||||
public void testClone() {
|
||||
dstSize = sz1.clone();
|
||||
assertEquals(sz1, dstSize);
|
||||
}
|
||||
|
||||
public void testEqualsObject() {
|
||||
assertFalse(sz1.equals(sz2));
|
||||
|
||||
sz2 = sz1.clone();
|
||||
assertTrue(sz1.equals(sz2));
|
||||
}
|
||||
|
||||
public void testHashCode() {
|
||||
assertEquals(sz1.hashCode(), sz1.hashCode());
|
||||
}
|
||||
|
||||
public void testSet() {
|
||||
double[] vals1 = {};
|
||||
sz2.set(vals1);
|
||||
assertEquals(0., sz2.width);
|
||||
assertEquals(0., sz2.height);
|
||||
|
||||
double[] vals2 = { 9, 12 };
|
||||
sz1.set(vals2);
|
||||
assertEquals(9., sz1.width);
|
||||
assertEquals(12., sz1.height);
|
||||
}
|
||||
|
||||
public void testSize() {
|
||||
dstSize = new Size();
|
||||
|
||||
assertNotNull(dstSize);
|
||||
assertEquals(0., dstSize.width);
|
||||
assertEquals(0., dstSize.height);
|
||||
}
|
||||
|
||||
public void testSizeDoubleArray() {
|
||||
double[] vals = { 10, 20 };
|
||||
sz2 = new Size(vals);
|
||||
|
||||
assertEquals(10., sz2.width);
|
||||
assertEquals(20., sz2.height);
|
||||
}
|
||||
|
||||
public void testSizeDoubleDouble() {
|
||||
assertNotNull(sz1);
|
||||
|
||||
assertEquals(10.0, sz1.width);
|
||||
assertEquals(10.0, sz1.height);
|
||||
}
|
||||
|
||||
public void testSizePoint() {
|
||||
Point p = new Point(2, 4);
|
||||
sz1 = new Size(p);
|
||||
|
||||
assertNotNull(sz1);
|
||||
assertEquals(2.0, sz1.width);
|
||||
assertEquals(4.0, sz1.height);
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
String actual = sz1.toString();
|
||||
String expected = "10x10";
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
}
|
86
3rdparty/opencv-4.5.4/modules/core/misc/java/test/TermCriteriaTest.java
vendored
Normal file
86
3rdparty/opencv-4.5.4/modules/core/misc/java/test/TermCriteriaTest.java
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
package org.opencv.test.core;
|
||||
|
||||
import org.opencv.core.TermCriteria;
|
||||
import org.opencv.test.OpenCVTestCase;
|
||||
|
||||
public class TermCriteriaTest extends OpenCVTestCase {
|
||||
|
||||
private TermCriteria tc1;
|
||||
private TermCriteria tc2;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
tc1 = new TermCriteria();
|
||||
tc2 = new TermCriteria(2, 4, EPS);
|
||||
}
|
||||
|
||||
public void testClone() {
|
||||
tc1 = tc2.clone();
|
||||
assertEquals(tc2, tc1);
|
||||
}
|
||||
|
||||
public void testEqualsObject() {
|
||||
assertFalse(tc2.equals(tc1));
|
||||
|
||||
tc1 = tc2.clone();
|
||||
assertTrue(tc2.equals(tc1));
|
||||
}
|
||||
|
||||
public void testHashCode() {
|
||||
assertEquals(tc2.hashCode(), tc2.hashCode());
|
||||
}
|
||||
|
||||
public void testSet() {
|
||||
double[] vals1 = {};
|
||||
tc1.set(vals1);
|
||||
|
||||
assertEquals(0, tc1.type);
|
||||
assertEquals(0, tc1.maxCount);
|
||||
assertEquals(0.0, tc1.epsilon);
|
||||
|
||||
double[] vals2 = { 9, 8, 0.002 };
|
||||
tc2.set(vals2);
|
||||
|
||||
assertEquals(9, tc2.type);
|
||||
assertEquals(8, tc2.maxCount);
|
||||
assertEquals(0.002, tc2.epsilon);
|
||||
}
|
||||
|
||||
public void testTermCriteria() {
|
||||
tc1 = new TermCriteria();
|
||||
|
||||
assertNotNull(tc1);
|
||||
assertEquals(0, tc1.type);
|
||||
assertEquals(0, tc1.maxCount);
|
||||
assertEquals(0.0, tc1.epsilon);
|
||||
}
|
||||
|
||||
public void testTermCriteriaDoubleArray() {
|
||||
double[] vals = { 3, 2, 0.007 };
|
||||
tc1 = new TermCriteria(vals);
|
||||
|
||||
assertEquals(3, tc1.type);
|
||||
assertEquals(2, tc1.maxCount);
|
||||
assertEquals(0.007, tc1.epsilon);
|
||||
}
|
||||
|
||||
public void testTermCriteriaIntIntDouble() {
|
||||
tc1 = new TermCriteria(2, 4, EPS);
|
||||
|
||||
assertNotNull(tc2);
|
||||
assertEquals(2, tc2.type);
|
||||
assertEquals(4, tc2.maxCount);
|
||||
assertEquals(EPS, tc2.epsilon);
|
||||
}
|
||||
|
||||
public void testToString() {
|
||||
String actual = tc2.toString();
|
||||
double eps = EPS;
|
||||
String expected = "{ type: 2, maxCount: 4, epsilon: " + eps + "}";
|
||||
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user