├── .gitignore ├── FaceVerification.iml ├── FaceVerificationAndroid.iml ├── README.md ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── aidl │ └── org │ │ └── opencv │ │ └── engine │ │ └── OpenCVEngineInterface.aidl │ ├── java │ ├── com │ │ └── example │ │ │ └── zhao │ │ │ └── faceverification │ │ │ ├── activity │ │ │ └── MainActivity.java │ │ │ ├── context │ │ │ └── MyApplication.java │ │ │ └── face │ │ │ ├── FaceAlignment.java │ │ │ ├── FaceDetection.java │ │ │ ├── FacePredictor.java │ │ │ ├── FaceWrapper.java │ │ │ ├── ImageUtils.java │ │ │ └── MxNetUtils.java │ └── org │ │ ├── dmlc │ │ └── mxnet │ │ │ ├── MxnetException.java │ │ │ └── Predictor.java │ │ └── opencv │ │ ├── android │ │ ├── AsyncServiceHelper.java │ │ ├── BaseLoaderCallback.java │ │ ├── CameraBridgeViewBase.java │ │ ├── FpsMeter.java │ │ ├── InstallCallbackInterface.java │ │ ├── JavaCameraView.java │ │ ├── LoaderCallbackInterface.java │ │ ├── OpenCVLoader.java │ │ ├── StaticHelper.java │ │ └── Utils.java │ │ ├── calib3d │ │ ├── Calib3d.java │ │ ├── StereoBM.java │ │ ├── StereoMatcher.java │ │ └── StereoSGBM.java │ │ ├── core │ │ ├── Algorithm.java │ │ ├── Core.java │ │ ├── CvException.java │ │ ├── CvType.java │ │ ├── DMatch.java │ │ ├── KeyPoint.java │ │ ├── Mat.java │ │ ├── MatOfByte.java │ │ ├── MatOfDMatch.java │ │ ├── MatOfDouble.java │ │ ├── MatOfFloat.java │ │ ├── MatOfFloat4.java │ │ ├── MatOfFloat6.java │ │ ├── MatOfInt.java │ │ ├── MatOfInt4.java │ │ ├── MatOfKeyPoint.java │ │ ├── MatOfPoint.java │ │ ├── MatOfPoint2f.java │ │ ├── MatOfPoint3.java │ │ ├── MatOfPoint3f.java │ │ ├── MatOfRect.java │ │ ├── Point.java │ │ ├── Point3.java │ │ ├── Range.java │ │ ├── Rect.java │ │ ├── RotatedRect.java │ │ ├── Scalar.java │ │ ├── Size.java │ │ └── TermCriteria.java │ │ ├── features2d │ │ ├── DescriptorExtractor.java │ │ ├── DescriptorMatcher.java │ │ ├── FeatureDetector.java │ │ └── Features2d.java │ │ ├── imgcodecs │ │ └── Imgcodecs.java │ │ ├── imgproc │ │ ├── CLAHE.java │ │ ├── Imgproc.java │ │ ├── LineSegmentDetector.java │ │ ├── Moments.java │ │ └── Subdiv2D.java │ │ ├── ml │ │ ├── ANN_MLP.java │ │ ├── Boost.java │ │ ├── DTrees.java │ │ ├── EM.java │ │ ├── KNearest.java │ │ ├── LogisticRegression.java │ │ ├── Ml.java │ │ ├── NormalBayesClassifier.java │ │ ├── RTrees.java │ │ ├── SVM.java │ │ ├── StatModel.java │ │ └── TrainData.java │ │ ├── objdetect │ │ ├── BaseCascadeClassifier.java │ │ ├── CascadeClassifier.java │ │ ├── HOGDescriptor.java │ │ └── Objdetect.java │ │ ├── photo │ │ ├── AlignExposures.java │ │ ├── AlignMTB.java │ │ ├── CalibrateCRF.java │ │ ├── CalibrateDebevec.java │ │ ├── CalibrateRobertson.java │ │ ├── MergeDebevec.java │ │ ├── MergeExposures.java │ │ ├── MergeMertens.java │ │ ├── MergeRobertson.java │ │ ├── Photo.java │ │ ├── Tonemap.java │ │ ├── TonemapDrago.java │ │ ├── TonemapDurand.java │ │ ├── TonemapMantiuk.java │ │ └── TonemapReinhard.java │ │ ├── utils │ │ └── Converters.java │ │ ├── video │ │ ├── BackgroundSubtractor.java │ │ ├── BackgroundSubtractorKNN.java │ │ ├── BackgroundSubtractorMOG2.java │ │ ├── DenseOpticalFlow.java │ │ ├── DualTVL1OpticalFlow.java │ │ ├── KalmanFilter.java │ │ └── Video.java │ │ └── videoio │ │ ├── VideoCapture.java │ │ ├── VideoWriter.java │ │ └── Videoio.java │ ├── jniLibs │ └── armeabi │ │ ├── libmxnet_predict.so │ │ └── libopencv_java3.so │ └── res │ ├── layout │ └── activity_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── mipmap-xxxhdpi │ └── ic_launcher.png │ ├── raw │ ├── haarcascade_frontalface_alt2.xml │ ├── lbpcascade_frontalface.xml │ ├── lightened_cnn_android_params │ ├── lightened_cnn_android_symbol.json │ ├── mean.txt │ ├── std.txt │ ├── vanilla_cnn_android_params │ └── vanilla_cnn_android_symbol.json │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | 28 | # Android Studio Navigation editor temp files 29 | .navigation/ 30 | 31 | # Android Studio captures folder 32 | captures/ 33 | 34 | .idea/ 35 | 36 | app/src/main/res/drawable/ 37 | -------------------------------------------------------------------------------- /FaceVerification.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /FaceVerificationAndroid.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Face Verification on Android 2 | 3 | Face verification with mxnet on android 4 | 5 | ## Face Detection 6 | 7 | OpenCV has an in-built Viola-Jones face detector which is used here to detect faces. 8 | 9 | ## Face Verification 10 | 11 | I use pre-trained LightenedCNN as feature extractor. 12 | 13 | ![arch](http://img.blog.csdn.net/20161112165845008) 14 | 15 | For more information please read the original paper 16 | 17 | >https://arxiv.org/abs/1511.02683 18 | 19 | My notes about this paper: [Lightened CNN](http://blog.csdn.net/tinyzhao/article/details/53127870) 20 | 21 | The similarity metric is cosine similarity. The threshold should be about 0.5 ,and it should be adjusted according to specific applications. 22 | 23 | ## Face Alignment 24 | 25 | I use VanillaCNN to detect facial landmarks. This step is crucial for high accuracy. 26 | 27 | The paper can be found below 28 | 29 | >http://www.openu.ac.il/home/hassner/projects/tcnn_landmarks/ 30 | 31 | My notes about this paper: [VanillaCNN](http://blog.csdn.net/tinyzhao/article/details/53559373) 32 | 33 | The original implementation is based on Caffe, and I have turned it into MXNet model.You can get more details from below: 34 | 35 | >https://github.com/flyingzhao/mxnet_VanillaCNN 36 | 37 | The face is aligned by three landmarks including two inter-ocular points and one mid-mouth point. Affine transformation is applied with these three points. 38 | 39 | ## MXNet 40 | 41 | [MXNet](http://mxnet.io/) is a great deep learning framework and can be used on Android efficiently and flexibly. 42 | 43 | I have compiled mxnet for android with ndk-r13b. You can also refer to my blog for more details. 44 | 45 | >http://blog.csdn.net/tinyzhao/article/details/53288102 46 | 47 | You can also download compiled libmxnet_predict.so [here](https://github.com/flyingzhao/FaceVerificationAndroid/blob/master/app/src/main/jniLibs/armeabi/libmxnet_predict.so) 48 | 49 | ## Result 50 | 51 | I test on my Xiaomi 4C (Snapdragon 808) and I get about 1.5s per image. 52 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "24.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.example.zhao.faceverification" 9 | minSdkVersion 19 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.4.0' 26 | } 27 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/aidl/org/opencv/engine/OpenCVEngineInterface.aidl: -------------------------------------------------------------------------------- 1 | package org.opencv.engine; 2 | 3 | /** 4 | * Class provides a Java interface for OpenCV Engine Service. It's synchronous with native OpenCVEngine class. 5 | */ 6 | interface OpenCVEngineInterface 7 | { 8 | /** 9 | * @return Returns service version. 10 | */ 11 | int getEngineVersion(); 12 | 13 | /** 14 | * Finds an installed OpenCV library. 15 | * @param OpenCV version. 16 | * @return Returns path to OpenCV native libs or an empty string if OpenCV can not be found. 17 | */ 18 | String getLibPathByVersion(String version); 19 | 20 | /** 21 | * Tries to install defined version of OpenCV from Google Play Market. 22 | * @param OpenCV version. 23 | * @return Returns true if installation was successful or OpenCV package has been already installed. 24 | */ 25 | boolean installVersion(String version); 26 | 27 | /** 28 | * Returns list of libraries in loading order, separated by semicolon. 29 | * @param OpenCV version. 30 | * @return Returns names of OpenCV libraries, separated by semicolon. 31 | */ 32 | String getLibraryList(String version); 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/zhao/faceverification/context/MyApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.zhao.faceverification.context; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | import org.opencv.android.OpenCVLoader; 7 | 8 | /** 9 | * Created by zhao on 2016/11/24. 10 | */ 11 | public class MyApplication extends Application { 12 | public static Context context; 13 | 14 | @Override 15 | public void onCreate() { 16 | super.onCreate(); 17 | OpenCVLoader.initDebug(); 18 | context = getApplicationContext(); 19 | } 20 | 21 | public static Context getContext() { 22 | return context; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/zhao/faceverification/face/FaceAlignment.java: -------------------------------------------------------------------------------- 1 | package com.example.zhao.faceverification.face; 2 | 3 | import android.content.Context; 4 | 5 | import com.example.zhao.faceverification.R; 6 | import com.example.zhao.faceverification.context.MyApplication; 7 | 8 | import org.dmlc.mxnet.Predictor; 9 | 10 | import java.io.ByteArrayOutputStream; 11 | import java.io.IOException; 12 | import java.io.InputStream; 13 | 14 | /** 15 | * Created by zhao on 2016/12/11. 16 | */ 17 | public class FaceAlignment { 18 | private static Predictor align; 19 | public static byte[] symbol=null; 20 | public static byte[] params=null; 21 | 22 | static{ 23 | symbol = readRawFile(MyApplication.getContext(), R.raw.vanilla_cnn_android_symbol); 24 | params = readRawFile(MyApplication.getContext(), R.raw.vanilla_cnn_android_params); 25 | } 26 | public static Predictor getPredictor() { 27 | 28 | Predictor.Device device = new Predictor.Device(Predictor.Device.Type.CPU, 0); 29 | final int[] shape = {1,3, 40,40}; 30 | String key = "data"; 31 | 32 | Predictor.InputNode node = new Predictor.InputNode(key, shape); 33 | 34 | align = new Predictor(symbol, params, device, new Predictor.InputNode[]{node}); 35 | 36 | return align; 37 | } 38 | 39 | public static byte[] readRawFile(Context ctx, int resId) 40 | { 41 | ByteArrayOutputStream outputStream=new ByteArrayOutputStream(); 42 | int size = 0; 43 | byte[] buffer = new byte[1024]; 44 | try (InputStream ins = ctx.getResources().openRawResource(resId)) { 45 | while((size=ins.read(buffer,0,1024))>=0){ 46 | outputStream.write(buffer,0,size); 47 | } 48 | } catch (IOException e) { 49 | e.printStackTrace(); 50 | } 51 | return outputStream.toByteArray(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/zhao/faceverification/face/FaceDetection.java: -------------------------------------------------------------------------------- 1 | package com.example.zhao.faceverification.face; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.util.Log; 6 | 7 | import com.example.zhao.faceverification.R; 8 | import com.example.zhao.faceverification.context.MyApplication; 9 | 10 | import org.opencv.android.Utils; 11 | import org.opencv.core.Mat; 12 | import org.opencv.core.MatOfRect; 13 | import org.opencv.core.Rect; 14 | import org.opencv.core.Size; 15 | import org.opencv.imgproc.Imgproc; 16 | import org.opencv.objdetect.CascadeClassifier; 17 | 18 | import java.io.File; 19 | import java.io.FileOutputStream; 20 | import java.io.IOException; 21 | import java.io.InputStream; 22 | 23 | /** 24 | * Face detection with OpenCV and Android API 25 | * 26 | * @author zhao 27 | */ 28 | public class FaceDetection { 29 | public static CascadeClassifier mCascadeClassifier = null; 30 | public static File mCascadeFile; 31 | 32 | static { 33 | // OpenCVLoader.initDebug(); 34 | try { 35 | // load cascade file from application resources 36 | InputStream is = MyApplication.getContext().getResources().openRawResource(R.raw.haarcascade_frontalface_alt2); 37 | File cascadeDir = MyApplication.getContext().getDir("cascade", Context.MODE_PRIVATE); 38 | mCascadeFile = new File(cascadeDir, "lbpcascade_frontalface.xml"); 39 | FileOutputStream os = new FileOutputStream(mCascadeFile); 40 | 41 | byte[] buffer = new byte[4096]; 42 | int bytesRead; 43 | while ((bytesRead = is.read(buffer)) != -1) { 44 | os.write(buffer, 0, bytesRead); 45 | } 46 | is.close(); 47 | os.close(); 48 | 49 | mCascadeClassifier = new CascadeClassifier(mCascadeFile.getAbsolutePath()); 50 | if (mCascadeClassifier.empty()) { 51 | Log.e("main", "Failed to load cascade classifier"); 52 | mCascadeClassifier = null; 53 | } else 54 | Log.i("main", "Loaded cascade classifier from " + mCascadeFile.getAbsolutePath()); 55 | 56 | } catch (IOException e) { 57 | e.printStackTrace(); 58 | Log.e("main", "Failed to load cascade. Exception thrown: " + e); 59 | } 60 | } 61 | 62 | /** 63 | * Face detection with OpenCV 64 | * 65 | * @author zhao 66 | */ 67 | public static FaceWrapper faceDetectWithOpenCV(Bitmap image) { 68 | long t = System.currentTimeMillis(); 69 | Mat rgbMat = new Mat(); 70 | Mat grayMat = new Mat(); 71 | Utils.bitmapToMat(image, rgbMat); 72 | // Imgproc.resize(rgbMat,rgbMat,new Size(640,480)); 73 | Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGBA2GRAY); 74 | 75 | if (mCascadeClassifier.empty()) { 76 | Log.d("main", "Cascade can not loaded"); 77 | } 78 | 79 | MatOfRect faces = new MatOfRect(); 80 | 81 | Imgproc.equalizeHist(grayMat, grayMat); 82 | mCascadeClassifier.detectMultiScale(grayMat, faces, 1.1, 2, 2, new Size(100, 100), new Size(400, 400)); 83 | Rect[] rectFaces = faces.toArray(); 84 | Log.d("detection time", String.valueOf(System.currentTimeMillis() - t)); 85 | Log.d("live", "OpenCV faces " + rectFaces.length); 86 | if (rectFaces.length > 0) { 87 | Log.d("live", "检测到人脸"); 88 | Rect maxRect = findMaxRect(rectFaces); 89 | Mat faceMat = new Mat(rgbMat, maxRect); 90 | Mat xmat = new Mat(); 91 | Imgproc.resize(faceMat, xmat, new Size(128, 128)); 92 | Bitmap m = Bitmap.createBitmap(xmat.cols(), xmat.rows(), Bitmap.Config.ARGB_8888); 93 | Utils.matToBitmap(xmat, m); 94 | FaceWrapper faceWrapper = new FaceWrapper(m, maxRect); 95 | return faceWrapper; 96 | } else { 97 | Log.d("live", "没有检测到人脸"); 98 | return null; 99 | } 100 | 101 | } 102 | 103 | public static Rect findMaxRect(Rect[] rects) { 104 | Rect maxRect = rects[0]; 105 | for (int i = 0; i < rects.length; i++) { 106 | if (rects[i].height * rects[i].width > maxRect.height * maxRect.width) { 107 | maxRect = rects[i]; 108 | } 109 | } 110 | return maxRect; 111 | } 112 | 113 | } 114 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/zhao/faceverification/face/FacePredictor.java: -------------------------------------------------------------------------------- 1 | package com.example.zhao.faceverification.face; 2 | 3 | import android.content.Context; 4 | 5 | import com.example.zhao.faceverification.R; 6 | import com.example.zhao.faceverification.context.MyApplication; 7 | 8 | import org.dmlc.mxnet.Predictor; 9 | 10 | import java.io.ByteArrayOutputStream; 11 | import java.io.IOException; 12 | import java.io.InputStream; 13 | 14 | /** 15 | * Created by zhao on 2016/11/24. 16 | */ 17 | public class FacePredictor { 18 | 19 | private static Predictor predictor; 20 | public static byte[] symbol=null; 21 | public static byte[] params=null; 22 | 23 | static{ 24 | symbol = readRawFile(MyApplication.getContext(), R.raw.lightened_cnn_android_symbol); 25 | params = readRawFile(MyApplication.getContext(), R.raw.lightened_cnn_android_params); 26 | } 27 | public static Predictor getPredictor() { 28 | 29 | Predictor.Device device = new Predictor.Device(Predictor.Device.Type.CPU, 0); 30 | final int[] shape = {1, 1,128, 128}; 31 | String key = "data"; 32 | 33 | Predictor.InputNode node = new Predictor.InputNode(key, shape); 34 | 35 | predictor = new Predictor(symbol, params, device, new Predictor.InputNode[]{node}); 36 | 37 | return predictor; 38 | } 39 | 40 | public static byte[] readRawFile(Context ctx, int resId) 41 | { 42 | ByteArrayOutputStream outputStream=new ByteArrayOutputStream(); 43 | int size = 0; 44 | byte[] buffer = new byte[1024]; 45 | try (InputStream ins = ctx.getResources().openRawResource(resId)) { 46 | while((size=ins.read(buffer,0,1024))>=0){ 47 | outputStream.write(buffer,0,size); 48 | } 49 | } catch (IOException e) { 50 | e.printStackTrace(); 51 | } 52 | return outputStream.toByteArray(); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/zhao/faceverification/face/FaceWrapper.java: -------------------------------------------------------------------------------- 1 | package com.example.zhao.faceverification.face; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | import org.opencv.core.Rect; 6 | 7 | /** 8 | * Created by zhao on 2016/12/12. 9 | */ 10 | public class FaceWrapper { 11 | public Bitmap faceBitmap; 12 | public Rect faceRect; 13 | 14 | public FaceWrapper(Bitmap faceBitmap, Rect faceRect) { 15 | this.faceBitmap = faceBitmap; 16 | this.faceRect = faceRect; 17 | } 18 | 19 | public Bitmap getFaceBitmap() { 20 | return faceBitmap; 21 | } 22 | 23 | public Rect getFaceRect() { 24 | return faceRect; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/zhao/faceverification/face/ImageUtils.java: -------------------------------------------------------------------------------- 1 | package com.example.zhao.faceverification.face; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.Matrix; 5 | import android.util.Log; 6 | 7 | import org.opencv.android.Utils; 8 | import org.opencv.core.Mat; 9 | import org.opencv.core.MatOfPoint2f; 10 | import org.opencv.core.Point; 11 | import org.opencv.core.Rect; 12 | import org.opencv.core.Size; 13 | import org.opencv.imgproc.Imgproc; 14 | 15 | /** 16 | * Created by zhao on 2016/12/21. 17 | */ 18 | 19 | public class ImageUtils { 20 | 21 | // private static float[] standard_shape={0.2766f,0.1641f,0.7073f,0.1558f,0.4950f,0.5144f,0.3071f,0.6418f,0.6954f,0.6341f,0.498f,0.645f}; 22 | private static float[] standard_shape={0.2766f,0.2241f,0.7073f,0.2241f,0.4950f,0.5144f,0.3071f,0.6418f,0.6954f,0.6341f,0.498f,0.695f};//left eye right eye nose tip mouth corner mouth corner middle mouth 23 | 24 | public static Bitmap getAffineBitmap(float[] landmarks, Bitmap originBitmap, Rect rect){ 25 | 26 | float[] newLandmark=new float[landmarks.length]; 27 | for (int i = 0; i < landmarks.length/2; i++) { 28 | newLandmark[2*i+0]=landmarks[2*i+0]*rect.width+rect.x; 29 | newLandmark[2*i+1]=landmarks[2*i+1]*rect.height+rect.y; 30 | } 31 | 32 | float[] newStdShape=new float[standard_shape.length]; 33 | for (int i = 0; i < standard_shape.length; i++) { 34 | newStdShape[i]=standard_shape[i]*rect.height; 35 | } 36 | 37 | MatOfPoint2f src=new MatOfPoint2f(new Point(newLandmark[0],newLandmark[1]),new Point(newLandmark[2],newLandmark[3]),new Point((newLandmark[6]+newLandmark[8])/2,(newLandmark[7]+newLandmark[9])/2)); 38 | MatOfPoint2f dst=new MatOfPoint2f(new Point(newStdShape[0],newStdShape[1]),new Point(newStdShape[2],newStdShape[3]),new Point(newStdShape[10],newStdShape[11])); 39 | 40 | Mat affineMatrix= Imgproc.getAffineTransform(src,dst); 41 | 42 | Mat rgbMat = new Mat(); 43 | Utils.bitmapToMat(originBitmap, rgbMat); 44 | 45 | Mat alignFace=new Mat(); 46 | Imgproc.warpAffine(rgbMat,alignFace,affineMatrix,new Size(rect.height,rect.height)); 47 | 48 | Bitmap m= Bitmap.createBitmap(alignFace.cols(),alignFace.rows(), Bitmap.Config.ARGB_8888); 49 | Utils.matToBitmap(alignFace,m); 50 | 51 | return m; 52 | } 53 | 54 | 55 | public static Bitmap getResizedBitmap(Bitmap bm, int newWidth, int newHeight) { 56 | int width = bm.getWidth(); 57 | int height = bm.getHeight(); 58 | float scaleWidth = ((float) newWidth) / width; 59 | float scaleHeight = ((float) newHeight) / height; 60 | 61 | Matrix matrix = new Matrix(); 62 | matrix.postScale(scaleWidth, scaleHeight); 63 | 64 | Bitmap resizedBitmap = Bitmap.createBitmap( 65 | bm, 0, 0, width, height, matrix, false); 66 | 67 | return resizedBitmap; 68 | } 69 | 70 | public static Bitmap getAlignedFaceFromImage(Bitmap oBitmap){ 71 | 72 | Bitmap sBitmap=getResizedBitmap(oBitmap,480,640); 73 | 74 | FaceWrapper srcFaceWrapper=FaceDetection.faceDetectWithOpenCV(sBitmap); 75 | 76 | if (srcFaceWrapper==null){ 77 | return null; 78 | } 79 | Log.d("main","face wrapper"+srcFaceWrapper.getFaceBitmap().getWidth()); 80 | Bitmap srcFace=srcFaceWrapper.getFaceBitmap(); 81 | Rect srcRect=srcFaceWrapper.getFaceRect(); 82 | 83 | Bitmap face = getResizedBitmap(srcFace, 40, 40); 84 | 85 | float[] landmarks=MxNetUtils.getAligments(face); 86 | 87 | Bitmap affineBitmap=getAffineBitmap(landmarks,sBitmap,srcRect); 88 | 89 | return getResizedBitmap(affineBitmap,128,128); 90 | } 91 | 92 | 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/zhao/faceverification/face/MxNetUtils.java: -------------------------------------------------------------------------------- 1 | package com.example.zhao.faceverification.face; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.util.Log; 6 | 7 | import com.example.zhao.faceverification.R; 8 | import com.example.zhao.faceverification.context.MyApplication; 9 | 10 | import org.dmlc.mxnet.Predictor; 11 | 12 | import java.io.BufferedReader; 13 | import java.io.IOException; 14 | import java.io.InputStream; 15 | import java.io.InputStreamReader; 16 | import java.nio.ByteBuffer; 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | /** 21 | * Created by zhao on 2016/11/17. 22 | */ 23 | public class MxNetUtils { 24 | 25 | private MxNetUtils() { 26 | } 27 | 28 | public static float identifyImage(final Bitmap srcBitmap, final Bitmap dstBitmap) { 29 | 30 | float[] srcFeatures = getFeatures(srcBitmap); 31 | float[] dstFeatures = getFeatures(dstBitmap); 32 | 33 | float s = calCosineSimilarity(srcFeatures, dstFeatures); 34 | 35 | return s; 36 | } 37 | 38 | public static float[] getGrayArray(Bitmap bitmap) { 39 | ByteBuffer byteBuffer = ByteBuffer.allocate(bitmap.getByteCount()); 40 | bitmap.copyPixelsToBuffer(byteBuffer); 41 | byte[] bytes = byteBuffer.array(); 42 | 43 | float[] gray = new float[128 * 128]; 44 | 45 | for (int i = 0; i < bytes.length; i += 4) { 46 | int j = i / 4; 47 | float r = (float) (((int) (bytes[i + 0])) & 0xFF); 48 | float g = (float) (((int) (bytes[i + 1])) & 0xFF); 49 | float b = (float) (((int) (bytes[i + 2])) & 0xFF); 50 | 51 | int temp = (int) (0.299 * r + 0.587 * g + 0.114 * b); 52 | gray[j] = (float) (temp / 255.0); 53 | } 54 | return gray; 55 | } 56 | 57 | public static float[] getFeatures(Bitmap srcBitmap) { 58 | float[] srcGray = getGrayArray(srcBitmap); 59 | long t = System.currentTimeMillis(); 60 | Predictor predictor = FacePredictor.getPredictor(); 61 | predictor.forward("data", srcGray); 62 | final float[] result = predictor.getOutput(0); 63 | Log.d("verification time", String.valueOf(System.currentTimeMillis() - t)); 64 | return result; 65 | } 66 | 67 | public static float calCosineSimilarity(float[] a, float[] b) { 68 | 69 | if (a.length != b.length) { 70 | return 0; 71 | } 72 | 73 | float n = 0; 74 | float x = 0; 75 | float y = 0; 76 | for (int i = 0; i < a.length; i++) { 77 | n += a[i] * b[i]; 78 | x += a[i] * a[i]; 79 | y += b[i] * b[i]; 80 | } 81 | float s = (float) (n / (Math.sqrt(x) * Math.sqrt(y))); 82 | 83 | Log.d("main", "similarity" + s); 84 | 85 | return s; 86 | } 87 | 88 | public static float[] getAligments(final Bitmap FaceBitmap) { 89 | long t = System.currentTimeMillis(); 90 | 91 | ByteBuffer byteBuffer = ByteBuffer.allocate(FaceBitmap.getByteCount()); 92 | FaceBitmap.copyPixelsToBuffer(byteBuffer); 93 | byte[] bytes = byteBuffer.array(); 94 | 95 | List meanText = readRawTextFile(MyApplication.getContext(), R.raw.mean); 96 | int[] meanInt = listToArray(meanText); 97 | 98 | List stdText = readRawTextFile(MyApplication.getContext(), R.raw.std); 99 | int[] stdInt = listToArray(stdText); 100 | 101 | float[] colors = new float[3 * 40 * 40]; 102 | 103 | for (int i = 0; i < bytes.length; i += 4) { 104 | int j = i / 4; 105 | colors[0 * 40 * 40 + j] = (float) (((float) (((int) (bytes[i + 0])) & 0xFF) - (float) (meanInt[3 * j + 0])) / (1e-6 + (float) (stdInt[3 * j + 0]))); 106 | colors[1 * 40 * 40 + j] = (float) (((float) (((int) (bytes[i + 1])) & 0xFF) - (float) (meanInt[3 * j + 1])) / (1e-6 + (float) (stdInt[3 * j + 1]))); 107 | colors[2 * 40 * 40 + j] = (float) (((float) (((int) (bytes[i + 2])) & 0xFF) - (float) (meanInt[3 * j + 2])) / (1e-6 + (float) (stdInt[3 * j + 2]))); 108 | } 109 | 110 | Predictor predictor = FaceAlignment.getPredictor(); 111 | 112 | predictor.forward("data", colors); 113 | float[] temp = predictor.getOutput(0); 114 | 115 | final float[] result = new float[temp.length]; 116 | 117 | for (int i = 0; i < temp.length; i++) { 118 | result[i] = temp[i] + 0.5f; 119 | } 120 | Log.d("align time", String.valueOf(System.currentTimeMillis() - t)); 121 | return result; 122 | } 123 | 124 | public static int[] listToArray(List list) { 125 | int[] arrayInt = new int[list.size()]; 126 | for (int i = 0; i < list.size(); i++) { 127 | int temp = Integer.parseInt(list.get(i)); 128 | arrayInt[i] = temp; 129 | } 130 | return arrayInt; 131 | } 132 | 133 | public static List readRawTextFile(Context ctx, int resId) { 134 | List result = new ArrayList<>(); 135 | InputStream inputStream = ctx.getResources().openRawResource(resId); 136 | 137 | InputStreamReader inputreader = new InputStreamReader(inputStream); 138 | BufferedReader buffreader = new BufferedReader(inputreader); 139 | String line; 140 | 141 | try { 142 | while ((line = buffreader.readLine()) != null) { 143 | result.add(line); 144 | } 145 | } catch (IOException e) { 146 | return null; 147 | } 148 | return result; 149 | } 150 | 151 | } 152 | -------------------------------------------------------------------------------- /app/src/main/java/org/dmlc/mxnet/MxnetException.java: -------------------------------------------------------------------------------- 1 | package org.dmlc.mxnet; 2 | 3 | public class MxnetException extends Exception { 4 | public MxnetException(){} 5 | public MxnetException(String txt) { 6 | super(txt); 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/org/dmlc/mxnet/Predictor.java: -------------------------------------------------------------------------------- 1 | package org.dmlc.mxnet; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.Color; 5 | 6 | public class Predictor { 7 | static { 8 | System.loadLibrary("mxnet_predict"); 9 | } 10 | 11 | public static class InputNode { 12 | String key; 13 | int[] shape; 14 | public InputNode(String key, int[] shape) { 15 | this.key = key; 16 | this.shape = shape; 17 | } 18 | } 19 | 20 | public static class Device { 21 | public enum Type { 22 | CPU, GPU, CPU_PINNED 23 | } 24 | 25 | public Device(Type t, int i) { 26 | this.type = t; 27 | this.id = i; 28 | } 29 | 30 | Type type; 31 | int id; 32 | int ctype() { 33 | return this.type == Type.CPU? 1: this.type == Type.GPU? 2: 3; 34 | } 35 | } 36 | 37 | private long handle = 0; 38 | 39 | public Predictor(byte[] symbol, byte[] params, Device dev, InputNode[] input) { 40 | String[] keys = new String[input.length]; 41 | int[][] shapes = new int[input.length][]; 42 | for (int i=0; i= CV_CN_MAX) { 22 | throw new java.lang.UnsupportedOperationException("Channels count should be 1.." + (CV_CN_MAX - 1)); 23 | } 24 | if (depth < 0 || depth >= CV_DEPTH_MAX) { 25 | throw new java.lang.UnsupportedOperationException("Data type depth should be 0.." + (CV_DEPTH_MAX - 1)); 26 | } 27 | return (depth & (CV_DEPTH_MAX - 1)) + ((channels - 1) << CV_CN_SHIFT); 28 | } 29 | 30 | public static final int CV_8UC(int ch) { 31 | return makeType(CV_8U, ch); 32 | } 33 | 34 | public static final int CV_8SC(int ch) { 35 | return makeType(CV_8S, ch); 36 | } 37 | 38 | public static final int CV_16UC(int ch) { 39 | return makeType(CV_16U, ch); 40 | } 41 | 42 | public static final int CV_16SC(int ch) { 43 | return makeType(CV_16S, ch); 44 | } 45 | 46 | public static final int CV_32SC(int ch) { 47 | return makeType(CV_32S, ch); 48 | } 49 | 50 | public static final int CV_32FC(int ch) { 51 | return makeType(CV_32F, ch); 52 | } 53 | 54 | public static final int CV_64FC(int ch) { 55 | return makeType(CV_64F, ch); 56 | } 57 | 58 | public static final int channels(int type) { 59 | return (type >> CV_CN_SHIFT) + 1; 60 | } 61 | 62 | public static final int depth(int type) { 63 | return type & (CV_DEPTH_MAX - 1); 64 | } 65 | 66 | public static final boolean isInteger(int type) { 67 | return depth(type) < CV_32F; 68 | } 69 | 70 | public static final int ELEM_SIZE(int type) { 71 | switch (depth(type)) { 72 | case CV_8U: 73 | case CV_8S: 74 | return channels(type); 75 | case CV_16U: 76 | case CV_16S: 77 | return 2 * channels(type); 78 | case CV_32S: 79 | case CV_32F: 80 | return 4 * channels(type); 81 | case CV_64F: 82 | return 8 * channels(type); 83 | default: 84 | throw new java.lang.UnsupportedOperationException("Unsupported CvType value: " + type); 85 | } 86 | } 87 | 88 | public static final String typeToString(int type) { 89 | String s; 90 | switch (depth(type)) { 91 | case CV_8U: 92 | s = "CV_8U"; 93 | break; 94 | case CV_8S: 95 | s = "CV_8S"; 96 | break; 97 | case CV_16U: 98 | s = "CV_16U"; 99 | break; 100 | case CV_16S: 101 | s = "CV_16S"; 102 | break; 103 | case CV_32S: 104 | s = "CV_32S"; 105 | break; 106 | case CV_32F: 107 | s = "CV_32F"; 108 | break; 109 | case CV_64F: 110 | s = "CV_64F"; 111 | break; 112 | case CV_USRTYPE1: 113 | s = "CV_USRTYPE1"; 114 | break; 115 | default: 116 | throw new java.lang.UnsupportedOperationException("Unsupported CvType value: " + type); 117 | } 118 | 119 | int ch = channels(type); 120 | if (ch <= 4) 121 | return s + "C" + ch; 122 | else 123 | return s + "C(" + ch + ")"; 124 | } 125 | 126 | } 127 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/DMatch.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //C++: class DMatch 4 | 5 | /** 6 | * Structure for matching: query descriptor index, train descriptor index, train 7 | * image index and distance between descriptors. 8 | */ 9 | public class DMatch { 10 | 11 | /** 12 | * Query descriptor index. 13 | */ 14 | public int queryIdx; 15 | /** 16 | * Train descriptor index. 17 | */ 18 | public int trainIdx; 19 | /** 20 | * Train image index. 21 | */ 22 | public int imgIdx; 23 | 24 | // javadoc: DMatch::distance 25 | public float distance; 26 | 27 | // javadoc: DMatch::DMatch() 28 | public DMatch() { 29 | this(-1, -1, Float.MAX_VALUE); 30 | } 31 | 32 | // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _distance) 33 | public DMatch(int _queryIdx, int _trainIdx, float _distance) { 34 | queryIdx = _queryIdx; 35 | trainIdx = _trainIdx; 36 | imgIdx = -1; 37 | distance = _distance; 38 | } 39 | 40 | // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _imgIdx, _distance) 41 | public DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance) { 42 | queryIdx = _queryIdx; 43 | trainIdx = _trainIdx; 44 | imgIdx = _imgIdx; 45 | distance = _distance; 46 | } 47 | 48 | /** 49 | * Less is better. 50 | */ 51 | public boolean lessThan(DMatch it) { 52 | return distance < it.distance; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return "DMatch [queryIdx=" + queryIdx + ", trainIdx=" + trainIdx + ", imgIdx=" + imgIdx + ", distance=" 58 | + distance + "]"; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/KeyPoint.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import org.opencv.core.Point; 4 | 5 | //javadoc: KeyPoint 6 | public class KeyPoint { 7 | 8 | /** 9 | * Coordinates of the keypoint. 10 | */ 11 | public Point pt; 12 | /** 13 | * Diameter of the useful keypoint adjacent area. 14 | */ 15 | public float size; 16 | /** 17 | * Computed orientation of the keypoint (-1 if not applicable). 18 | */ 19 | public float angle; 20 | /** 21 | * The response, by which the strongest keypoints have been selected. Can be 22 | * used for further sorting or subsampling. 23 | */ 24 | public float response; 25 | /** 26 | * Octave (pyramid layer), from which the keypoint has been extracted. 27 | */ 28 | public int octave; 29 | /** 30 | * Object ID, that can be used to cluster keypoints by an object they belong 31 | * to. 32 | */ 33 | public int class_id; 34 | 35 | // javadoc:KeyPoint::KeyPoint(x,y,_size,_angle,_response,_octave,_class_id) 36 | public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id) { 37 | pt = new Point(x, y); 38 | size = _size; 39 | angle = _angle; 40 | response = _response; 41 | octave = _octave; 42 | class_id = _class_id; 43 | } 44 | 45 | // javadoc: KeyPoint::KeyPoint() 46 | public KeyPoint() { 47 | this(0, 0, 0, -1, 0, 0, -1); 48 | } 49 | 50 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response, _octave) 51 | public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave) { 52 | this(x, y, _size, _angle, _response, _octave, -1); 53 | } 54 | 55 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response) 56 | public KeyPoint(float x, float y, float _size, float _angle, float _response) { 57 | this(x, y, _size, _angle, _response, 0, -1); 58 | } 59 | 60 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle) 61 | public KeyPoint(float x, float y, float _size, float _angle) { 62 | this(x, y, _size, _angle, 0, 0, -1); 63 | } 64 | 65 | // javadoc: KeyPoint::KeyPoint(x, y, _size) 66 | public KeyPoint(float x, float y, float _size) { 67 | this(x, y, _size, -1, 0, 0, -1); 68 | } 69 | 70 | @Override 71 | public String toString() { 72 | return "KeyPoint [pt=" + pt + ", size=" + size + ", angle=" + angle + ", response=" + response + ", octave=" 73 | + octave + ", class_id=" + class_id + "]"; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfByte.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfByte extends Mat { 7 | // 8UC(x) 8 | private static final int _depth = CvType.CV_8U; 9 | private static final int _channels = 1; 10 | 11 | public MatOfByte() { 12 | super(); 13 | } 14 | 15 | protected MatOfByte(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfByte fromNativeAddr(long addr) { 23 | return new MatOfByte(addr); 24 | } 25 | 26 | public MatOfByte(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfByte(byte... a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(byte... a) { 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length / _channels; 47 | alloc(num); 48 | put(0, 0, a); // TODO: check ret val! 49 | } 50 | 51 | public byte[] toArray() { 52 | int num = checkVector(_channels, _depth); 53 | if (num < 0) 54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString()); 55 | byte[] a = new byte[num * _channels]; 56 | if (num == 0) 57 | return a; 58 | get(0, 0, a); // TODO: check ret val! 59 | return a; 60 | } 61 | 62 | public void fromList(List lb) { 63 | if (lb == null || lb.size() == 0) 64 | return; 65 | Byte ab[] = lb.toArray(new Byte[0]); 66 | byte a[] = new byte[ab.length]; 67 | for (int i = 0; i < ab.length; i++) 68 | a[i] = ab[i]; 69 | fromArray(a); 70 | } 71 | 72 | public List toList() { 73 | byte[] a = toArray(); 74 | Byte ab[] = new Byte[a.length]; 75 | for (int i = 0; i < a.length; i++) 76 | ab[i] = a[i]; 77 | return Arrays.asList(ab); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfDMatch.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import org.opencv.core.DMatch; 7 | 8 | public class MatOfDMatch extends Mat { 9 | // 32FC4 10 | private static final int _depth = CvType.CV_32F; 11 | private static final int _channels = 4; 12 | 13 | public MatOfDMatch() { 14 | super(); 15 | } 16 | 17 | protected MatOfDMatch(long addr) { 18 | super(addr); 19 | if (!empty() && checkVector(_channels, _depth) < 0) 20 | throw new IllegalArgumentException("Incompatible Mat: " + toString()); 21 | // FIXME: do we need release() here? 22 | } 23 | 24 | public static MatOfDMatch fromNativeAddr(long addr) { 25 | return new MatOfDMatch(addr); 26 | } 27 | 28 | public MatOfDMatch(Mat m) { 29 | super(m, Range.all()); 30 | if (!empty() && checkVector(_channels, _depth) < 0) 31 | throw new IllegalArgumentException("Incompatible Mat: " + toString()); 32 | // FIXME: do we need release() here? 33 | } 34 | 35 | public MatOfDMatch(DMatch... ap) { 36 | super(); 37 | fromArray(ap); 38 | } 39 | 40 | public void alloc(int elemNumber) { 41 | if (elemNumber > 0) 42 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 43 | } 44 | 45 | public void fromArray(DMatch... a) { 46 | if (a == null || a.length == 0) 47 | return; 48 | int num = a.length; 49 | alloc(num); 50 | float buff[] = new float[num * _channels]; 51 | for (int i = 0; i < num; i++) { 52 | DMatch m = a[i]; 53 | buff[_channels * i + 0] = m.queryIdx; 54 | buff[_channels * i + 1] = m.trainIdx; 55 | buff[_channels * i + 2] = m.imgIdx; 56 | buff[_channels * i + 3] = m.distance; 57 | } 58 | put(0, 0, buff); // TODO: check ret val! 59 | } 60 | 61 | public DMatch[] toArray() { 62 | int num = (int) total(); 63 | DMatch[] a = new DMatch[num]; 64 | if (num == 0) 65 | return a; 66 | float buff[] = new float[num * _channels]; 67 | get(0, 0, buff); // TODO: check ret val! 68 | for (int i = 0; i < num; i++) 69 | a[i] = new DMatch((int) buff[_channels * i + 0], (int) buff[_channels * i + 1], 70 | (int) buff[_channels * i + 2], buff[_channels * i + 3]); 71 | return a; 72 | } 73 | 74 | public void fromList(List ldm) { 75 | DMatch adm[] = ldm.toArray(new DMatch[0]); 76 | fromArray(adm); 77 | } 78 | 79 | public List toList() { 80 | DMatch[] adm = toArray(); 81 | return Arrays.asList(adm); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfDouble.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfDouble extends Mat { 7 | // 64FC(x) 8 | private static final int _depth = CvType.CV_64F; 9 | private static final int _channels = 1; 10 | 11 | public MatOfDouble() { 12 | super(); 13 | } 14 | 15 | protected MatOfDouble(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfDouble fromNativeAddr(long addr) { 23 | return new MatOfDouble(addr); 24 | } 25 | 26 | public MatOfDouble(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfDouble(double... a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(double... a) { 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length / _channels; 47 | alloc(num); 48 | put(0, 0, a); // TODO: check ret val! 49 | } 50 | 51 | public double[] toArray() { 52 | int num = checkVector(_channels, _depth); 53 | if (num < 0) 54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString()); 55 | double[] a = new double[num * _channels]; 56 | if (num == 0) 57 | return a; 58 | get(0, 0, a); // TODO: check ret val! 59 | return a; 60 | } 61 | 62 | public void fromList(List lb) { 63 | if (lb == null || lb.size() == 0) 64 | return; 65 | Double ab[] = lb.toArray(new Double[0]); 66 | double a[] = new double[ab.length]; 67 | for (int i = 0; i < ab.length; i++) 68 | a[i] = ab[i]; 69 | fromArray(a); 70 | } 71 | 72 | public List toList() { 73 | double[] a = toArray(); 74 | Double ab[] = new Double[a.length]; 75 | for (int i = 0; i < a.length; i++) 76 | ab[i] = a[i]; 77 | return Arrays.asList(ab); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfFloat.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfFloat extends Mat { 7 | // 32FC1 8 | private static final int _depth = CvType.CV_32F; 9 | private static final int _channels = 1; 10 | 11 | public MatOfFloat() { 12 | super(); 13 | } 14 | 15 | protected MatOfFloat(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfFloat fromNativeAddr(long addr) { 23 | return new MatOfFloat(addr); 24 | } 25 | 26 | public MatOfFloat(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfFloat(float... a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(float... a) { 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length / _channels; 47 | alloc(num); 48 | put(0, 0, a); // TODO: check ret val! 49 | } 50 | 51 | public float[] toArray() { 52 | int num = checkVector(_channels, _depth); 53 | if (num < 0) 54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString()); 55 | float[] a = new float[num * _channels]; 56 | if (num == 0) 57 | return a; 58 | get(0, 0, a); // TODO: check ret val! 59 | return a; 60 | } 61 | 62 | public void fromList(List lb) { 63 | if (lb == null || lb.size() == 0) 64 | return; 65 | Float ab[] = lb.toArray(new Float[0]); 66 | float a[] = new float[ab.length]; 67 | for (int i = 0; i < ab.length; i++) 68 | a[i] = ab[i]; 69 | fromArray(a); 70 | } 71 | 72 | public List toList() { 73 | float[] a = toArray(); 74 | Float ab[] = new Float[a.length]; 75 | for (int i = 0; i < a.length; i++) 76 | ab[i] = a[i]; 77 | return Arrays.asList(ab); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfFloat4.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfFloat4 extends Mat { 7 | // 32FC4 8 | private static final int _depth = CvType.CV_32F; 9 | private static final int _channels = 4; 10 | 11 | public MatOfFloat4() { 12 | super(); 13 | } 14 | 15 | protected MatOfFloat4(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfFloat4 fromNativeAddr(long addr) { 23 | return new MatOfFloat4(addr); 24 | } 25 | 26 | public MatOfFloat4(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfFloat4(float... a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(float... a) { 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length / _channels; 47 | alloc(num); 48 | put(0, 0, a); // TODO: check ret val! 49 | } 50 | 51 | public float[] toArray() { 52 | int num = checkVector(_channels, _depth); 53 | if (num < 0) 54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString()); 55 | float[] a = new float[num * _channels]; 56 | if (num == 0) 57 | return a; 58 | get(0, 0, a); // TODO: check ret val! 59 | return a; 60 | } 61 | 62 | public void fromList(List lb) { 63 | if (lb == null || lb.size() == 0) 64 | return; 65 | Float ab[] = lb.toArray(new Float[0]); 66 | float a[] = new float[ab.length]; 67 | for (int i = 0; i < ab.length; i++) 68 | a[i] = ab[i]; 69 | fromArray(a); 70 | } 71 | 72 | public List toList() { 73 | float[] a = toArray(); 74 | Float ab[] = new Float[a.length]; 75 | for (int i = 0; i < a.length; i++) 76 | ab[i] = a[i]; 77 | return Arrays.asList(ab); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfFloat6.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfFloat6 extends Mat { 7 | // 32FC6 8 | private static final int _depth = CvType.CV_32F; 9 | private static final int _channels = 6; 10 | 11 | public MatOfFloat6() { 12 | super(); 13 | } 14 | 15 | protected MatOfFloat6(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfFloat6 fromNativeAddr(long addr) { 23 | return new MatOfFloat6(addr); 24 | } 25 | 26 | public MatOfFloat6(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfFloat6(float... a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(float... a) { 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length / _channels; 47 | alloc(num); 48 | put(0, 0, a); // TODO: check ret val! 49 | } 50 | 51 | public float[] toArray() { 52 | int num = checkVector(_channels, _depth); 53 | if (num < 0) 54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString()); 55 | float[] a = new float[num * _channels]; 56 | if (num == 0) 57 | return a; 58 | get(0, 0, a); // TODO: check ret val! 59 | return a; 60 | } 61 | 62 | public void fromList(List lb) { 63 | if (lb == null || lb.size() == 0) 64 | return; 65 | Float ab[] = lb.toArray(new Float[0]); 66 | float a[] = new float[ab.length]; 67 | for (int i = 0; i < ab.length; i++) 68 | a[i] = ab[i]; 69 | fromArray(a); 70 | } 71 | 72 | public List toList() { 73 | float[] a = toArray(); 74 | Float ab[] = new Float[a.length]; 75 | for (int i = 0; i < a.length; i++) 76 | ab[i] = a[i]; 77 | return Arrays.asList(ab); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfInt.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfInt extends Mat { 7 | // 32SC1 8 | private static final int _depth = CvType.CV_32S; 9 | private static final int _channels = 1; 10 | 11 | public MatOfInt() { 12 | super(); 13 | } 14 | 15 | protected MatOfInt(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfInt fromNativeAddr(long addr) { 23 | return new MatOfInt(addr); 24 | } 25 | 26 | public MatOfInt(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfInt(int... a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(int... a) { 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length / _channels; 47 | alloc(num); 48 | put(0, 0, a); // TODO: check ret val! 49 | } 50 | 51 | public int[] toArray() { 52 | int num = checkVector(_channels, _depth); 53 | if (num < 0) 54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString()); 55 | int[] a = new int[num * _channels]; 56 | if (num == 0) 57 | return a; 58 | get(0, 0, a); // TODO: check ret val! 59 | return a; 60 | } 61 | 62 | public void fromList(List lb) { 63 | if (lb == null || lb.size() == 0) 64 | return; 65 | Integer ab[] = lb.toArray(new Integer[0]); 66 | int a[] = new int[ab.length]; 67 | for (int i = 0; i < ab.length; i++) 68 | a[i] = ab[i]; 69 | fromArray(a); 70 | } 71 | 72 | public List toList() { 73 | int[] a = toArray(); 74 | Integer ab[] = new Integer[a.length]; 75 | for (int i = 0; i < a.length; i++) 76 | ab[i] = a[i]; 77 | return Arrays.asList(ab); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfInt4.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfInt4 extends Mat { 7 | // 32SC4 8 | private static final int _depth = CvType.CV_32S; 9 | private static final int _channels = 4; 10 | 11 | public MatOfInt4() { 12 | super(); 13 | } 14 | 15 | protected MatOfInt4(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfInt4 fromNativeAddr(long addr) { 23 | return new MatOfInt4(addr); 24 | } 25 | 26 | public MatOfInt4(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfInt4(int... a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(int... a) { 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length / _channels; 47 | alloc(num); 48 | put(0, 0, a); // TODO: check ret val! 49 | } 50 | 51 | public int[] toArray() { 52 | int num = checkVector(_channels, _depth); 53 | if (num < 0) 54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString()); 55 | int[] a = new int[num * _channels]; 56 | if (num == 0) 57 | return a; 58 | get(0, 0, a); // TODO: check ret val! 59 | return a; 60 | } 61 | 62 | public void fromList(List lb) { 63 | if (lb == null || lb.size() == 0) 64 | return; 65 | Integer ab[] = lb.toArray(new Integer[0]); 66 | int a[] = new int[ab.length]; 67 | for (int i = 0; i < ab.length; i++) 68 | a[i] = ab[i]; 69 | fromArray(a); 70 | } 71 | 72 | public List toList() { 73 | int[] a = toArray(); 74 | Integer ab[] = new Integer[a.length]; 75 | for (int i = 0; i < a.length; i++) 76 | ab[i] = a[i]; 77 | return Arrays.asList(ab); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfKeyPoint.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import org.opencv.core.KeyPoint; 7 | 8 | public class MatOfKeyPoint extends Mat { 9 | // 32FC7 10 | private static final int _depth = CvType.CV_32F; 11 | private static final int _channels = 7; 12 | 13 | public MatOfKeyPoint() { 14 | super(); 15 | } 16 | 17 | protected MatOfKeyPoint(long addr) { 18 | super(addr); 19 | if (!empty() && checkVector(_channels, _depth) < 0) 20 | throw new IllegalArgumentException("Incompatible Mat"); 21 | // FIXME: do we need release() here? 22 | } 23 | 24 | public static MatOfKeyPoint fromNativeAddr(long addr) { 25 | return new MatOfKeyPoint(addr); 26 | } 27 | 28 | public MatOfKeyPoint(Mat m) { 29 | super(m, Range.all()); 30 | if (!empty() && checkVector(_channels, _depth) < 0) 31 | throw new IllegalArgumentException("Incompatible Mat"); 32 | // FIXME: do we need release() here? 33 | } 34 | 35 | public MatOfKeyPoint(KeyPoint... a) { 36 | super(); 37 | fromArray(a); 38 | } 39 | 40 | public void alloc(int elemNumber) { 41 | if (elemNumber > 0) 42 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 43 | } 44 | 45 | public void fromArray(KeyPoint... a) { 46 | if (a == null || a.length == 0) 47 | return; 48 | int num = a.length; 49 | alloc(num); 50 | float buff[] = new float[num * _channels]; 51 | for (int i = 0; i < num; i++) { 52 | KeyPoint kp = a[i]; 53 | buff[_channels * i + 0] = (float) kp.pt.x; 54 | buff[_channels * i + 1] = (float) kp.pt.y; 55 | buff[_channels * i + 2] = kp.size; 56 | buff[_channels * i + 3] = kp.angle; 57 | buff[_channels * i + 4] = kp.response; 58 | buff[_channels * i + 5] = kp.octave; 59 | buff[_channels * i + 6] = kp.class_id; 60 | } 61 | put(0, 0, buff); // TODO: check ret val! 62 | } 63 | 64 | public KeyPoint[] toArray() { 65 | int num = (int) total(); 66 | KeyPoint[] a = new KeyPoint[num]; 67 | if (num == 0) 68 | return a; 69 | float buff[] = new float[num * _channels]; 70 | get(0, 0, buff); // TODO: check ret val! 71 | for (int i = 0; i < num; i++) 72 | a[i] = new KeyPoint(buff[_channels * i + 0], buff[_channels * i + 1], buff[_channels * i + 2], 73 | buff[_channels * i + 3], buff[_channels * i + 4], (int) buff[_channels * i + 5], 74 | (int) buff[_channels * i + 6]); 75 | return a; 76 | } 77 | 78 | public void fromList(List lkp) { 79 | KeyPoint akp[] = lkp.toArray(new KeyPoint[0]); 80 | fromArray(akp); 81 | } 82 | 83 | public List toList() { 84 | KeyPoint[] akp = toArray(); 85 | return Arrays.asList(akp); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfPoint.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfPoint extends Mat { 7 | // 32SC2 8 | private static final int _depth = CvType.CV_32S; 9 | private static final int _channels = 2; 10 | 11 | public MatOfPoint() { 12 | super(); 13 | } 14 | 15 | protected MatOfPoint(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfPoint fromNativeAddr(long addr) { 23 | return new MatOfPoint(addr); 24 | } 25 | 26 | public MatOfPoint(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfPoint(Point... a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(Point... a) { 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length; 47 | alloc(num); 48 | int buff[] = new int[num * _channels]; 49 | for (int i = 0; i < num; i++) { 50 | Point p = a[i]; 51 | buff[_channels * i + 0] = (int) p.x; 52 | buff[_channels * i + 1] = (int) p.y; 53 | } 54 | put(0, 0, buff); // TODO: check ret val! 55 | } 56 | 57 | public Point[] toArray() { 58 | int num = (int) total(); 59 | Point[] ap = new Point[num]; 60 | if (num == 0) 61 | return ap; 62 | int buff[] = new int[num * _channels]; 63 | get(0, 0, buff); // TODO: check ret val! 64 | for (int i = 0; i < num; i++) 65 | ap[i] = new Point(buff[i * _channels], buff[i * _channels + 1]); 66 | return ap; 67 | } 68 | 69 | public void fromList(List lp) { 70 | Point ap[] = lp.toArray(new Point[0]); 71 | fromArray(ap); 72 | } 73 | 74 | public List toList() { 75 | Point[] ap = toArray(); 76 | return Arrays.asList(ap); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfPoint2f.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfPoint2f extends Mat { 7 | // 32FC2 8 | private static final int _depth = CvType.CV_32F; 9 | private static final int _channels = 2; 10 | 11 | public MatOfPoint2f() { 12 | super(); 13 | } 14 | 15 | protected MatOfPoint2f(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfPoint2f fromNativeAddr(long addr) { 23 | return new MatOfPoint2f(addr); 24 | } 25 | 26 | public MatOfPoint2f(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfPoint2f(Point... a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(Point... a) { 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length; 47 | alloc(num); 48 | float buff[] = new float[num * _channels]; 49 | for (int i = 0; i < num; i++) { 50 | Point p = a[i]; 51 | buff[_channels * i + 0] = (float) p.x; 52 | buff[_channels * i + 1] = (float) p.y; 53 | } 54 | put(0, 0, buff); // TODO: check ret val! 55 | } 56 | 57 | public Point[] toArray() { 58 | int num = (int) total(); 59 | Point[] ap = new Point[num]; 60 | if (num == 0) 61 | return ap; 62 | float buff[] = new float[num * _channels]; 63 | get(0, 0, buff); // TODO: check ret val! 64 | for (int i = 0; i < num; i++) 65 | ap[i] = new Point(buff[i * _channels], buff[i * _channels + 1]); 66 | return ap; 67 | } 68 | 69 | public void fromList(List lp) { 70 | Point ap[] = lp.toArray(new Point[0]); 71 | fromArray(ap); 72 | } 73 | 74 | public List toList() { 75 | Point[] ap = toArray(); 76 | return Arrays.asList(ap); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfPoint3.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfPoint3 extends Mat { 7 | // 32SC3 8 | private static final int _depth = CvType.CV_32S; 9 | private static final int _channels = 3; 10 | 11 | public MatOfPoint3() { 12 | super(); 13 | } 14 | 15 | protected MatOfPoint3(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfPoint3 fromNativeAddr(long addr) { 23 | return new MatOfPoint3(addr); 24 | } 25 | 26 | public MatOfPoint3(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfPoint3(Point3... a){ 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(Point3... a){ 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length; 47 | alloc(num); 48 | int buff[] = new int[num * _channels]; 49 | for (int i = 0; i < num; i++) { 50 | Point3 p = a[i]; 51 | buff[_channels * i + 0] = (int) p.x; 52 | buff[_channels * i + 1] = (int) p.y; 53 | buff[_channels * i + 2] = (int) p.z; 54 | } 55 | put(0, 0, buff); // TODO: check ret val! 56 | } 57 | 58 | public Point3[] toArray() { 59 | int num = (int) total(); 60 | Point3[] ap = new Point3[num]; 61 | if (num == 0) 62 | return ap; 63 | int buff[] = new int[num * _channels]; 64 | get(0, 0, buff); // TODO: check ret val! 65 | for (int i = 0; i < num; i++) 66 | ap[i] = new Point3(buff[i * _channels], buff[i * _channels + 1], buff[i * _channels + 2]); 67 | return ap; 68 | } 69 | 70 | public void fromList(List lp) { 71 | Point3 ap[] = lp.toArray(new Point3[0]); 72 | fromArray(ap); 73 | } 74 | 75 | public List toList() { 76 | Point3[] ap = toArray(); 77 | return Arrays.asList(ap); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfPoint3f.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfPoint3f extends Mat { 7 | // 32FC3 8 | private static final int _depth = CvType.CV_32F; 9 | private static final int _channels = 3; 10 | 11 | public MatOfPoint3f() { 12 | super(); 13 | } 14 | 15 | protected MatOfPoint3f(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfPoint3f fromNativeAddr(long addr) { 23 | return new MatOfPoint3f(addr); 24 | } 25 | 26 | public MatOfPoint3f(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfPoint3f(Point3... a){ 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(Point3... a){ 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length; 47 | alloc(num); 48 | float buff[] = new float[num * _channels]; 49 | for (int i = 0; i < num; i++) { 50 | Point3 p = a[i]; 51 | buff[_channels * i + 0] = (float) p.x; 52 | buff[_channels * i + 1] = (float) p.y; 53 | buff[_channels * i + 2] = (float) p.z; 54 | } 55 | put(0, 0, buff); // TODO: check ret val! 56 | } 57 | 58 | public Point3[] toArray() { 59 | int num = (int) total(); 60 | Point3[] ap = new Point3[num]; 61 | if (num == 0) 62 | return ap; 63 | float buff[] = new float[num * _channels]; 64 | get(0, 0, buff); // TODO: check ret val! 65 | for (int i = 0; i < num; i++) 66 | ap[i] = new Point3(buff[i * _channels], buff[i * _channels + 1], buff[i * _channels + 2]); 67 | return ap; 68 | } 69 | 70 | public void fromList(List lp) { 71 | Point3 ap[] = lp.toArray(new Point3[0]); 72 | fromArray(ap); 73 | } 74 | 75 | public List toList() { 76 | Point3[] ap = toArray(); 77 | return Arrays.asList(ap); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/MatOfRect.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfRect extends Mat { 7 | // 32SC4 8 | private static final int _depth = CvType.CV_32S; 9 | private static final int _channels = 4; 10 | 11 | public MatOfRect() { 12 | super(); 13 | } 14 | 15 | protected MatOfRect(long addr) { 16 | super(addr); 17 | if (!empty() && checkVector(_channels, _depth) < 0) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | // FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfRect fromNativeAddr(long addr) { 23 | return new MatOfRect(addr); 24 | } 25 | 26 | public MatOfRect(Mat m) { 27 | super(m, Range.all()); 28 | if (!empty() && checkVector(_channels, _depth) < 0) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | // FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfRect(Rect... a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if (elemNumber > 0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(Rect... a) { 44 | if (a == null || a.length == 0) 45 | return; 46 | int num = a.length; 47 | alloc(num); 48 | int buff[] = new int[num * _channels]; 49 | for (int i = 0; i < num; i++) { 50 | Rect r = a[i]; 51 | buff[_channels * i + 0] = (int) r.x; 52 | buff[_channels * i + 1] = (int) r.y; 53 | buff[_channels * i + 2] = (int) r.width; 54 | buff[_channels * i + 3] = (int) r.height; 55 | } 56 | put(0, 0, buff); // TODO: check ret val! 57 | } 58 | 59 | public Rect[] toArray() { 60 | int num = (int) total(); 61 | Rect[] a = new Rect[num]; 62 | if (num == 0) 63 | return a; 64 | int buff[] = new int[num * _channels]; 65 | get(0, 0, buff); // TODO: check ret val! 66 | for (int i = 0; i < num; i++) 67 | a[i] = new Rect(buff[i * _channels], buff[i * _channels + 1], buff[i * _channels + 2], 68 | buff[i * _channels + 3]); 69 | return a; 70 | } 71 | 72 | public void fromList(List lr) { 73 | Rect ap[] = lr.toArray(new Rect[0]); 74 | fromArray(ap); 75 | } 76 | 77 | public List toList() { 78 | Rect[] ar = toArray(); 79 | return Arrays.asList(ar); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/Point.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //javadoc:Point_ 4 | public class Point { 5 | 6 | public double x, y; 7 | 8 | public Point(double x, double y) { 9 | this.x = x; 10 | this.y = y; 11 | } 12 | 13 | public Point() { 14 | this(0, 0); 15 | } 16 | 17 | public Point(double[] vals) { 18 | this(); 19 | set(vals); 20 | } 21 | 22 | public void set(double[] vals) { 23 | if (vals != null) { 24 | x = vals.length > 0 ? vals[0] : 0; 25 | y = vals.length > 1 ? vals[1] : 0; 26 | } else { 27 | x = 0; 28 | y = 0; 29 | } 30 | } 31 | 32 | public Point clone() { 33 | return new Point(x, y); 34 | } 35 | 36 | public double dot(Point p) { 37 | return x * p.x + y * p.y; 38 | } 39 | 40 | @Override 41 | public int hashCode() { 42 | final int prime = 31; 43 | int result = 1; 44 | long temp; 45 | temp = Double.doubleToLongBits(x); 46 | result = prime * result + (int) (temp ^ (temp >>> 32)); 47 | temp = Double.doubleToLongBits(y); 48 | result = prime * result + (int) (temp ^ (temp >>> 32)); 49 | return result; 50 | } 51 | 52 | @Override 53 | public boolean equals(Object obj) { 54 | if (this == obj) 55 | return true; 56 | if (!(obj instanceof Point)) 57 | return false; 58 | Point it = (Point) obj; 59 | return x == it.x && y == it.y; 60 | } 61 | 62 | public boolean inside(Rect r) { 63 | return r.contains(this); 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | return "{" + x + ", " + y + "}"; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/Point3.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //javadoc:Point3_ 4 | public class Point3 { 5 | 6 | public double x, y, z; 7 | 8 | public Point3(double x, double y, double z) { 9 | this.x = x; 10 | this.y = y; 11 | this.z = z; 12 | } 13 | 14 | public Point3() { 15 | this(0, 0, 0); 16 | } 17 | 18 | public Point3(Point p) { 19 | x = p.x; 20 | y = p.y; 21 | z = 0; 22 | } 23 | 24 | public Point3(double[] vals) { 25 | this(); 26 | set(vals); 27 | } 28 | 29 | public void set(double[] vals) { 30 | if (vals != null) { 31 | x = vals.length > 0 ? vals[0] : 0; 32 | y = vals.length > 1 ? vals[1] : 0; 33 | z = vals.length > 2 ? vals[2] : 0; 34 | } else { 35 | x = 0; 36 | y = 0; 37 | z = 0; 38 | } 39 | } 40 | 41 | public Point3 clone() { 42 | return new Point3(x, y, z); 43 | } 44 | 45 | public double dot(Point3 p) { 46 | return x * p.x + y * p.y + z * p.z; 47 | } 48 | 49 | public Point3 cross(Point3 p) { 50 | return new Point3(y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x); 51 | } 52 | 53 | @Override 54 | public int hashCode() { 55 | final int prime = 31; 56 | int result = 1; 57 | long temp; 58 | temp = Double.doubleToLongBits(x); 59 | result = prime * result + (int) (temp ^ (temp >>> 32)); 60 | temp = Double.doubleToLongBits(y); 61 | result = prime * result + (int) (temp ^ (temp >>> 32)); 62 | temp = Double.doubleToLongBits(z); 63 | result = prime * result + (int) (temp ^ (temp >>> 32)); 64 | return result; 65 | } 66 | 67 | @Override 68 | public boolean equals(Object obj) { 69 | if (this == obj) 70 | return true; 71 | if (!(obj instanceof Point3)) 72 | return false; 73 | Point3 it = (Point3) obj; 74 | return x == it.x && y == it.y && z == it.z; 75 | } 76 | 77 | @Override 78 | public String toString() { 79 | return "{" + x + ", " + y + ", " + z + "}"; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/Range.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //javadoc:Range 4 | public class Range { 5 | 6 | public int start, end; 7 | 8 | public Range(int s, int e) { 9 | this.start = s; 10 | this.end = e; 11 | } 12 | 13 | public Range() { 14 | this(0, 0); 15 | } 16 | 17 | public Range(double[] vals) { 18 | set(vals); 19 | } 20 | 21 | public void set(double[] vals) { 22 | if (vals != null) { 23 | start = vals.length > 0 ? (int) vals[0] : 0; 24 | end = vals.length > 1 ? (int) vals[1] : 0; 25 | } else { 26 | start = 0; 27 | end = 0; 28 | } 29 | 30 | } 31 | 32 | public int size() { 33 | return empty() ? 0 : end - start; 34 | } 35 | 36 | public boolean empty() { 37 | return end <= start; 38 | } 39 | 40 | public static Range all() { 41 | return new Range(Integer.MIN_VALUE, Integer.MAX_VALUE); 42 | } 43 | 44 | public Range intersection(Range r1) { 45 | Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end)); 46 | r.end = Math.max(r.end, r.start); 47 | return r; 48 | } 49 | 50 | public Range shift(int delta) { 51 | return new Range(start + delta, end + delta); 52 | } 53 | 54 | public Range clone() { 55 | return new Range(start, end); 56 | } 57 | 58 | @Override 59 | public int hashCode() { 60 | final int prime = 31; 61 | int result = 1; 62 | long temp; 63 | temp = Double.doubleToLongBits(start); 64 | result = prime * result + (int) (temp ^ (temp >>> 32)); 65 | temp = Double.doubleToLongBits(end); 66 | result = prime * result + (int) (temp ^ (temp >>> 32)); 67 | return result; 68 | } 69 | 70 | @Override 71 | public boolean equals(Object obj) { 72 | if (this == obj) 73 | return true; 74 | if (!(obj instanceof Range)) 75 | return false; 76 | Range it = (Range) obj; 77 | return start == it.start && end == it.end; 78 | } 79 | 80 | @Override 81 | public String toString() { 82 | return "[" + start + ", " + end + ")"; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/Rect.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //javadoc:Rect_ 4 | public class Rect { 5 | 6 | public int x, y, width, height; 7 | 8 | public Rect(int x, int y, int width, int height) { 9 | this.x = x; 10 | this.y = y; 11 | this.width = width; 12 | this.height = height; 13 | } 14 | 15 | public Rect() { 16 | this(0, 0, 0, 0); 17 | } 18 | 19 | public Rect(Point p1, Point p2) { 20 | x = (int) (p1.x < p2.x ? p1.x : p2.x); 21 | y = (int) (p1.y < p2.y ? p1.y : p2.y); 22 | width = (int) (p1.x > p2.x ? p1.x : p2.x) - x; 23 | height = (int) (p1.y > p2.y ? p1.y : p2.y) - y; 24 | } 25 | 26 | public Rect(Point p, Size s) { 27 | this((int) p.x, (int) p.y, (int) s.width, (int) s.height); 28 | } 29 | 30 | public Rect(double[] vals) { 31 | set(vals); 32 | } 33 | 34 | public void set(double[] vals) { 35 | if (vals != null) { 36 | x = vals.length > 0 ? (int) vals[0] : 0; 37 | y = vals.length > 1 ? (int) vals[1] : 0; 38 | width = vals.length > 2 ? (int) vals[2] : 0; 39 | height = vals.length > 3 ? (int) vals[3] : 0; 40 | } else { 41 | x = 0; 42 | y = 0; 43 | width = 0; 44 | height = 0; 45 | } 46 | } 47 | 48 | public Rect clone() { 49 | return new Rect(x, y, width, height); 50 | } 51 | 52 | public Point tl() { 53 | return new Point(x, y); 54 | } 55 | 56 | public Point br() { 57 | return new Point(x + width, y + height); 58 | } 59 | 60 | public Size size() { 61 | return new Size(width, height); 62 | } 63 | 64 | public double area() { 65 | return width * height; 66 | } 67 | 68 | public boolean contains(Point p) { 69 | return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height; 70 | } 71 | 72 | @Override 73 | public int hashCode() { 74 | final int prime = 31; 75 | int result = 1; 76 | long temp; 77 | temp = Double.doubleToLongBits(height); 78 | result = prime * result + (int) (temp ^ (temp >>> 32)); 79 | temp = Double.doubleToLongBits(width); 80 | result = prime * result + (int) (temp ^ (temp >>> 32)); 81 | temp = Double.doubleToLongBits(x); 82 | result = prime * result + (int) (temp ^ (temp >>> 32)); 83 | temp = Double.doubleToLongBits(y); 84 | result = prime * result + (int) (temp ^ (temp >>> 32)); 85 | return result; 86 | } 87 | 88 | @Override 89 | public boolean equals(Object obj) { 90 | if (this == obj) 91 | return true; 92 | if (!(obj instanceof Rect)) 93 | return false; 94 | Rect it = (Rect) obj; 95 | return x == it.x && y == it.y && width == it.width && height == it.height; 96 | } 97 | 98 | @Override 99 | public String toString() { 100 | return "{" + x + ", " + y + ", " + width + "x" + height + "}"; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/RotatedRect.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //javadoc:RotatedRect_ 4 | public class RotatedRect { 5 | 6 | public Point center; 7 | public Size size; 8 | public double angle; 9 | 10 | public RotatedRect() { 11 | this.center = new Point(); 12 | this.size = new Size(); 13 | this.angle = 0; 14 | } 15 | 16 | public RotatedRect(Point c, Size s, double a) { 17 | this.center = c.clone(); 18 | this.size = s.clone(); 19 | this.angle = a; 20 | } 21 | 22 | public RotatedRect(double[] vals) { 23 | this(); 24 | set(vals); 25 | } 26 | 27 | public void set(double[] vals) { 28 | if (vals != null) { 29 | center.x = vals.length > 0 ? (double) vals[0] : 0; 30 | center.y = vals.length > 1 ? (double) vals[1] : 0; 31 | size.width = vals.length > 2 ? (double) vals[2] : 0; 32 | size.height = vals.length > 3 ? (double) vals[3] : 0; 33 | angle = vals.length > 4 ? (double) vals[4] : 0; 34 | } else { 35 | center.x = 0; 36 | center.x = 0; 37 | size.width = 0; 38 | size.height = 0; 39 | angle = 0; 40 | } 41 | } 42 | 43 | public void points(Point pt[]) { 44 | double _angle = angle * Math.PI / 180.0; 45 | double b = (double) Math.cos(_angle) * 0.5f; 46 | double a = (double) Math.sin(_angle) * 0.5f; 47 | 48 | pt[0] = new Point(center.x - a * size.height - b * size.width, center.y + b * size.height - a * size.width); 49 | 50 | pt[1] = new Point(center.x + a * size.height - b * size.width, center.y - b * size.height - a * size.width); 51 | 52 | pt[2] = new Point(2 * center.x - pt[0].x, 2 * center.y - pt[0].y); 53 | 54 | pt[3] = new Point(2 * center.x - pt[1].x, 2 * center.y - pt[1].y); 55 | } 56 | 57 | public Rect boundingRect() { 58 | Point pt[] = new Point[4]; 59 | points(pt); 60 | 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)), 61 | (int) Math.floor(Math.min(Math.min(Math.min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)), 62 | (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)), 63 | (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].y, pt[1].y), pt[2].y), pt[3].y))); 64 | r.width -= r.x - 1; 65 | r.height -= r.y - 1; 66 | return r; 67 | } 68 | 69 | public RotatedRect clone() { 70 | return new RotatedRect(center, size, angle); 71 | } 72 | 73 | @Override 74 | public int hashCode() { 75 | final int prime = 31; 76 | int result = 1; 77 | long temp; 78 | temp = Double.doubleToLongBits(center.x); 79 | result = prime * result + (int) (temp ^ (temp >>> 32)); 80 | temp = Double.doubleToLongBits(center.y); 81 | result = prime * result + (int) (temp ^ (temp >>> 32)); 82 | temp = Double.doubleToLongBits(size.width); 83 | result = prime * result + (int) (temp ^ (temp >>> 32)); 84 | temp = Double.doubleToLongBits(size.height); 85 | result = prime * result + (int) (temp ^ (temp >>> 32)); 86 | temp = Double.doubleToLongBits(angle); 87 | result = prime * result + (int) (temp ^ (temp >>> 32)); 88 | return result; 89 | } 90 | 91 | @Override 92 | public boolean equals(Object obj) { 93 | if (this == obj) 94 | return true; 95 | if (!(obj instanceof RotatedRect)) 96 | return false; 97 | RotatedRect it = (RotatedRect) obj; 98 | return center.equals(it.center) && size.equals(it.size) && angle == it.angle; 99 | } 100 | 101 | @Override 102 | public String toString() { 103 | return "{ " + center + " " + size + " * " + angle + " }"; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/Scalar.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //javadoc:Scalar_ 4 | public class Scalar { 5 | 6 | public double val[]; 7 | 8 | public Scalar(double v0, double v1, double v2, double v3) { 9 | val = new double[] { v0, v1, v2, v3 }; 10 | } 11 | 12 | public Scalar(double v0, double v1, double v2) { 13 | val = new double[] { v0, v1, v2, 0 }; 14 | } 15 | 16 | public Scalar(double v0, double v1) { 17 | val = new double[] { v0, v1, 0, 0 }; 18 | } 19 | 20 | public Scalar(double v0) { 21 | val = new double[] { v0, 0, 0, 0 }; 22 | } 23 | 24 | public Scalar(double[] vals) { 25 | if (vals != null && vals.length == 4) 26 | val = vals.clone(); 27 | else { 28 | val = new double[4]; 29 | set(vals); 30 | } 31 | } 32 | 33 | public void set(double[] vals) { 34 | if (vals != null) { 35 | val[0] = vals.length > 0 ? vals[0] : 0; 36 | val[1] = vals.length > 1 ? vals[1] : 0; 37 | val[2] = vals.length > 2 ? vals[2] : 0; 38 | val[3] = vals.length > 3 ? vals[3] : 0; 39 | } else 40 | val[0] = val[1] = val[2] = val[3] = 0; 41 | } 42 | 43 | public static Scalar all(double v) { 44 | return new Scalar(v, v, v, v); 45 | } 46 | 47 | public Scalar clone() { 48 | return new Scalar(val); 49 | } 50 | 51 | public Scalar mul(Scalar it, double scale) { 52 | return new Scalar(val[0] * it.val[0] * scale, val[1] * it.val[1] * scale, val[2] * it.val[2] * scale, 53 | val[3] * it.val[3] * scale); 54 | } 55 | 56 | public Scalar mul(Scalar it) { 57 | return mul(it, 1); 58 | } 59 | 60 | public Scalar conj() { 61 | return new Scalar(val[0], -val[1], -val[2], -val[3]); 62 | } 63 | 64 | public boolean isReal() { 65 | return val[1] == 0 && val[2] == 0 && val[3] == 0; 66 | } 67 | 68 | @Override 69 | public int hashCode() { 70 | final int prime = 31; 71 | int result = 1; 72 | result = prime * result + java.util.Arrays.hashCode(val); 73 | return result; 74 | } 75 | 76 | @Override 77 | public boolean equals(Object obj) { 78 | if (this == obj) 79 | return true; 80 | if (!(obj instanceof Scalar)) 81 | return false; 82 | Scalar it = (Scalar) obj; 83 | if (!java.util.Arrays.equals(val, it.val)) 84 | return false; 85 | return true; 86 | } 87 | 88 | @Override 89 | public String toString() { 90 | return "[" + val[0] + ", " + val[1] + ", " + val[2] + ", " + val[3] + "]"; 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/Size.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //javadoc:Size_ 4 | public class Size { 5 | 6 | public double width, height; 7 | 8 | public Size(double width, double height) { 9 | this.width = width; 10 | this.height = height; 11 | } 12 | 13 | public Size() { 14 | this(0, 0); 15 | } 16 | 17 | public Size(Point p) { 18 | width = p.x; 19 | height = p.y; 20 | } 21 | 22 | public Size(double[] vals) { 23 | set(vals); 24 | } 25 | 26 | public void set(double[] vals) { 27 | if (vals != null) { 28 | width = vals.length > 0 ? vals[0] : 0; 29 | height = vals.length > 1 ? vals[1] : 0; 30 | } else { 31 | width = 0; 32 | height = 0; 33 | } 34 | } 35 | 36 | public double area() { 37 | return width * height; 38 | } 39 | 40 | public Size clone() { 41 | return new Size(width, height); 42 | } 43 | 44 | @Override 45 | public int hashCode() { 46 | final int prime = 31; 47 | int result = 1; 48 | long temp; 49 | temp = Double.doubleToLongBits(height); 50 | result = prime * result + (int) (temp ^ (temp >>> 32)); 51 | temp = Double.doubleToLongBits(width); 52 | result = prime * result + (int) (temp ^ (temp >>> 32)); 53 | return result; 54 | } 55 | 56 | @Override 57 | public boolean equals(Object obj) { 58 | if (this == obj) 59 | return true; 60 | if (!(obj instanceof Size)) 61 | return false; 62 | Size it = (Size) obj; 63 | return width == it.width && height == it.height; 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | return (int) width + "x" + (int) height; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/core/TermCriteria.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //javadoc:TermCriteria 4 | public class TermCriteria { 5 | 6 | /** 7 | * The maximum number of iterations or elements to compute 8 | */ 9 | public static final int COUNT = 1; 10 | /** 11 | * The maximum number of iterations or elements to compute 12 | */ 13 | public static final int MAX_ITER = COUNT; 14 | /** 15 | * The desired accuracy threshold or change in parameters at which the 16 | * iterative algorithm is terminated. 17 | */ 18 | public static final int EPS = 2; 19 | 20 | public int type; 21 | public int maxCount; 22 | public double epsilon; 23 | 24 | /** 25 | * Termination criteria for iterative algorithms. 26 | * 27 | * @param type 28 | * the type of termination criteria: COUNT, EPS or COUNT + EPS. 29 | * @param maxCount 30 | * the maximum number of iterations/elements. 31 | * @param epsilon 32 | * the desired accuracy. 33 | */ 34 | public TermCriteria(int type, int maxCount, double epsilon) { 35 | this.type = type; 36 | this.maxCount = maxCount; 37 | this.epsilon = epsilon; 38 | } 39 | 40 | /** 41 | * Termination criteria for iterative algorithms. 42 | */ 43 | public TermCriteria() { 44 | this(0, 0, 0.0); 45 | } 46 | 47 | public TermCriteria(double[] vals) { 48 | set(vals); 49 | } 50 | 51 | public void set(double[] vals) { 52 | if (vals != null) { 53 | type = vals.length > 0 ? (int) vals[0] : 0; 54 | maxCount = vals.length > 1 ? (int) vals[1] : 0; 55 | epsilon = vals.length > 2 ? (double) vals[2] : 0; 56 | } else { 57 | type = 0; 58 | maxCount = 0; 59 | epsilon = 0; 60 | } 61 | } 62 | 63 | public TermCriteria clone() { 64 | return new TermCriteria(type, maxCount, epsilon); 65 | } 66 | 67 | @Override 68 | public int hashCode() { 69 | final int prime = 31; 70 | int result = 1; 71 | long temp; 72 | temp = Double.doubleToLongBits(type); 73 | result = prime * result + (int) (temp ^ (temp >>> 32)); 74 | temp = Double.doubleToLongBits(maxCount); 75 | result = prime * result + (int) (temp ^ (temp >>> 32)); 76 | temp = Double.doubleToLongBits(epsilon); 77 | result = prime * result + (int) (temp ^ (temp >>> 32)); 78 | return result; 79 | } 80 | 81 | @Override 82 | public boolean equals(Object obj) { 83 | if (this == obj) 84 | return true; 85 | if (!(obj instanceof TermCriteria)) 86 | return false; 87 | TermCriteria it = (TermCriteria) obj; 88 | return type == it.type && maxCount == it.maxCount && epsilon == it.epsilon; 89 | } 90 | 91 | @Override 92 | public String toString() { 93 | return "{ type: " + type + ", maxCount: " + maxCount + ", epsilon: " + epsilon + "}"; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/features2d/DescriptorExtractor.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.features2d; 6 | 7 | import java.lang.String; 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | import org.opencv.core.Mat; 11 | import org.opencv.core.MatOfKeyPoint; 12 | import org.opencv.utils.Converters; 13 | 14 | // C++: class javaDescriptorExtractor 15 | //javadoc: javaDescriptorExtractor 16 | public class DescriptorExtractor { 17 | 18 | protected final long nativeObj; 19 | 20 | protected DescriptorExtractor(long addr) { 21 | nativeObj = addr; 22 | } 23 | 24 | private static final int OPPONENTEXTRACTOR = 1000; 25 | 26 | public static final int SIFT = 1, SURF = 2, ORB = 3, BRIEF = 4, BRISK = 5, FREAK = 6, AKAZE = 7, 27 | OPPONENT_SIFT = OPPONENTEXTRACTOR + SIFT, OPPONENT_SURF = OPPONENTEXTRACTOR + SURF, 28 | OPPONENT_ORB = OPPONENTEXTRACTOR + ORB, OPPONENT_BRIEF = OPPONENTEXTRACTOR + BRIEF, 29 | OPPONENT_BRISK = OPPONENTEXTRACTOR + BRISK, OPPONENT_FREAK = OPPONENTEXTRACTOR + FREAK, 30 | OPPONENT_AKAZE = OPPONENTEXTRACTOR + AKAZE; 31 | 32 | // 33 | // C++: bool empty() 34 | // 35 | 36 | // javadoc: javaDescriptorExtractor::empty() 37 | public boolean empty() { 38 | 39 | boolean retVal = empty_0(nativeObj); 40 | 41 | return retVal; 42 | } 43 | 44 | // 45 | // C++: int descriptorSize() 46 | // 47 | 48 | // javadoc: javaDescriptorExtractor::descriptorSize() 49 | public int descriptorSize() { 50 | 51 | int retVal = descriptorSize_0(nativeObj); 52 | 53 | return retVal; 54 | } 55 | 56 | // 57 | // C++: int descriptorType() 58 | // 59 | 60 | // javadoc: javaDescriptorExtractor::descriptorType() 61 | public int descriptorType() { 62 | 63 | int retVal = descriptorType_0(nativeObj); 64 | 65 | return retVal; 66 | } 67 | 68 | // 69 | // C++: static javaDescriptorExtractor* create(int extractorType) 70 | // 71 | 72 | // javadoc: javaDescriptorExtractor::create(extractorType) 73 | public static DescriptorExtractor create(int extractorType) { 74 | 75 | DescriptorExtractor retVal = new DescriptorExtractor(create_0(extractorType)); 76 | 77 | return retVal; 78 | } 79 | 80 | // 81 | // C++: void compute(Mat image, vector_KeyPoint& keypoints, Mat descriptors) 82 | // 83 | 84 | // javadoc: javaDescriptorExtractor::compute(image, keypoints, descriptors) 85 | public void compute(Mat image, MatOfKeyPoint keypoints, Mat descriptors) { 86 | Mat keypoints_mat = keypoints; 87 | compute_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, descriptors.nativeObj); 88 | 89 | return; 90 | } 91 | 92 | // 93 | // C++: void compute(vector_Mat images, vector_vector_KeyPoint& keypoints, 94 | // vector_Mat& descriptors) 95 | // 96 | 97 | // javadoc: javaDescriptorExtractor::compute(images, keypoints, descriptors) 98 | public void compute(List images, List keypoints, List descriptors) { 99 | Mat images_mat = Converters.vector_Mat_to_Mat(images); 100 | List keypoints_tmplm = new ArrayList((keypoints != null) ? keypoints.size() : 0); 101 | Mat keypoints_mat = Converters.vector_vector_KeyPoint_to_Mat(keypoints, keypoints_tmplm); 102 | Mat descriptors_mat = new Mat(); 103 | compute_1(nativeObj, images_mat.nativeObj, keypoints_mat.nativeObj, descriptors_mat.nativeObj); 104 | Converters.Mat_to_vector_vector_KeyPoint(keypoints_mat, keypoints); 105 | keypoints_mat.release(); 106 | Converters.Mat_to_vector_Mat(descriptors_mat, descriptors); 107 | descriptors_mat.release(); 108 | return; 109 | } 110 | 111 | // 112 | // C++: void read(String fileName) 113 | // 114 | 115 | // javadoc: javaDescriptorExtractor::read(fileName) 116 | public void read(String fileName) { 117 | 118 | read_0(nativeObj, fileName); 119 | 120 | return; 121 | } 122 | 123 | // 124 | // C++: void write(String fileName) 125 | // 126 | 127 | // javadoc: javaDescriptorExtractor::write(fileName) 128 | public void write(String fileName) { 129 | 130 | write_0(nativeObj, fileName); 131 | 132 | return; 133 | } 134 | 135 | @Override 136 | protected void finalize() throws Throwable { 137 | delete(nativeObj); 138 | } 139 | 140 | // C++: bool empty() 141 | private static native boolean empty_0(long nativeObj); 142 | 143 | // C++: int descriptorSize() 144 | private static native int descriptorSize_0(long nativeObj); 145 | 146 | // C++: int descriptorType() 147 | private static native int descriptorType_0(long nativeObj); 148 | 149 | // C++: static javaDescriptorExtractor* create(int extractorType) 150 | private static native long create_0(int extractorType); 151 | 152 | // C++: void compute(Mat image, vector_KeyPoint& keypoints, Mat descriptors) 153 | private static native void compute_0(long nativeObj, long image_nativeObj, long keypoints_mat_nativeObj, 154 | long descriptors_nativeObj); 155 | 156 | // C++: void compute(vector_Mat images, vector_vector_KeyPoint& keypoints, 157 | // vector_Mat& descriptors) 158 | private static native void compute_1(long nativeObj, long images_mat_nativeObj, long keypoints_mat_nativeObj, 159 | long descriptors_mat_nativeObj); 160 | 161 | // C++: void read(String fileName) 162 | private static native void read_0(long nativeObj, String fileName); 163 | 164 | // C++: void write(String fileName) 165 | private static native void write_0(long nativeObj, String fileName); 166 | 167 | // native support for java finalize() 168 | private static native void delete(long nativeObj); 169 | 170 | } 171 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/imgproc/CLAHE.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.imgproc; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | import org.opencv.core.Size; 10 | 11 | // C++: class CLAHE 12 | //javadoc: CLAHE 13 | public class CLAHE extends Algorithm { 14 | 15 | protected CLAHE(long addr) { 16 | super(addr); 17 | } 18 | 19 | // 20 | // C++: Size getTilesGridSize() 21 | // 22 | 23 | // javadoc: CLAHE::getTilesGridSize() 24 | public Size getTilesGridSize() { 25 | 26 | Size retVal = new Size(getTilesGridSize_0(nativeObj)); 27 | 28 | return retVal; 29 | } 30 | 31 | // 32 | // C++: double getClipLimit() 33 | // 34 | 35 | // javadoc: CLAHE::getClipLimit() 36 | public double getClipLimit() { 37 | 38 | double retVal = getClipLimit_0(nativeObj); 39 | 40 | return retVal; 41 | } 42 | 43 | // 44 | // C++: void apply(Mat src, Mat& dst) 45 | // 46 | 47 | // javadoc: CLAHE::apply(src, dst) 48 | public void apply(Mat src, Mat dst) { 49 | 50 | apply_0(nativeObj, src.nativeObj, dst.nativeObj); 51 | 52 | return; 53 | } 54 | 55 | // 56 | // C++: void collectGarbage() 57 | // 58 | 59 | // javadoc: CLAHE::collectGarbage() 60 | public void collectGarbage() { 61 | 62 | collectGarbage_0(nativeObj); 63 | 64 | return; 65 | } 66 | 67 | // 68 | // C++: void setClipLimit(double clipLimit) 69 | // 70 | 71 | // javadoc: CLAHE::setClipLimit(clipLimit) 72 | public void setClipLimit(double clipLimit) { 73 | 74 | setClipLimit_0(nativeObj, clipLimit); 75 | 76 | return; 77 | } 78 | 79 | // 80 | // C++: void setTilesGridSize(Size tileGridSize) 81 | // 82 | 83 | // javadoc: CLAHE::setTilesGridSize(tileGridSize) 84 | public void setTilesGridSize(Size tileGridSize) { 85 | 86 | setTilesGridSize_0(nativeObj, tileGridSize.width, tileGridSize.height); 87 | 88 | return; 89 | } 90 | 91 | @Override 92 | protected void finalize() throws Throwable { 93 | delete(nativeObj); 94 | } 95 | 96 | // C++: Size getTilesGridSize() 97 | private static native double[] getTilesGridSize_0(long nativeObj); 98 | 99 | // C++: double getClipLimit() 100 | private static native double getClipLimit_0(long nativeObj); 101 | 102 | // C++: void apply(Mat src, Mat& dst) 103 | private static native void apply_0(long nativeObj, long src_nativeObj, long dst_nativeObj); 104 | 105 | // C++: void collectGarbage() 106 | private static native void collectGarbage_0(long nativeObj); 107 | 108 | // C++: void setClipLimit(double clipLimit) 109 | private static native void setClipLimit_0(long nativeObj, double clipLimit); 110 | 111 | // C++: void setTilesGridSize(Size tileGridSize) 112 | private static native void setTilesGridSize_0(long nativeObj, double tileGridSize_width, 113 | double tileGridSize_height); 114 | 115 | // native support for java finalize() 116 | private static native void delete(long nativeObj); 117 | 118 | } 119 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/imgproc/LineSegmentDetector.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.imgproc; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | import org.opencv.core.Size; 10 | 11 | // C++: class LineSegmentDetector 12 | //javadoc: LineSegmentDetector 13 | public class LineSegmentDetector extends Algorithm { 14 | 15 | protected LineSegmentDetector(long addr) { 16 | super(addr); 17 | } 18 | 19 | // 20 | // C++: int compareSegments(Size size, Mat lines1, Mat lines2, Mat& _image = 21 | // Mat()) 22 | // 23 | 24 | // javadoc: LineSegmentDetector::compareSegments(size, lines1, lines2, 25 | // _image) 26 | public int compareSegments(Size size, Mat lines1, Mat lines2, Mat _image) { 27 | 28 | int retVal = compareSegments_0(nativeObj, size.width, size.height, lines1.nativeObj, lines2.nativeObj, 29 | _image.nativeObj); 30 | 31 | return retVal; 32 | } 33 | 34 | // javadoc: LineSegmentDetector::compareSegments(size, lines1, lines2) 35 | public int compareSegments(Size size, Mat lines1, Mat lines2) { 36 | 37 | int retVal = compareSegments_1(nativeObj, size.width, size.height, lines1.nativeObj, lines2.nativeObj); 38 | 39 | return retVal; 40 | } 41 | 42 | // 43 | // C++: void detect(Mat _image, Mat& _lines, Mat& width = Mat(), Mat& prec = 44 | // Mat(), Mat& nfa = Mat()) 45 | // 46 | 47 | // javadoc: LineSegmentDetector::detect(_image, _lines, width, prec, nfa) 48 | public void detect(Mat _image, Mat _lines, Mat width, Mat prec, Mat nfa) { 49 | 50 | detect_0(nativeObj, _image.nativeObj, _lines.nativeObj, width.nativeObj, prec.nativeObj, nfa.nativeObj); 51 | 52 | return; 53 | } 54 | 55 | // javadoc: LineSegmentDetector::detect(_image, _lines) 56 | public void detect(Mat _image, Mat _lines) { 57 | 58 | detect_1(nativeObj, _image.nativeObj, _lines.nativeObj); 59 | 60 | return; 61 | } 62 | 63 | // 64 | // C++: void drawSegments(Mat& _image, Mat lines) 65 | // 66 | 67 | // javadoc: LineSegmentDetector::drawSegments(_image, lines) 68 | public void drawSegments(Mat _image, Mat lines) { 69 | 70 | drawSegments_0(nativeObj, _image.nativeObj, lines.nativeObj); 71 | 72 | return; 73 | } 74 | 75 | @Override 76 | protected void finalize() throws Throwable { 77 | delete(nativeObj); 78 | } 79 | 80 | // C++: int compareSegments(Size size, Mat lines1, Mat lines2, Mat& _image = 81 | // Mat()) 82 | private static native int compareSegments_0(long nativeObj, double size_width, double size_height, 83 | long lines1_nativeObj, long lines2_nativeObj, long _image_nativeObj); 84 | 85 | private static native int compareSegments_1(long nativeObj, double size_width, double size_height, 86 | long lines1_nativeObj, long lines2_nativeObj); 87 | 88 | // C++: void detect(Mat _image, Mat& _lines, Mat& width = Mat(), Mat& prec = 89 | // Mat(), Mat& nfa = Mat()) 90 | private static native void detect_0(long nativeObj, long _image_nativeObj, long _lines_nativeObj, 91 | long width_nativeObj, long prec_nativeObj, long nfa_nativeObj); 92 | 93 | private static native void detect_1(long nativeObj, long _image_nativeObj, long _lines_nativeObj); 94 | 95 | // C++: void drawSegments(Mat& _image, Mat lines) 96 | private static native void drawSegments_0(long nativeObj, long _image_nativeObj, long lines_nativeObj); 97 | 98 | // native support for java finalize() 99 | private static native void delete(long nativeObj); 100 | 101 | } 102 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/ml/Boost.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | // C++: class Boost 8 | //javadoc: Boost 9 | public class Boost extends DTrees { 10 | 11 | protected Boost(long addr) { 12 | super(addr); 13 | } 14 | 15 | public static final int DISCRETE = 0, REAL = 1, LOGIT = 2, GENTLE = 3; 16 | 17 | // 18 | // C++: static Ptr_Boost create() 19 | // 20 | 21 | // javadoc: Boost::create() 22 | public static Boost create() { 23 | 24 | Boost retVal = new Boost(create_0()); 25 | 26 | return retVal; 27 | } 28 | 29 | // 30 | // C++: double getWeightTrimRate() 31 | // 32 | 33 | // javadoc: Boost::getWeightTrimRate() 34 | public double getWeightTrimRate() { 35 | 36 | double retVal = getWeightTrimRate_0(nativeObj); 37 | 38 | return retVal; 39 | } 40 | 41 | // 42 | // C++: int getBoostType() 43 | // 44 | 45 | // javadoc: Boost::getBoostType() 46 | public int getBoostType() { 47 | 48 | int retVal = getBoostType_0(nativeObj); 49 | 50 | return retVal; 51 | } 52 | 53 | // 54 | // C++: int getWeakCount() 55 | // 56 | 57 | // javadoc: Boost::getWeakCount() 58 | public int getWeakCount() { 59 | 60 | int retVal = getWeakCount_0(nativeObj); 61 | 62 | return retVal; 63 | } 64 | 65 | // 66 | // C++: void setBoostType(int val) 67 | // 68 | 69 | // javadoc: Boost::setBoostType(val) 70 | public void setBoostType(int val) { 71 | 72 | setBoostType_0(nativeObj, val); 73 | 74 | return; 75 | } 76 | 77 | // 78 | // C++: void setWeakCount(int val) 79 | // 80 | 81 | // javadoc: Boost::setWeakCount(val) 82 | public void setWeakCount(int val) { 83 | 84 | setWeakCount_0(nativeObj, val); 85 | 86 | return; 87 | } 88 | 89 | // 90 | // C++: void setWeightTrimRate(double val) 91 | // 92 | 93 | // javadoc: Boost::setWeightTrimRate(val) 94 | public void setWeightTrimRate(double val) { 95 | 96 | setWeightTrimRate_0(nativeObj, val); 97 | 98 | return; 99 | } 100 | 101 | @Override 102 | protected void finalize() throws Throwable { 103 | delete(nativeObj); 104 | } 105 | 106 | // C++: static Ptr_Boost create() 107 | private static native long create_0(); 108 | 109 | // C++: double getWeightTrimRate() 110 | private static native double getWeightTrimRate_0(long nativeObj); 111 | 112 | // C++: int getBoostType() 113 | private static native int getBoostType_0(long nativeObj); 114 | 115 | // C++: int getWeakCount() 116 | private static native int getWeakCount_0(long nativeObj); 117 | 118 | // C++: void setBoostType(int val) 119 | private static native void setBoostType_0(long nativeObj, int val); 120 | 121 | // C++: void setWeakCount(int val) 122 | private static native void setWeakCount_0(long nativeObj, int val); 123 | 124 | // C++: void setWeightTrimRate(double val) 125 | private static native void setWeightTrimRate_0(long nativeObj, double val); 126 | 127 | // native support for java finalize() 128 | private static native void delete(long nativeObj); 129 | 130 | } 131 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/ml/KNearest.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | import org.opencv.core.Mat; 8 | 9 | // C++: class KNearest 10 | //javadoc: KNearest 11 | public class KNearest extends StatModel { 12 | 13 | protected KNearest(long addr) { 14 | super(addr); 15 | } 16 | 17 | public static final int BRUTE_FORCE = 1, KDTREE = 2; 18 | 19 | // 20 | // C++: static Ptr_KNearest create() 21 | // 22 | 23 | // javadoc: KNearest::create() 24 | public static KNearest create() { 25 | 26 | KNearest retVal = new KNearest(create_0()); 27 | 28 | return retVal; 29 | } 30 | 31 | // 32 | // C++: bool getIsClassifier() 33 | // 34 | 35 | // javadoc: KNearest::getIsClassifier() 36 | public boolean getIsClassifier() { 37 | 38 | boolean retVal = getIsClassifier_0(nativeObj); 39 | 40 | return retVal; 41 | } 42 | 43 | // 44 | // C++: float findNearest(Mat samples, int k, Mat& results, Mat& 45 | // neighborResponses = Mat(), Mat& dist = Mat()) 46 | // 47 | 48 | // javadoc: KNearest::findNearest(samples, k, results, neighborResponses, 49 | // dist) 50 | public float findNearest(Mat samples, int k, Mat results, Mat neighborResponses, Mat dist) { 51 | 52 | float retVal = findNearest_0(nativeObj, samples.nativeObj, k, results.nativeObj, neighborResponses.nativeObj, 53 | dist.nativeObj); 54 | 55 | return retVal; 56 | } 57 | 58 | // javadoc: KNearest::findNearest(samples, k, results) 59 | public float findNearest(Mat samples, int k, Mat results) { 60 | 61 | float retVal = findNearest_1(nativeObj, samples.nativeObj, k, results.nativeObj); 62 | 63 | return retVal; 64 | } 65 | 66 | // 67 | // C++: int getAlgorithmType() 68 | // 69 | 70 | // javadoc: KNearest::getAlgorithmType() 71 | public int getAlgorithmType() { 72 | 73 | int retVal = getAlgorithmType_0(nativeObj); 74 | 75 | return retVal; 76 | } 77 | 78 | // 79 | // C++: int getDefaultK() 80 | // 81 | 82 | // javadoc: KNearest::getDefaultK() 83 | public int getDefaultK() { 84 | 85 | int retVal = getDefaultK_0(nativeObj); 86 | 87 | return retVal; 88 | } 89 | 90 | // 91 | // C++: int getEmax() 92 | // 93 | 94 | // javadoc: KNearest::getEmax() 95 | public int getEmax() { 96 | 97 | int retVal = getEmax_0(nativeObj); 98 | 99 | return retVal; 100 | } 101 | 102 | // 103 | // C++: void setAlgorithmType(int val) 104 | // 105 | 106 | // javadoc: KNearest::setAlgorithmType(val) 107 | public void setAlgorithmType(int val) { 108 | 109 | setAlgorithmType_0(nativeObj, val); 110 | 111 | return; 112 | } 113 | 114 | // 115 | // C++: void setDefaultK(int val) 116 | // 117 | 118 | // javadoc: KNearest::setDefaultK(val) 119 | public void setDefaultK(int val) { 120 | 121 | setDefaultK_0(nativeObj, val); 122 | 123 | return; 124 | } 125 | 126 | // 127 | // C++: void setEmax(int val) 128 | // 129 | 130 | // javadoc: KNearest::setEmax(val) 131 | public void setEmax(int val) { 132 | 133 | setEmax_0(nativeObj, val); 134 | 135 | return; 136 | } 137 | 138 | // 139 | // C++: void setIsClassifier(bool val) 140 | // 141 | 142 | // javadoc: KNearest::setIsClassifier(val) 143 | public void setIsClassifier(boolean val) { 144 | 145 | setIsClassifier_0(nativeObj, val); 146 | 147 | return; 148 | } 149 | 150 | @Override 151 | protected void finalize() throws Throwable { 152 | delete(nativeObj); 153 | } 154 | 155 | // C++: static Ptr_KNearest create() 156 | private static native long create_0(); 157 | 158 | // C++: bool getIsClassifier() 159 | private static native boolean getIsClassifier_0(long nativeObj); 160 | 161 | // C++: float findNearest(Mat samples, int k, Mat& results, Mat& 162 | // neighborResponses = Mat(), Mat& dist = Mat()) 163 | private static native float findNearest_0(long nativeObj, long samples_nativeObj, int k, long results_nativeObj, 164 | long neighborResponses_nativeObj, long dist_nativeObj); 165 | 166 | private static native float findNearest_1(long nativeObj, long samples_nativeObj, int k, long results_nativeObj); 167 | 168 | // C++: int getAlgorithmType() 169 | private static native int getAlgorithmType_0(long nativeObj); 170 | 171 | // C++: int getDefaultK() 172 | private static native int getDefaultK_0(long nativeObj); 173 | 174 | // C++: int getEmax() 175 | private static native int getEmax_0(long nativeObj); 176 | 177 | // C++: void setAlgorithmType(int val) 178 | private static native void setAlgorithmType_0(long nativeObj, int val); 179 | 180 | // C++: void setDefaultK(int val) 181 | private static native void setDefaultK_0(long nativeObj, int val); 182 | 183 | // C++: void setEmax(int val) 184 | private static native void setEmax_0(long nativeObj, int val); 185 | 186 | // C++: void setIsClassifier(bool val) 187 | private static native void setIsClassifier_0(long nativeObj, boolean val); 188 | 189 | // native support for java finalize() 190 | private static native void delete(long nativeObj); 191 | 192 | } 193 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/ml/Ml.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | public class Ml { 8 | 9 | public static final int VAR_NUMERICAL = 0, VAR_ORDERED = 0, VAR_CATEGORICAL = 1, TEST_ERROR = 0, TRAIN_ERROR = 1, 10 | ROW_SAMPLE = 0, COL_SAMPLE = 1; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/ml/NormalBayesClassifier.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | import org.opencv.core.Mat; 8 | 9 | // C++: class NormalBayesClassifier 10 | //javadoc: NormalBayesClassifier 11 | public class NormalBayesClassifier extends StatModel { 12 | 13 | protected NormalBayesClassifier(long addr) { 14 | super(addr); 15 | } 16 | 17 | // 18 | // C++: static Ptr_NormalBayesClassifier create() 19 | // 20 | 21 | // javadoc: NormalBayesClassifier::create() 22 | public static NormalBayesClassifier create() { 23 | 24 | NormalBayesClassifier retVal = new NormalBayesClassifier(create_0()); 25 | 26 | return retVal; 27 | } 28 | 29 | // 30 | // C++: float predictProb(Mat inputs, Mat& outputs, Mat& outputProbs, int 31 | // flags = 0) 32 | // 33 | 34 | // javadoc: NormalBayesClassifier::predictProb(inputs, outputs, outputProbs, 35 | // flags) 36 | public float predictProb(Mat inputs, Mat outputs, Mat outputProbs, int flags) { 37 | 38 | float retVal = predictProb_0(nativeObj, inputs.nativeObj, outputs.nativeObj, outputProbs.nativeObj, flags); 39 | 40 | return retVal; 41 | } 42 | 43 | // javadoc: NormalBayesClassifier::predictProb(inputs, outputs, outputProbs) 44 | public float predictProb(Mat inputs, Mat outputs, Mat outputProbs) { 45 | 46 | float retVal = predictProb_1(nativeObj, inputs.nativeObj, outputs.nativeObj, outputProbs.nativeObj); 47 | 48 | return retVal; 49 | } 50 | 51 | @Override 52 | protected void finalize() throws Throwable { 53 | delete(nativeObj); 54 | } 55 | 56 | // C++: static Ptr_NormalBayesClassifier create() 57 | private static native long create_0(); 58 | 59 | // C++: float predictProb(Mat inputs, Mat& outputs, Mat& outputProbs, int 60 | // flags = 0) 61 | private static native float predictProb_0(long nativeObj, long inputs_nativeObj, long outputs_nativeObj, 62 | long outputProbs_nativeObj, int flags); 63 | 64 | private static native float predictProb_1(long nativeObj, long inputs_nativeObj, long outputs_nativeObj, 65 | long outputProbs_nativeObj); 66 | 67 | // native support for java finalize() 68 | private static native void delete(long nativeObj); 69 | 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/ml/RTrees.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | import org.opencv.core.Mat; 8 | import org.opencv.core.TermCriteria; 9 | 10 | // C++: class RTrees 11 | //javadoc: RTrees 12 | public class RTrees extends DTrees { 13 | 14 | protected RTrees(long addr) { 15 | super(addr); 16 | } 17 | 18 | // 19 | // C++: Mat getVarImportance() 20 | // 21 | 22 | // javadoc: RTrees::getVarImportance() 23 | public Mat getVarImportance() { 24 | 25 | Mat retVal = new Mat(getVarImportance_0(nativeObj)); 26 | 27 | return retVal; 28 | } 29 | 30 | // 31 | // C++: static Ptr_RTrees create() 32 | // 33 | 34 | // javadoc: RTrees::create() 35 | public static RTrees create() { 36 | 37 | RTrees retVal = new RTrees(create_0()); 38 | 39 | return retVal; 40 | } 41 | 42 | // 43 | // C++: TermCriteria getTermCriteria() 44 | // 45 | 46 | // javadoc: RTrees::getTermCriteria() 47 | public TermCriteria getTermCriteria() { 48 | 49 | TermCriteria retVal = new TermCriteria(getTermCriteria_0(nativeObj)); 50 | 51 | return retVal; 52 | } 53 | 54 | // 55 | // C++: bool getCalculateVarImportance() 56 | // 57 | 58 | // javadoc: RTrees::getCalculateVarImportance() 59 | public boolean getCalculateVarImportance() { 60 | 61 | boolean retVal = getCalculateVarImportance_0(nativeObj); 62 | 63 | return retVal; 64 | } 65 | 66 | // 67 | // C++: int getActiveVarCount() 68 | // 69 | 70 | // javadoc: RTrees::getActiveVarCount() 71 | public int getActiveVarCount() { 72 | 73 | int retVal = getActiveVarCount_0(nativeObj); 74 | 75 | return retVal; 76 | } 77 | 78 | // 79 | // C++: void setActiveVarCount(int val) 80 | // 81 | 82 | // javadoc: RTrees::setActiveVarCount(val) 83 | public void setActiveVarCount(int val) { 84 | 85 | setActiveVarCount_0(nativeObj, val); 86 | 87 | return; 88 | } 89 | 90 | // 91 | // C++: void setCalculateVarImportance(bool val) 92 | // 93 | 94 | // javadoc: RTrees::setCalculateVarImportance(val) 95 | public void setCalculateVarImportance(boolean val) { 96 | 97 | setCalculateVarImportance_0(nativeObj, val); 98 | 99 | return; 100 | } 101 | 102 | // 103 | // C++: void setTermCriteria(TermCriteria val) 104 | // 105 | 106 | // javadoc: RTrees::setTermCriteria(val) 107 | public void setTermCriteria(TermCriteria val) { 108 | 109 | setTermCriteria_0(nativeObj, val.type, val.maxCount, val.epsilon); 110 | 111 | return; 112 | } 113 | 114 | @Override 115 | protected void finalize() throws Throwable { 116 | delete(nativeObj); 117 | } 118 | 119 | // C++: Mat getVarImportance() 120 | private static native long getVarImportance_0(long nativeObj); 121 | 122 | // C++: static Ptr_RTrees create() 123 | private static native long create_0(); 124 | 125 | // C++: TermCriteria getTermCriteria() 126 | private static native double[] getTermCriteria_0(long nativeObj); 127 | 128 | // C++: bool getCalculateVarImportance() 129 | private static native boolean getCalculateVarImportance_0(long nativeObj); 130 | 131 | // C++: int getActiveVarCount() 132 | private static native int getActiveVarCount_0(long nativeObj); 133 | 134 | // C++: void setActiveVarCount(int val) 135 | private static native void setActiveVarCount_0(long nativeObj, int val); 136 | 137 | // C++: void setCalculateVarImportance(bool val) 138 | private static native void setCalculateVarImportance_0(long nativeObj, boolean val); 139 | 140 | // C++: void setTermCriteria(TermCriteria val) 141 | private static native void setTermCriteria_0(long nativeObj, int val_type, int val_maxCount, double val_epsilon); 142 | 143 | // native support for java finalize() 144 | private static native void delete(long nativeObj); 145 | 146 | } 147 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/ml/StatModel.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | 10 | // C++: class StatModel 11 | //javadoc: StatModel 12 | public class StatModel extends Algorithm { 13 | 14 | protected StatModel(long addr) { 15 | super(addr); 16 | } 17 | 18 | public static final int UPDATE_MODEL = 1, RAW_OUTPUT = 1, COMPRESSED_INPUT = 2, PREPROCESSED_INPUT = 4; 19 | 20 | // 21 | // C++: bool empty() 22 | // 23 | 24 | // javadoc: StatModel::empty() 25 | public boolean empty() { 26 | 27 | boolean retVal = empty_0(nativeObj); 28 | 29 | return retVal; 30 | } 31 | 32 | // 33 | // C++: bool isClassifier() 34 | // 35 | 36 | // javadoc: StatModel::isClassifier() 37 | public boolean isClassifier() { 38 | 39 | boolean retVal = isClassifier_0(nativeObj); 40 | 41 | return retVal; 42 | } 43 | 44 | // 45 | // C++: bool isTrained() 46 | // 47 | 48 | // javadoc: StatModel::isTrained() 49 | public boolean isTrained() { 50 | 51 | boolean retVal = isTrained_0(nativeObj); 52 | 53 | return retVal; 54 | } 55 | 56 | // 57 | // C++: bool train(Mat samples, int layout, Mat responses) 58 | // 59 | 60 | // javadoc: StatModel::train(samples, layout, responses) 61 | public boolean train(Mat samples, int layout, Mat responses) { 62 | 63 | boolean retVal = train_0(nativeObj, samples.nativeObj, layout, responses.nativeObj); 64 | 65 | return retVal; 66 | } 67 | 68 | // 69 | // C++: bool train(Ptr_TrainData trainData, int flags = 0) 70 | // 71 | 72 | // Unknown type 'Ptr_TrainData' (I), skipping the function 73 | 74 | // 75 | // C++: float calcError(Ptr_TrainData data, bool test, Mat& resp) 76 | // 77 | 78 | // Unknown type 'Ptr_TrainData' (I), skipping the function 79 | 80 | // 81 | // C++: float predict(Mat samples, Mat& results = Mat(), int flags = 0) 82 | // 83 | 84 | // javadoc: StatModel::predict(samples, results, flags) 85 | public float predict(Mat samples, Mat results, int flags) { 86 | 87 | float retVal = predict_0(nativeObj, samples.nativeObj, results.nativeObj, flags); 88 | 89 | return retVal; 90 | } 91 | 92 | // javadoc: StatModel::predict(samples) 93 | public float predict(Mat samples) { 94 | 95 | float retVal = predict_1(nativeObj, samples.nativeObj); 96 | 97 | return retVal; 98 | } 99 | 100 | // 101 | // C++: int getVarCount() 102 | // 103 | 104 | // javadoc: StatModel::getVarCount() 105 | public int getVarCount() { 106 | 107 | int retVal = getVarCount_0(nativeObj); 108 | 109 | return retVal; 110 | } 111 | 112 | @Override 113 | protected void finalize() throws Throwable { 114 | delete(nativeObj); 115 | } 116 | 117 | // C++: bool empty() 118 | private static native boolean empty_0(long nativeObj); 119 | 120 | // C++: bool isClassifier() 121 | private static native boolean isClassifier_0(long nativeObj); 122 | 123 | // C++: bool isTrained() 124 | private static native boolean isTrained_0(long nativeObj); 125 | 126 | // C++: bool train(Mat samples, int layout, Mat responses) 127 | private static native boolean train_0(long nativeObj, long samples_nativeObj, int layout, long responses_nativeObj); 128 | 129 | // C++: float predict(Mat samples, Mat& results = Mat(), int flags = 0) 130 | private static native float predict_0(long nativeObj, long samples_nativeObj, long results_nativeObj, int flags); 131 | 132 | private static native float predict_1(long nativeObj, long samples_nativeObj); 133 | 134 | // C++: int getVarCount() 135 | private static native int getVarCount_0(long nativeObj); 136 | 137 | // native support for java finalize() 138 | private static native void delete(long nativeObj); 139 | 140 | } 141 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/objdetect/BaseCascadeClassifier.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.objdetect; 6 | 7 | import org.opencv.core.Algorithm; 8 | 9 | // C++: class BaseCascadeClassifier 10 | //javadoc: BaseCascadeClassifier 11 | public class BaseCascadeClassifier extends Algorithm { 12 | 13 | protected BaseCascadeClassifier(long addr) { 14 | super(addr); 15 | } 16 | 17 | @Override 18 | protected void finalize() throws Throwable { 19 | delete(nativeObj); 20 | } 21 | 22 | // native support for java finalize() 23 | private static native void delete(long nativeObj); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/objdetect/Objdetect.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.objdetect; 6 | 7 | import java.util.ArrayList; 8 | import org.opencv.core.Mat; 9 | import org.opencv.core.MatOfInt; 10 | import org.opencv.core.MatOfRect; 11 | 12 | public class Objdetect { 13 | 14 | public static final int CASCADE_DO_CANNY_PRUNING = 1, CASCADE_SCALE_IMAGE = 2, CASCADE_FIND_BIGGEST_OBJECT = 4, 15 | CASCADE_DO_ROUGH_SEARCH = 8; 16 | 17 | // 18 | // C++: void groupRectangles(vector_Rect& rectList, vector_int& weights, int 19 | // groupThreshold, double eps = 0.2) 20 | // 21 | 22 | // javadoc: groupRectangles(rectList, weights, groupThreshold, eps) 23 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps) { 24 | Mat rectList_mat = rectList; 25 | Mat weights_mat = weights; 26 | groupRectangles_0(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold, eps); 27 | 28 | return; 29 | } 30 | 31 | // javadoc: groupRectangles(rectList, weights, groupThreshold) 32 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold) { 33 | Mat rectList_mat = rectList; 34 | Mat weights_mat = weights; 35 | groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold); 36 | 37 | return; 38 | } 39 | 40 | // C++: void groupRectangles(vector_Rect& rectList, vector_int& weights, int 41 | // groupThreshold, double eps = 0.2) 42 | private static native void groupRectangles_0(long rectList_mat_nativeObj, long weights_mat_nativeObj, 43 | int groupThreshold, double eps); 44 | 45 | private static native void groupRectangles_1(long rectList_mat_nativeObj, long weights_mat_nativeObj, 46 | int groupThreshold); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/AlignExposures.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Algorithm; 10 | import org.opencv.core.Mat; 11 | import org.opencv.utils.Converters; 12 | 13 | // C++: class AlignExposures 14 | //javadoc: AlignExposures 15 | public class AlignExposures extends Algorithm { 16 | 17 | protected AlignExposures(long addr) { 18 | super(addr); 19 | } 20 | 21 | // 22 | // C++: void process(vector_Mat src, vector_Mat dst, Mat times, Mat 23 | // response) 24 | // 25 | 26 | // javadoc: AlignExposures::process(src, dst, times, response) 27 | public void process(List src, List dst, Mat times, Mat response) { 28 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 29 | Mat dst_mat = Converters.vector_Mat_to_Mat(dst); 30 | process_0(nativeObj, src_mat.nativeObj, dst_mat.nativeObj, times.nativeObj, response.nativeObj); 31 | 32 | return; 33 | } 34 | 35 | @Override 36 | protected void finalize() throws Throwable { 37 | delete(nativeObj); 38 | } 39 | 40 | // C++: void process(vector_Mat src, vector_Mat dst, Mat times, Mat 41 | // response) 42 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_mat_nativeObj, 43 | long times_nativeObj, long response_nativeObj); 44 | 45 | // native support for java finalize() 46 | private static native void delete(long nativeObj); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/AlignMTB.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Mat; 10 | import org.opencv.core.Point; 11 | import org.opencv.utils.Converters; 12 | 13 | // C++: class AlignMTB 14 | //javadoc: AlignMTB 15 | public class AlignMTB extends AlignExposures { 16 | 17 | protected AlignMTB(long addr) { 18 | super(addr); 19 | } 20 | 21 | // 22 | // C++: Point calculateShift(Mat img0, Mat img1) 23 | // 24 | 25 | // javadoc: AlignMTB::calculateShift(img0, img1) 26 | public Point calculateShift(Mat img0, Mat img1) { 27 | 28 | Point retVal = new Point(calculateShift_0(nativeObj, img0.nativeObj, img1.nativeObj)); 29 | 30 | return retVal; 31 | } 32 | 33 | // 34 | // C++: bool getCut() 35 | // 36 | 37 | // javadoc: AlignMTB::getCut() 38 | public boolean getCut() { 39 | 40 | boolean retVal = getCut_0(nativeObj); 41 | 42 | return retVal; 43 | } 44 | 45 | // 46 | // C++: int getExcludeRange() 47 | // 48 | 49 | // javadoc: AlignMTB::getExcludeRange() 50 | public int getExcludeRange() { 51 | 52 | int retVal = getExcludeRange_0(nativeObj); 53 | 54 | return retVal; 55 | } 56 | 57 | // 58 | // C++: int getMaxBits() 59 | // 60 | 61 | // javadoc: AlignMTB::getMaxBits() 62 | public int getMaxBits() { 63 | 64 | int retVal = getMaxBits_0(nativeObj); 65 | 66 | return retVal; 67 | } 68 | 69 | // 70 | // C++: void computeBitmaps(Mat img, Mat& tb, Mat& eb) 71 | // 72 | 73 | // javadoc: AlignMTB::computeBitmaps(img, tb, eb) 74 | public void computeBitmaps(Mat img, Mat tb, Mat eb) { 75 | 76 | computeBitmaps_0(nativeObj, img.nativeObj, tb.nativeObj, eb.nativeObj); 77 | 78 | return; 79 | } 80 | 81 | // 82 | // C++: void process(vector_Mat src, vector_Mat dst, Mat times, Mat 83 | // response) 84 | // 85 | 86 | // javadoc: AlignMTB::process(src, dst, times, response) 87 | public void process(List src, List dst, Mat times, Mat response) { 88 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 89 | Mat dst_mat = Converters.vector_Mat_to_Mat(dst); 90 | process_0(nativeObj, src_mat.nativeObj, dst_mat.nativeObj, times.nativeObj, response.nativeObj); 91 | 92 | return; 93 | } 94 | 95 | // 96 | // C++: void process(vector_Mat src, vector_Mat dst) 97 | // 98 | 99 | // javadoc: AlignMTB::process(src, dst) 100 | public void process(List src, List dst) { 101 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 102 | Mat dst_mat = Converters.vector_Mat_to_Mat(dst); 103 | process_1(nativeObj, src_mat.nativeObj, dst_mat.nativeObj); 104 | 105 | return; 106 | } 107 | 108 | // 109 | // C++: void setCut(bool value) 110 | // 111 | 112 | // javadoc: AlignMTB::setCut(value) 113 | public void setCut(boolean value) { 114 | 115 | setCut_0(nativeObj, value); 116 | 117 | return; 118 | } 119 | 120 | // 121 | // C++: void setExcludeRange(int exclude_range) 122 | // 123 | 124 | // javadoc: AlignMTB::setExcludeRange(exclude_range) 125 | public void setExcludeRange(int exclude_range) { 126 | 127 | setExcludeRange_0(nativeObj, exclude_range); 128 | 129 | return; 130 | } 131 | 132 | // 133 | // C++: void setMaxBits(int max_bits) 134 | // 135 | 136 | // javadoc: AlignMTB::setMaxBits(max_bits) 137 | public void setMaxBits(int max_bits) { 138 | 139 | setMaxBits_0(nativeObj, max_bits); 140 | 141 | return; 142 | } 143 | 144 | // 145 | // C++: void shiftMat(Mat src, Mat& dst, Point shift) 146 | // 147 | 148 | // javadoc: AlignMTB::shiftMat(src, dst, shift) 149 | public void shiftMat(Mat src, Mat dst, Point shift) { 150 | 151 | shiftMat_0(nativeObj, src.nativeObj, dst.nativeObj, shift.x, shift.y); 152 | 153 | return; 154 | } 155 | 156 | @Override 157 | protected void finalize() throws Throwable { 158 | delete(nativeObj); 159 | } 160 | 161 | // C++: Point calculateShift(Mat img0, Mat img1) 162 | private static native double[] calculateShift_0(long nativeObj, long img0_nativeObj, long img1_nativeObj); 163 | 164 | // C++: bool getCut() 165 | private static native boolean getCut_0(long nativeObj); 166 | 167 | // C++: int getExcludeRange() 168 | private static native int getExcludeRange_0(long nativeObj); 169 | 170 | // C++: int getMaxBits() 171 | private static native int getMaxBits_0(long nativeObj); 172 | 173 | // C++: void computeBitmaps(Mat img, Mat& tb, Mat& eb) 174 | private static native void computeBitmaps_0(long nativeObj, long img_nativeObj, long tb_nativeObj, 175 | long eb_nativeObj); 176 | 177 | // C++: void process(vector_Mat src, vector_Mat dst, Mat times, Mat 178 | // response) 179 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_mat_nativeObj, 180 | long times_nativeObj, long response_nativeObj); 181 | 182 | // C++: void process(vector_Mat src, vector_Mat dst) 183 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_mat_nativeObj); 184 | 185 | // C++: void setCut(bool value) 186 | private static native void setCut_0(long nativeObj, boolean value); 187 | 188 | // C++: void setExcludeRange(int exclude_range) 189 | private static native void setExcludeRange_0(long nativeObj, int exclude_range); 190 | 191 | // C++: void setMaxBits(int max_bits) 192 | private static native void setMaxBits_0(long nativeObj, int max_bits); 193 | 194 | // C++: void shiftMat(Mat src, Mat& dst, Point shift) 195 | private static native void shiftMat_0(long nativeObj, long src_nativeObj, long dst_nativeObj, double shift_x, 196 | double shift_y); 197 | 198 | // native support for java finalize() 199 | private static native void delete(long nativeObj); 200 | 201 | } 202 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/CalibrateCRF.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Algorithm; 10 | import org.opencv.core.Mat; 11 | import org.opencv.utils.Converters; 12 | 13 | // C++: class CalibrateCRF 14 | //javadoc: CalibrateCRF 15 | public class CalibrateCRF extends Algorithm { 16 | 17 | protected CalibrateCRF(long addr) { 18 | super(addr); 19 | } 20 | 21 | // 22 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 23 | // 24 | 25 | // javadoc: CalibrateCRF::process(src, dst, times) 26 | public void process(List src, Mat dst, Mat times) { 27 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 28 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 29 | 30 | return; 31 | } 32 | 33 | @Override 34 | protected void finalize() throws Throwable { 35 | delete(nativeObj); 36 | } 37 | 38 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 39 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, 40 | long times_nativeObj); 41 | 42 | // native support for java finalize() 43 | private static native void delete(long nativeObj); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/CalibrateDebevec.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | // C++: class CalibrateDebevec 8 | //javadoc: CalibrateDebevec 9 | public class CalibrateDebevec extends CalibrateCRF { 10 | 11 | protected CalibrateDebevec(long addr) { 12 | super(addr); 13 | } 14 | 15 | // 16 | // C++: bool getRandom() 17 | // 18 | 19 | // javadoc: CalibrateDebevec::getRandom() 20 | public boolean getRandom() { 21 | 22 | boolean retVal = getRandom_0(nativeObj); 23 | 24 | return retVal; 25 | } 26 | 27 | // 28 | // C++: float getLambda() 29 | // 30 | 31 | // javadoc: CalibrateDebevec::getLambda() 32 | public float getLambda() { 33 | 34 | float retVal = getLambda_0(nativeObj); 35 | 36 | return retVal; 37 | } 38 | 39 | // 40 | // C++: int getSamples() 41 | // 42 | 43 | // javadoc: CalibrateDebevec::getSamples() 44 | public int getSamples() { 45 | 46 | int retVal = getSamples_0(nativeObj); 47 | 48 | return retVal; 49 | } 50 | 51 | // 52 | // C++: void setLambda(float lambda) 53 | // 54 | 55 | // javadoc: CalibrateDebevec::setLambda(lambda) 56 | public void setLambda(float lambda) { 57 | 58 | setLambda_0(nativeObj, lambda); 59 | 60 | return; 61 | } 62 | 63 | // 64 | // C++: void setRandom(bool random) 65 | // 66 | 67 | // javadoc: CalibrateDebevec::setRandom(random) 68 | public void setRandom(boolean random) { 69 | 70 | setRandom_0(nativeObj, random); 71 | 72 | return; 73 | } 74 | 75 | // 76 | // C++: void setSamples(int samples) 77 | // 78 | 79 | // javadoc: CalibrateDebevec::setSamples(samples) 80 | public void setSamples(int samples) { 81 | 82 | setSamples_0(nativeObj, samples); 83 | 84 | return; 85 | } 86 | 87 | @Override 88 | protected void finalize() throws Throwable { 89 | delete(nativeObj); 90 | } 91 | 92 | // C++: bool getRandom() 93 | private static native boolean getRandom_0(long nativeObj); 94 | 95 | // C++: float getLambda() 96 | private static native float getLambda_0(long nativeObj); 97 | 98 | // C++: int getSamples() 99 | private static native int getSamples_0(long nativeObj); 100 | 101 | // C++: void setLambda(float lambda) 102 | private static native void setLambda_0(long nativeObj, float lambda); 103 | 104 | // C++: void setRandom(bool random) 105 | private static native void setRandom_0(long nativeObj, boolean random); 106 | 107 | // C++: void setSamples(int samples) 108 | private static native void setSamples_0(long nativeObj, int samples); 109 | 110 | // native support for java finalize() 111 | private static native void delete(long nativeObj); 112 | 113 | } 114 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/CalibrateRobertson.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import org.opencv.core.Mat; 8 | 9 | // C++: class CalibrateRobertson 10 | //javadoc: CalibrateRobertson 11 | public class CalibrateRobertson extends CalibrateCRF { 12 | 13 | protected CalibrateRobertson(long addr) { 14 | super(addr); 15 | } 16 | 17 | // 18 | // C++: Mat getRadiance() 19 | // 20 | 21 | // javadoc: CalibrateRobertson::getRadiance() 22 | public Mat getRadiance() { 23 | 24 | Mat retVal = new Mat(getRadiance_0(nativeObj)); 25 | 26 | return retVal; 27 | } 28 | 29 | // 30 | // C++: float getThreshold() 31 | // 32 | 33 | // javadoc: CalibrateRobertson::getThreshold() 34 | public float getThreshold() { 35 | 36 | float retVal = getThreshold_0(nativeObj); 37 | 38 | return retVal; 39 | } 40 | 41 | // 42 | // C++: int getMaxIter() 43 | // 44 | 45 | // javadoc: CalibrateRobertson::getMaxIter() 46 | public int getMaxIter() { 47 | 48 | int retVal = getMaxIter_0(nativeObj); 49 | 50 | return retVal; 51 | } 52 | 53 | // 54 | // C++: void setMaxIter(int max_iter) 55 | // 56 | 57 | // javadoc: CalibrateRobertson::setMaxIter(max_iter) 58 | public void setMaxIter(int max_iter) { 59 | 60 | setMaxIter_0(nativeObj, max_iter); 61 | 62 | return; 63 | } 64 | 65 | // 66 | // C++: void setThreshold(float threshold) 67 | // 68 | 69 | // javadoc: CalibrateRobertson::setThreshold(threshold) 70 | public void setThreshold(float threshold) { 71 | 72 | setThreshold_0(nativeObj, threshold); 73 | 74 | return; 75 | } 76 | 77 | @Override 78 | protected void finalize() throws Throwable { 79 | delete(nativeObj); 80 | } 81 | 82 | // C++: Mat getRadiance() 83 | private static native long getRadiance_0(long nativeObj); 84 | 85 | // C++: float getThreshold() 86 | private static native float getThreshold_0(long nativeObj); 87 | 88 | // C++: int getMaxIter() 89 | private static native int getMaxIter_0(long nativeObj); 90 | 91 | // C++: void setMaxIter(int max_iter) 92 | private static native void setMaxIter_0(long nativeObj, int max_iter); 93 | 94 | // C++: void setThreshold(float threshold) 95 | private static native void setThreshold_0(long nativeObj, float threshold); 96 | 97 | // native support for java finalize() 98 | private static native void delete(long nativeObj); 99 | 100 | } 101 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/MergeDebevec.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Mat; 10 | import org.opencv.utils.Converters; 11 | 12 | // C++: class MergeDebevec 13 | //javadoc: MergeDebevec 14 | public class MergeDebevec extends MergeExposures { 15 | 16 | protected MergeDebevec(long addr) { 17 | super(addr); 18 | } 19 | 20 | // 21 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 22 | // 23 | 24 | // javadoc: MergeDebevec::process(src, dst, times, response) 25 | public void process(List src, Mat dst, Mat times, Mat response) { 26 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 27 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 28 | 29 | return; 30 | } 31 | 32 | // 33 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 34 | // 35 | 36 | // javadoc: MergeDebevec::process(src, dst, times) 37 | public void process(List src, Mat dst, Mat times) { 38 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 39 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 40 | 41 | return; 42 | } 43 | 44 | @Override 45 | protected void finalize() throws Throwable { 46 | delete(nativeObj); 47 | } 48 | 49 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 50 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, 51 | long times_nativeObj, long response_nativeObj); 52 | 53 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 54 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, 55 | long times_nativeObj); 56 | 57 | // native support for java finalize() 58 | private static native void delete(long nativeObj); 59 | 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/MergeExposures.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Algorithm; 10 | import org.opencv.core.Mat; 11 | import org.opencv.utils.Converters; 12 | 13 | // C++: class MergeExposures 14 | //javadoc: MergeExposures 15 | public class MergeExposures extends Algorithm { 16 | 17 | protected MergeExposures(long addr) { 18 | super(addr); 19 | } 20 | 21 | // 22 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 23 | // 24 | 25 | // javadoc: MergeExposures::process(src, dst, times, response) 26 | public void process(List src, Mat dst, Mat times, Mat response) { 27 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 28 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 29 | 30 | return; 31 | } 32 | 33 | @Override 34 | protected void finalize() throws Throwable { 35 | delete(nativeObj); 36 | } 37 | 38 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 39 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, 40 | long times_nativeObj, long response_nativeObj); 41 | 42 | // native support for java finalize() 43 | private static native void delete(long nativeObj); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/MergeMertens.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Mat; 10 | import org.opencv.utils.Converters; 11 | 12 | // C++: class MergeMertens 13 | //javadoc: MergeMertens 14 | public class MergeMertens extends MergeExposures { 15 | 16 | protected MergeMertens(long addr) { 17 | super(addr); 18 | } 19 | 20 | // 21 | // C++: float getContrastWeight() 22 | // 23 | 24 | // javadoc: MergeMertens::getContrastWeight() 25 | public float getContrastWeight() { 26 | 27 | float retVal = getContrastWeight_0(nativeObj); 28 | 29 | return retVal; 30 | } 31 | 32 | // 33 | // C++: float getExposureWeight() 34 | // 35 | 36 | // javadoc: MergeMertens::getExposureWeight() 37 | public float getExposureWeight() { 38 | 39 | float retVal = getExposureWeight_0(nativeObj); 40 | 41 | return retVal; 42 | } 43 | 44 | // 45 | // C++: float getSaturationWeight() 46 | // 47 | 48 | // javadoc: MergeMertens::getSaturationWeight() 49 | public float getSaturationWeight() { 50 | 51 | float retVal = getSaturationWeight_0(nativeObj); 52 | 53 | return retVal; 54 | } 55 | 56 | // 57 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 58 | // 59 | 60 | // javadoc: MergeMertens::process(src, dst, times, response) 61 | public void process(List src, Mat dst, Mat times, Mat response) { 62 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 63 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 64 | 65 | return; 66 | } 67 | 68 | // 69 | // C++: void process(vector_Mat src, Mat& dst) 70 | // 71 | 72 | // javadoc: MergeMertens::process(src, dst) 73 | public void process(List src, Mat dst) { 74 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 75 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj); 76 | 77 | return; 78 | } 79 | 80 | // 81 | // C++: void setContrastWeight(float contrast_weiht) 82 | // 83 | 84 | // javadoc: MergeMertens::setContrastWeight(contrast_weiht) 85 | public void setContrastWeight(float contrast_weiht) { 86 | 87 | setContrastWeight_0(nativeObj, contrast_weiht); 88 | 89 | return; 90 | } 91 | 92 | // 93 | // C++: void setExposureWeight(float exposure_weight) 94 | // 95 | 96 | // javadoc: MergeMertens::setExposureWeight(exposure_weight) 97 | public void setExposureWeight(float exposure_weight) { 98 | 99 | setExposureWeight_0(nativeObj, exposure_weight); 100 | 101 | return; 102 | } 103 | 104 | // 105 | // C++: void setSaturationWeight(float saturation_weight) 106 | // 107 | 108 | // javadoc: MergeMertens::setSaturationWeight(saturation_weight) 109 | public void setSaturationWeight(float saturation_weight) { 110 | 111 | setSaturationWeight_0(nativeObj, saturation_weight); 112 | 113 | return; 114 | } 115 | 116 | @Override 117 | protected void finalize() throws Throwable { 118 | delete(nativeObj); 119 | } 120 | 121 | // C++: float getContrastWeight() 122 | private static native float getContrastWeight_0(long nativeObj); 123 | 124 | // C++: float getExposureWeight() 125 | private static native float getExposureWeight_0(long nativeObj); 126 | 127 | // C++: float getSaturationWeight() 128 | private static native float getSaturationWeight_0(long nativeObj); 129 | 130 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 131 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, 132 | long times_nativeObj, long response_nativeObj); 133 | 134 | // C++: void process(vector_Mat src, Mat& dst) 135 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj); 136 | 137 | // C++: void setContrastWeight(float contrast_weiht) 138 | private static native void setContrastWeight_0(long nativeObj, float contrast_weiht); 139 | 140 | // C++: void setExposureWeight(float exposure_weight) 141 | private static native void setExposureWeight_0(long nativeObj, float exposure_weight); 142 | 143 | // C++: void setSaturationWeight(float saturation_weight) 144 | private static native void setSaturationWeight_0(long nativeObj, float saturation_weight); 145 | 146 | // native support for java finalize() 147 | private static native void delete(long nativeObj); 148 | 149 | } 150 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/MergeRobertson.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Mat; 10 | import org.opencv.utils.Converters; 11 | 12 | // C++: class MergeRobertson 13 | //javadoc: MergeRobertson 14 | public class MergeRobertson extends MergeExposures { 15 | 16 | protected MergeRobertson(long addr) { 17 | super(addr); 18 | } 19 | 20 | // 21 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 22 | // 23 | 24 | // javadoc: MergeRobertson::process(src, dst, times, response) 25 | public void process(List src, Mat dst, Mat times, Mat response) { 26 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 27 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 28 | 29 | return; 30 | } 31 | 32 | // 33 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 34 | // 35 | 36 | // javadoc: MergeRobertson::process(src, dst, times) 37 | public void process(List src, Mat dst, Mat times) { 38 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 39 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 40 | 41 | return; 42 | } 43 | 44 | @Override 45 | protected void finalize() throws Throwable { 46 | delete(nativeObj); 47 | } 48 | 49 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 50 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, 51 | long times_nativeObj, long response_nativeObj); 52 | 53 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 54 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, 55 | long times_nativeObj); 56 | 57 | // native support for java finalize() 58 | private static native void delete(long nativeObj); 59 | 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/Tonemap.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | 10 | // C++: class Tonemap 11 | //javadoc: Tonemap 12 | public class Tonemap extends Algorithm { 13 | 14 | protected Tonemap(long addr) { 15 | super(addr); 16 | } 17 | 18 | // 19 | // C++: float getGamma() 20 | // 21 | 22 | // javadoc: Tonemap::getGamma() 23 | public float getGamma() { 24 | 25 | float retVal = getGamma_0(nativeObj); 26 | 27 | return retVal; 28 | } 29 | 30 | // 31 | // C++: void process(Mat src, Mat& dst) 32 | // 33 | 34 | // javadoc: Tonemap::process(src, dst) 35 | public void process(Mat src, Mat dst) { 36 | 37 | process_0(nativeObj, src.nativeObj, dst.nativeObj); 38 | 39 | return; 40 | } 41 | 42 | // 43 | // C++: void setGamma(float gamma) 44 | // 45 | 46 | // javadoc: Tonemap::setGamma(gamma) 47 | public void setGamma(float gamma) { 48 | 49 | setGamma_0(nativeObj, gamma); 50 | 51 | return; 52 | } 53 | 54 | @Override 55 | protected void finalize() throws Throwable { 56 | delete(nativeObj); 57 | } 58 | 59 | // C++: float getGamma() 60 | private static native float getGamma_0(long nativeObj); 61 | 62 | // C++: void process(Mat src, Mat& dst) 63 | private static native void process_0(long nativeObj, long src_nativeObj, long dst_nativeObj); 64 | 65 | // C++: void setGamma(float gamma) 66 | private static native void setGamma_0(long nativeObj, float gamma); 67 | 68 | // native support for java finalize() 69 | private static native void delete(long nativeObj); 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/TonemapDrago.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | // C++: class TonemapDrago 8 | //javadoc: TonemapDrago 9 | public class TonemapDrago extends Tonemap { 10 | 11 | protected TonemapDrago(long addr) { 12 | super(addr); 13 | } 14 | 15 | // 16 | // C++: float getBias() 17 | // 18 | 19 | // javadoc: TonemapDrago::getBias() 20 | public float getBias() { 21 | 22 | float retVal = getBias_0(nativeObj); 23 | 24 | return retVal; 25 | } 26 | 27 | // 28 | // C++: float getSaturation() 29 | // 30 | 31 | // javadoc: TonemapDrago::getSaturation() 32 | public float getSaturation() { 33 | 34 | float retVal = getSaturation_0(nativeObj); 35 | 36 | return retVal; 37 | } 38 | 39 | // 40 | // C++: void setBias(float bias) 41 | // 42 | 43 | // javadoc: TonemapDrago::setBias(bias) 44 | public void setBias(float bias) { 45 | 46 | setBias_0(nativeObj, bias); 47 | 48 | return; 49 | } 50 | 51 | // 52 | // C++: void setSaturation(float saturation) 53 | // 54 | 55 | // javadoc: TonemapDrago::setSaturation(saturation) 56 | public void setSaturation(float saturation) { 57 | 58 | setSaturation_0(nativeObj, saturation); 59 | 60 | return; 61 | } 62 | 63 | @Override 64 | protected void finalize() throws Throwable { 65 | delete(nativeObj); 66 | } 67 | 68 | // C++: float getBias() 69 | private static native float getBias_0(long nativeObj); 70 | 71 | // C++: float getSaturation() 72 | private static native float getSaturation_0(long nativeObj); 73 | 74 | // C++: void setBias(float bias) 75 | private static native void setBias_0(long nativeObj, float bias); 76 | 77 | // C++: void setSaturation(float saturation) 78 | private static native void setSaturation_0(long nativeObj, float saturation); 79 | 80 | // native support for java finalize() 81 | private static native void delete(long nativeObj); 82 | 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/TonemapDurand.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | // C++: class TonemapDurand 8 | //javadoc: TonemapDurand 9 | public class TonemapDurand extends Tonemap { 10 | 11 | protected TonemapDurand(long addr) { 12 | super(addr); 13 | } 14 | 15 | // 16 | // C++: float getContrast() 17 | // 18 | 19 | // javadoc: TonemapDurand::getContrast() 20 | public float getContrast() { 21 | 22 | float retVal = getContrast_0(nativeObj); 23 | 24 | return retVal; 25 | } 26 | 27 | // 28 | // C++: float getSaturation() 29 | // 30 | 31 | // javadoc: TonemapDurand::getSaturation() 32 | public float getSaturation() { 33 | 34 | float retVal = getSaturation_0(nativeObj); 35 | 36 | return retVal; 37 | } 38 | 39 | // 40 | // C++: float getSigmaColor() 41 | // 42 | 43 | // javadoc: TonemapDurand::getSigmaColor() 44 | public float getSigmaColor() { 45 | 46 | float retVal = getSigmaColor_0(nativeObj); 47 | 48 | return retVal; 49 | } 50 | 51 | // 52 | // C++: float getSigmaSpace() 53 | // 54 | 55 | // javadoc: TonemapDurand::getSigmaSpace() 56 | public float getSigmaSpace() { 57 | 58 | float retVal = getSigmaSpace_0(nativeObj); 59 | 60 | return retVal; 61 | } 62 | 63 | // 64 | // C++: void setContrast(float contrast) 65 | // 66 | 67 | // javadoc: TonemapDurand::setContrast(contrast) 68 | public void setContrast(float contrast) { 69 | 70 | setContrast_0(nativeObj, contrast); 71 | 72 | return; 73 | } 74 | 75 | // 76 | // C++: void setSaturation(float saturation) 77 | // 78 | 79 | // javadoc: TonemapDurand::setSaturation(saturation) 80 | public void setSaturation(float saturation) { 81 | 82 | setSaturation_0(nativeObj, saturation); 83 | 84 | return; 85 | } 86 | 87 | // 88 | // C++: void setSigmaColor(float sigma_color) 89 | // 90 | 91 | // javadoc: TonemapDurand::setSigmaColor(sigma_color) 92 | public void setSigmaColor(float sigma_color) { 93 | 94 | setSigmaColor_0(nativeObj, sigma_color); 95 | 96 | return; 97 | } 98 | 99 | // 100 | // C++: void setSigmaSpace(float sigma_space) 101 | // 102 | 103 | // javadoc: TonemapDurand::setSigmaSpace(sigma_space) 104 | public void setSigmaSpace(float sigma_space) { 105 | 106 | setSigmaSpace_0(nativeObj, sigma_space); 107 | 108 | return; 109 | } 110 | 111 | @Override 112 | protected void finalize() throws Throwable { 113 | delete(nativeObj); 114 | } 115 | 116 | // C++: float getContrast() 117 | private static native float getContrast_0(long nativeObj); 118 | 119 | // C++: float getSaturation() 120 | private static native float getSaturation_0(long nativeObj); 121 | 122 | // C++: float getSigmaColor() 123 | private static native float getSigmaColor_0(long nativeObj); 124 | 125 | // C++: float getSigmaSpace() 126 | private static native float getSigmaSpace_0(long nativeObj); 127 | 128 | // C++: void setContrast(float contrast) 129 | private static native void setContrast_0(long nativeObj, float contrast); 130 | 131 | // C++: void setSaturation(float saturation) 132 | private static native void setSaturation_0(long nativeObj, float saturation); 133 | 134 | // C++: void setSigmaColor(float sigma_color) 135 | private static native void setSigmaColor_0(long nativeObj, float sigma_color); 136 | 137 | // C++: void setSigmaSpace(float sigma_space) 138 | private static native void setSigmaSpace_0(long nativeObj, float sigma_space); 139 | 140 | // native support for java finalize() 141 | private static native void delete(long nativeObj); 142 | 143 | } 144 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/TonemapMantiuk.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | // C++: class TonemapMantiuk 8 | //javadoc: TonemapMantiuk 9 | public class TonemapMantiuk extends Tonemap { 10 | 11 | protected TonemapMantiuk(long addr) { 12 | super(addr); 13 | } 14 | 15 | // 16 | // C++: float getSaturation() 17 | // 18 | 19 | // javadoc: TonemapMantiuk::getSaturation() 20 | public float getSaturation() { 21 | 22 | float retVal = getSaturation_0(nativeObj); 23 | 24 | return retVal; 25 | } 26 | 27 | // 28 | // C++: float getScale() 29 | // 30 | 31 | // javadoc: TonemapMantiuk::getScale() 32 | public float getScale() { 33 | 34 | float retVal = getScale_0(nativeObj); 35 | 36 | return retVal; 37 | } 38 | 39 | // 40 | // C++: void setSaturation(float saturation) 41 | // 42 | 43 | // javadoc: TonemapMantiuk::setSaturation(saturation) 44 | public void setSaturation(float saturation) { 45 | 46 | setSaturation_0(nativeObj, saturation); 47 | 48 | return; 49 | } 50 | 51 | // 52 | // C++: void setScale(float scale) 53 | // 54 | 55 | // javadoc: TonemapMantiuk::setScale(scale) 56 | public void setScale(float scale) { 57 | 58 | setScale_0(nativeObj, scale); 59 | 60 | return; 61 | } 62 | 63 | @Override 64 | protected void finalize() throws Throwable { 65 | delete(nativeObj); 66 | } 67 | 68 | // C++: float getSaturation() 69 | private static native float getSaturation_0(long nativeObj); 70 | 71 | // C++: float getScale() 72 | private static native float getScale_0(long nativeObj); 73 | 74 | // C++: void setSaturation(float saturation) 75 | private static native void setSaturation_0(long nativeObj, float saturation); 76 | 77 | // C++: void setScale(float scale) 78 | private static native void setScale_0(long nativeObj, float scale); 79 | 80 | // native support for java finalize() 81 | private static native void delete(long nativeObj); 82 | 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/photo/TonemapReinhard.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | // C++: class TonemapReinhard 8 | //javadoc: TonemapReinhard 9 | public class TonemapReinhard extends Tonemap { 10 | 11 | protected TonemapReinhard(long addr) { 12 | super(addr); 13 | } 14 | 15 | // 16 | // C++: float getColorAdaptation() 17 | // 18 | 19 | // javadoc: TonemapReinhard::getColorAdaptation() 20 | public float getColorAdaptation() { 21 | 22 | float retVal = getColorAdaptation_0(nativeObj); 23 | 24 | return retVal; 25 | } 26 | 27 | // 28 | // C++: float getIntensity() 29 | // 30 | 31 | // javadoc: TonemapReinhard::getIntensity() 32 | public float getIntensity() { 33 | 34 | float retVal = getIntensity_0(nativeObj); 35 | 36 | return retVal; 37 | } 38 | 39 | // 40 | // C++: float getLightAdaptation() 41 | // 42 | 43 | // javadoc: TonemapReinhard::getLightAdaptation() 44 | public float getLightAdaptation() { 45 | 46 | float retVal = getLightAdaptation_0(nativeObj); 47 | 48 | return retVal; 49 | } 50 | 51 | // 52 | // C++: void setColorAdaptation(float color_adapt) 53 | // 54 | 55 | // javadoc: TonemapReinhard::setColorAdaptation(color_adapt) 56 | public void setColorAdaptation(float color_adapt) { 57 | 58 | setColorAdaptation_0(nativeObj, color_adapt); 59 | 60 | return; 61 | } 62 | 63 | // 64 | // C++: void setIntensity(float intensity) 65 | // 66 | 67 | // javadoc: TonemapReinhard::setIntensity(intensity) 68 | public void setIntensity(float intensity) { 69 | 70 | setIntensity_0(nativeObj, intensity); 71 | 72 | return; 73 | } 74 | 75 | // 76 | // C++: void setLightAdaptation(float light_adapt) 77 | // 78 | 79 | // javadoc: TonemapReinhard::setLightAdaptation(light_adapt) 80 | public void setLightAdaptation(float light_adapt) { 81 | 82 | setLightAdaptation_0(nativeObj, light_adapt); 83 | 84 | return; 85 | } 86 | 87 | @Override 88 | protected void finalize() throws Throwable { 89 | delete(nativeObj); 90 | } 91 | 92 | // C++: float getColorAdaptation() 93 | private static native float getColorAdaptation_0(long nativeObj); 94 | 95 | // C++: float getIntensity() 96 | private static native float getIntensity_0(long nativeObj); 97 | 98 | // C++: float getLightAdaptation() 99 | private static native float getLightAdaptation_0(long nativeObj); 100 | 101 | // C++: void setColorAdaptation(float color_adapt) 102 | private static native void setColorAdaptation_0(long nativeObj, float color_adapt); 103 | 104 | // C++: void setIntensity(float intensity) 105 | private static native void setIntensity_0(long nativeObj, float intensity); 106 | 107 | // C++: void setLightAdaptation(float light_adapt) 108 | private static native void setLightAdaptation_0(long nativeObj, float light_adapt); 109 | 110 | // native support for java finalize() 111 | private static native void delete(long nativeObj); 112 | 113 | } 114 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/video/BackgroundSubtractor.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | 10 | // C++: class BackgroundSubtractor 11 | //javadoc: BackgroundSubtractor 12 | public class BackgroundSubtractor extends Algorithm { 13 | 14 | protected BackgroundSubtractor(long addr) { 15 | super(addr); 16 | } 17 | 18 | // 19 | // C++: void apply(Mat image, Mat& fgmask, double learningRate = -1) 20 | // 21 | 22 | // javadoc: BackgroundSubtractor::apply(image, fgmask, learningRate) 23 | public void apply(Mat image, Mat fgmask, double learningRate) { 24 | 25 | apply_0(nativeObj, image.nativeObj, fgmask.nativeObj, learningRate); 26 | 27 | return; 28 | } 29 | 30 | // javadoc: BackgroundSubtractor::apply(image, fgmask) 31 | public void apply(Mat image, Mat fgmask) { 32 | 33 | apply_1(nativeObj, image.nativeObj, fgmask.nativeObj); 34 | 35 | return; 36 | } 37 | 38 | // 39 | // C++: void getBackgroundImage(Mat& backgroundImage) 40 | // 41 | 42 | // javadoc: BackgroundSubtractor::getBackgroundImage(backgroundImage) 43 | public void getBackgroundImage(Mat backgroundImage) { 44 | 45 | getBackgroundImage_0(nativeObj, backgroundImage.nativeObj); 46 | 47 | return; 48 | } 49 | 50 | @Override 51 | protected void finalize() throws Throwable { 52 | delete(nativeObj); 53 | } 54 | 55 | // C++: void apply(Mat image, Mat& fgmask, double learningRate = -1) 56 | private static native void apply_0(long nativeObj, long image_nativeObj, long fgmask_nativeObj, 57 | double learningRate); 58 | 59 | private static native void apply_1(long nativeObj, long image_nativeObj, long fgmask_nativeObj); 60 | 61 | // C++: void getBackgroundImage(Mat& backgroundImage) 62 | private static native void getBackgroundImage_0(long nativeObj, long backgroundImage_nativeObj); 63 | 64 | // native support for java finalize() 65 | private static native void delete(long nativeObj); 66 | 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/video/BackgroundSubtractorKNN.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | // C++: class BackgroundSubtractorKNN 8 | //javadoc: BackgroundSubtractorKNN 9 | public class BackgroundSubtractorKNN extends BackgroundSubtractor { 10 | 11 | protected BackgroundSubtractorKNN(long addr) { 12 | super(addr); 13 | } 14 | 15 | // 16 | // C++: bool getDetectShadows() 17 | // 18 | 19 | // javadoc: BackgroundSubtractorKNN::getDetectShadows() 20 | public boolean getDetectShadows() { 21 | 22 | boolean retVal = getDetectShadows_0(nativeObj); 23 | 24 | return retVal; 25 | } 26 | 27 | // 28 | // C++: double getDist2Threshold() 29 | // 30 | 31 | // javadoc: BackgroundSubtractorKNN::getDist2Threshold() 32 | public double getDist2Threshold() { 33 | 34 | double retVal = getDist2Threshold_0(nativeObj); 35 | 36 | return retVal; 37 | } 38 | 39 | // 40 | // C++: double getShadowThreshold() 41 | // 42 | 43 | // javadoc: BackgroundSubtractorKNN::getShadowThreshold() 44 | public double getShadowThreshold() { 45 | 46 | double retVal = getShadowThreshold_0(nativeObj); 47 | 48 | return retVal; 49 | } 50 | 51 | // 52 | // C++: int getHistory() 53 | // 54 | 55 | // javadoc: BackgroundSubtractorKNN::getHistory() 56 | public int getHistory() { 57 | 58 | int retVal = getHistory_0(nativeObj); 59 | 60 | return retVal; 61 | } 62 | 63 | // 64 | // C++: int getNSamples() 65 | // 66 | 67 | // javadoc: BackgroundSubtractorKNN::getNSamples() 68 | public int getNSamples() { 69 | 70 | int retVal = getNSamples_0(nativeObj); 71 | 72 | return retVal; 73 | } 74 | 75 | // 76 | // C++: int getShadowValue() 77 | // 78 | 79 | // javadoc: BackgroundSubtractorKNN::getShadowValue() 80 | public int getShadowValue() { 81 | 82 | int retVal = getShadowValue_0(nativeObj); 83 | 84 | return retVal; 85 | } 86 | 87 | // 88 | // C++: int getkNNSamples() 89 | // 90 | 91 | // javadoc: BackgroundSubtractorKNN::getkNNSamples() 92 | public int getkNNSamples() { 93 | 94 | int retVal = getkNNSamples_0(nativeObj); 95 | 96 | return retVal; 97 | } 98 | 99 | // 100 | // C++: void setDetectShadows(bool detectShadows) 101 | // 102 | 103 | // javadoc: BackgroundSubtractorKNN::setDetectShadows(detectShadows) 104 | public void setDetectShadows(boolean detectShadows) { 105 | 106 | setDetectShadows_0(nativeObj, detectShadows); 107 | 108 | return; 109 | } 110 | 111 | // 112 | // C++: void setDist2Threshold(double _dist2Threshold) 113 | // 114 | 115 | // javadoc: BackgroundSubtractorKNN::setDist2Threshold(_dist2Threshold) 116 | public void setDist2Threshold(double _dist2Threshold) { 117 | 118 | setDist2Threshold_0(nativeObj, _dist2Threshold); 119 | 120 | return; 121 | } 122 | 123 | // 124 | // C++: void setHistory(int history) 125 | // 126 | 127 | // javadoc: BackgroundSubtractorKNN::setHistory(history) 128 | public void setHistory(int history) { 129 | 130 | setHistory_0(nativeObj, history); 131 | 132 | return; 133 | } 134 | 135 | // 136 | // C++: void setNSamples(int _nN) 137 | // 138 | 139 | // javadoc: BackgroundSubtractorKNN::setNSamples(_nN) 140 | public void setNSamples(int _nN) { 141 | 142 | setNSamples_0(nativeObj, _nN); 143 | 144 | return; 145 | } 146 | 147 | // 148 | // C++: void setShadowThreshold(double threshold) 149 | // 150 | 151 | // javadoc: BackgroundSubtractorKNN::setShadowThreshold(threshold) 152 | public void setShadowThreshold(double threshold) { 153 | 154 | setShadowThreshold_0(nativeObj, threshold); 155 | 156 | return; 157 | } 158 | 159 | // 160 | // C++: void setShadowValue(int value) 161 | // 162 | 163 | // javadoc: BackgroundSubtractorKNN::setShadowValue(value) 164 | public void setShadowValue(int value) { 165 | 166 | setShadowValue_0(nativeObj, value); 167 | 168 | return; 169 | } 170 | 171 | // 172 | // C++: void setkNNSamples(int _nkNN) 173 | // 174 | 175 | // javadoc: BackgroundSubtractorKNN::setkNNSamples(_nkNN) 176 | public void setkNNSamples(int _nkNN) { 177 | 178 | setkNNSamples_0(nativeObj, _nkNN); 179 | 180 | return; 181 | } 182 | 183 | @Override 184 | protected void finalize() throws Throwable { 185 | delete(nativeObj); 186 | } 187 | 188 | // C++: bool getDetectShadows() 189 | private static native boolean getDetectShadows_0(long nativeObj); 190 | 191 | // C++: double getDist2Threshold() 192 | private static native double getDist2Threshold_0(long nativeObj); 193 | 194 | // C++: double getShadowThreshold() 195 | private static native double getShadowThreshold_0(long nativeObj); 196 | 197 | // C++: int getHistory() 198 | private static native int getHistory_0(long nativeObj); 199 | 200 | // C++: int getNSamples() 201 | private static native int getNSamples_0(long nativeObj); 202 | 203 | // C++: int getShadowValue() 204 | private static native int getShadowValue_0(long nativeObj); 205 | 206 | // C++: int getkNNSamples() 207 | private static native int getkNNSamples_0(long nativeObj); 208 | 209 | // C++: void setDetectShadows(bool detectShadows) 210 | private static native void setDetectShadows_0(long nativeObj, boolean detectShadows); 211 | 212 | // C++: void setDist2Threshold(double _dist2Threshold) 213 | private static native void setDist2Threshold_0(long nativeObj, double _dist2Threshold); 214 | 215 | // C++: void setHistory(int history) 216 | private static native void setHistory_0(long nativeObj, int history); 217 | 218 | // C++: void setNSamples(int _nN) 219 | private static native void setNSamples_0(long nativeObj, int _nN); 220 | 221 | // C++: void setShadowThreshold(double threshold) 222 | private static native void setShadowThreshold_0(long nativeObj, double threshold); 223 | 224 | // C++: void setShadowValue(int value) 225 | private static native void setShadowValue_0(long nativeObj, int value); 226 | 227 | // C++: void setkNNSamples(int _nkNN) 228 | private static native void setkNNSamples_0(long nativeObj, int _nkNN); 229 | 230 | // native support for java finalize() 231 | private static native void delete(long nativeObj); 232 | 233 | } 234 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/video/DenseOpticalFlow.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | 10 | // C++: class DenseOpticalFlow 11 | //javadoc: DenseOpticalFlow 12 | public class DenseOpticalFlow extends Algorithm { 13 | 14 | protected DenseOpticalFlow(long addr) { 15 | super(addr); 16 | } 17 | 18 | // 19 | // C++: void calc(Mat I0, Mat I1, Mat& flow) 20 | // 21 | 22 | // javadoc: DenseOpticalFlow::calc(I0, I1, flow) 23 | public void calc(Mat I0, Mat I1, Mat flow) { 24 | 25 | calc_0(nativeObj, I0.nativeObj, I1.nativeObj, flow.nativeObj); 26 | 27 | return; 28 | } 29 | 30 | // 31 | // C++: void collectGarbage() 32 | // 33 | 34 | // javadoc: DenseOpticalFlow::collectGarbage() 35 | public void collectGarbage() { 36 | 37 | collectGarbage_0(nativeObj); 38 | 39 | return; 40 | } 41 | 42 | @Override 43 | protected void finalize() throws Throwable { 44 | delete(nativeObj); 45 | } 46 | 47 | // C++: void calc(Mat I0, Mat I1, Mat& flow) 48 | private static native void calc_0(long nativeObj, long I0_nativeObj, long I1_nativeObj, long flow_nativeObj); 49 | 50 | // C++: void collectGarbage() 51 | private static native void collectGarbage_0(long nativeObj); 52 | 53 | // native support for java finalize() 54 | private static native void delete(long nativeObj); 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/video/DualTVL1OpticalFlow.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | // C++: class DualTVL1OpticalFlow 8 | //javadoc: DualTVL1OpticalFlow 9 | public class DualTVL1OpticalFlow extends DenseOpticalFlow { 10 | 11 | protected DualTVL1OpticalFlow(long addr) { 12 | super(addr); 13 | } 14 | 15 | @Override 16 | protected void finalize() throws Throwable { 17 | delete(nativeObj); 18 | } 19 | 20 | // native support for java finalize() 21 | private static native void delete(long nativeObj); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/org/opencv/videoio/VideoWriter.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.videoio; 6 | 7 | import java.lang.String; 8 | import org.opencv.core.Mat; 9 | import org.opencv.core.Size; 10 | 11 | // C++: class VideoWriter 12 | //javadoc: VideoWriter 13 | public class VideoWriter { 14 | 15 | protected final long nativeObj; 16 | 17 | protected VideoWriter(long addr) { 18 | nativeObj = addr; 19 | } 20 | 21 | // 22 | // C++: VideoWriter(String filename, int fourcc, double fps, Size frameSize, 23 | // bool isColor = true) 24 | // 25 | 26 | // javadoc: VideoWriter::VideoWriter(filename, fourcc, fps, frameSize, 27 | // isColor) 28 | public VideoWriter(String filename, int fourcc, double fps, Size frameSize, boolean isColor) { 29 | 30 | nativeObj = VideoWriter_0(filename, fourcc, fps, frameSize.width, frameSize.height, isColor); 31 | 32 | return; 33 | } 34 | 35 | // javadoc: VideoWriter::VideoWriter(filename, fourcc, fps, frameSize) 36 | public VideoWriter(String filename, int fourcc, double fps, Size frameSize) { 37 | 38 | nativeObj = VideoWriter_1(filename, fourcc, fps, frameSize.width, frameSize.height); 39 | 40 | return; 41 | } 42 | 43 | // 44 | // C++: VideoWriter() 45 | // 46 | 47 | // javadoc: VideoWriter::VideoWriter() 48 | public VideoWriter() { 49 | 50 | nativeObj = VideoWriter_2(); 51 | 52 | return; 53 | } 54 | 55 | // 56 | // C++: bool isOpened() 57 | // 58 | 59 | // javadoc: VideoWriter::isOpened() 60 | public boolean isOpened() { 61 | 62 | boolean retVal = isOpened_0(nativeObj); 63 | 64 | return retVal; 65 | } 66 | 67 | // 68 | // C++: bool open(String filename, int fourcc, double fps, Size frameSize, 69 | // bool isColor = true) 70 | // 71 | 72 | // javadoc: VideoWriter::open(filename, fourcc, fps, frameSize, isColor) 73 | public boolean open(String filename, int fourcc, double fps, Size frameSize, boolean isColor) { 74 | 75 | boolean retVal = open_0(nativeObj, filename, fourcc, fps, frameSize.width, frameSize.height, isColor); 76 | 77 | return retVal; 78 | } 79 | 80 | // javadoc: VideoWriter::open(filename, fourcc, fps, frameSize) 81 | public boolean open(String filename, int fourcc, double fps, Size frameSize) { 82 | 83 | boolean retVal = open_1(nativeObj, filename, fourcc, fps, frameSize.width, frameSize.height); 84 | 85 | return retVal; 86 | } 87 | 88 | // 89 | // C++: bool set(int propId, double value) 90 | // 91 | 92 | // javadoc: VideoWriter::set(propId, value) 93 | public boolean set(int propId, double value) { 94 | 95 | boolean retVal = set_0(nativeObj, propId, value); 96 | 97 | return retVal; 98 | } 99 | 100 | // 101 | // C++: double get(int propId) 102 | // 103 | 104 | // javadoc: VideoWriter::get(propId) 105 | public double get(int propId) { 106 | 107 | double retVal = get_0(nativeObj, propId); 108 | 109 | return retVal; 110 | } 111 | 112 | // 113 | // C++: static int fourcc(char c1, char c2, char c3, char c4) 114 | // 115 | 116 | // javadoc: VideoWriter::fourcc(c1, c2, c3, c4) 117 | public static int fourcc(char c1, char c2, char c3, char c4) { 118 | 119 | int retVal = fourcc_0(c1, c2, c3, c4); 120 | 121 | return retVal; 122 | } 123 | 124 | // 125 | // C++: void release() 126 | // 127 | 128 | // javadoc: VideoWriter::release() 129 | public void release() { 130 | 131 | release_0(nativeObj); 132 | 133 | return; 134 | } 135 | 136 | // 137 | // C++: void write(Mat image) 138 | // 139 | 140 | // javadoc: VideoWriter::write(image) 141 | public void write(Mat image) { 142 | 143 | write_0(nativeObj, image.nativeObj); 144 | 145 | return; 146 | } 147 | 148 | @Override 149 | protected void finalize() throws Throwable { 150 | delete(nativeObj); 151 | } 152 | 153 | // C++: VideoWriter(String filename, int fourcc, double fps, Size frameSize, 154 | // bool isColor = true) 155 | private static native long VideoWriter_0(String filename, int fourcc, double fps, double frameSize_width, 156 | double frameSize_height, boolean isColor); 157 | 158 | private static native long VideoWriter_1(String filename, int fourcc, double fps, double frameSize_width, 159 | double frameSize_height); 160 | 161 | // C++: VideoWriter() 162 | private static native long VideoWriter_2(); 163 | 164 | // C++: bool isOpened() 165 | private static native boolean isOpened_0(long nativeObj); 166 | 167 | // C++: bool open(String filename, int fourcc, double fps, Size frameSize, 168 | // bool isColor = true) 169 | private static native boolean open_0(long nativeObj, String filename, int fourcc, double fps, 170 | double frameSize_width, double frameSize_height, boolean isColor); 171 | 172 | private static native boolean open_1(long nativeObj, String filename, int fourcc, double fps, 173 | double frameSize_width, double frameSize_height); 174 | 175 | // C++: bool set(int propId, double value) 176 | private static native boolean set_0(long nativeObj, int propId, double value); 177 | 178 | // C++: double get(int propId) 179 | private static native double get_0(long nativeObj, int propId); 180 | 181 | // C++: static int fourcc(char c1, char c2, char c3, char c4) 182 | private static native int fourcc_0(char c1, char c2, char c3, char c4); 183 | 184 | // C++: void release() 185 | private static native void release_0(long nativeObj); 186 | 187 | // C++: void write(Mat image) 188 | private static native void write_0(long nativeObj, long image_nativeObj); 189 | 190 | // native support for java finalize() 191 | private static native void delete(long nativeObj); 192 | 193 | } 194 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi/libmxnet_predict.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyingzhao/FaceVerificationAndroid/fb3a03a3b58de2bd728acff810f0df070e6d907f/app/src/main/jniLibs/armeabi/libmxnet_predict.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi/libopencv_java3.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyingzhao/FaceVerificationAndroid/fb3a03a3b58de2bd728acff810f0df070e6d907f/app/src/main/jniLibs/armeabi/libopencv_java3.so -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 9 | 18 | 19 | 26 | 27 |