├── .gitignore
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── org
│ │ └── dp
│ │ └── facedetection
│ │ ├── App.kt
│ │ ├── MainActivity.kt
│ │ └── MediaStoreUtils.java
│ └── res
│ ├── drawable
│ ├── ic_camera.xml
│ └── ic_photo.xml
│ ├── layout
│ └── activity_main.xml
│ ├── menu
│ └── menu_pick.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
│ ├── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
│ └── xml
│ └── file_paths_public.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── screenshot
└── device-2019-11-16-131825.png
├── sdk
├── .gitignore
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── aidl
│ └── org
│ │ └── opencv
│ │ └── engine
│ │ └── OpenCVEngineInterface.aidl
│ ├── java
│ └── org
│ │ ├── dp
│ │ └── facedetection
│ │ │ ├── Face.java
│ │ │ └── FaceDetect.java
│ │ ├── luban
│ │ ├── Checker.java
│ │ ├── CompressionPredicate.java
│ │ ├── Engine.java
│ │ ├── InputStreamAdapter.java
│ │ ├── InputStreamProvider.java
│ │ ├── Luban.java
│ │ ├── OnCompressListener.java
│ │ └── OnRenameListener.java
│ │ └── opencv
│ │ ├── android
│ │ ├── AsyncServiceHelper.java
│ │ ├── BaseLoaderCallback.java
│ │ ├── Camera2Renderer.java
│ │ ├── CameraActivity.java
│ │ ├── CameraBridgeViewBase.java
│ │ ├── CameraGLRendererBase.java
│ │ ├── CameraGLSurfaceView.java
│ │ ├── CameraRenderer.java
│ │ ├── FpsMeter.java
│ │ ├── InstallCallbackInterface.java
│ │ ├── JavaCamera2View.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
│ │ ├── MatOfRect2d.java
│ │ ├── MatOfRotatedRect.java
│ │ ├── Point.java
│ │ ├── Point3.java
│ │ ├── Range.java
│ │ ├── Rect.java
│ │ ├── Rect2d.java
│ │ ├── RotatedRect.java
│ │ ├── Scalar.java
│ │ ├── Size.java
│ │ ├── TermCriteria.java
│ │ └── TickMeter.java
│ │ ├── dnn
│ │ ├── ClassificationModel.java
│ │ ├── DetectionModel.java
│ │ ├── DictValue.java
│ │ ├── Dnn.java
│ │ ├── Layer.java
│ │ ├── Model.java
│ │ ├── Net.java
│ │ └── SegmentationModel.java
│ │ ├── features2d
│ │ ├── AKAZE.java
│ │ ├── AgastFeatureDetector.java
│ │ ├── BFMatcher.java
│ │ ├── BOWImgDescriptorExtractor.java
│ │ ├── BOWKMeansTrainer.java
│ │ ├── BOWTrainer.java
│ │ ├── BRISK.java
│ │ ├── DescriptorMatcher.java
│ │ ├── FastFeatureDetector.java
│ │ ├── Feature2D.java
│ │ ├── Features2d.java
│ │ ├── FlannBasedMatcher.java
│ │ ├── GFTTDetector.java
│ │ ├── KAZE.java
│ │ ├── MSER.java
│ │ ├── ORB.java
│ │ ├── Params.java
│ │ └── SimpleBlobDetector.java
│ │ ├── imgcodecs
│ │ └── Imgcodecs.java
│ │ ├── imgproc
│ │ ├── CLAHE.java
│ │ ├── GeneralizedHough.java
│ │ ├── GeneralizedHoughBallard.java
│ │ ├── GeneralizedHoughGuil.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
│ │ ├── ParamGrid.java
│ │ ├── RTrees.java
│ │ ├── SVM.java
│ │ ├── SVMSGD.java
│ │ ├── StatModel.java
│ │ └── TrainData.java
│ │ ├── objdetect
│ │ ├── BaseCascadeClassifier.java
│ │ ├── CascadeClassifier.java
│ │ ├── HOGDescriptor.java
│ │ ├── Objdetect.java
│ │ └── QRCodeDetector.java
│ │ ├── osgi
│ │ ├── OpenCVInterface.java
│ │ └── OpenCVNativeLoader.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
│ │ ├── TonemapMantiuk.java
│ │ └── TonemapReinhard.java
│ │ ├── utils
│ │ └── Converters.java
│ │ ├── video
│ │ ├── BackgroundSubtractor.java
│ │ ├── BackgroundSubtractorKNN.java
│ │ ├── BackgroundSubtractorMOG2.java
│ │ ├── DISOpticalFlow.java
│ │ ├── DenseOpticalFlow.java
│ │ ├── FarnebackOpticalFlow.java
│ │ ├── KalmanFilter.java
│ │ ├── SparseOpticalFlow.java
│ │ ├── SparsePyrLKOpticalFlow.java
│ │ ├── VariationalRefinement.java
│ │ └── Video.java
│ │ └── videoio
│ │ ├── VideoCapture.java
│ │ ├── VideoWriter.java
│ │ └── Videoio.java
│ ├── jniLibs
│ └── armeabi-v7a
│ │ ├── libc++_shared.so
│ │ ├── libfacedetection.so
│ │ └── libopencv_java4.so
│ └── res
│ └── values
│ └── attrs.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | .idea
5 | .DS_Store
6 | /build
7 | */build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android-FaceDetection
2 | 基于libfacedetection实现Android平台人脸检测
3 |
4 | # 效果
5 | 
6 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /.cxx
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 | android {
8 | compileSdkVersion 29
9 | defaultConfig {
10 | applicationId "org.dp.facedetection"
11 | minSdkVersion 21
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | ndk {
17 | abiFilters 'armeabi-v7a'
18 | }
19 | }
20 |
21 | buildTypes {
22 | debug {
23 | minifyEnabled false
24 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
25 | }
26 | release {
27 | minifyEnabled false
28 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29 | }
30 | }
31 | buildFeatures {
32 | dataBinding true
33 | }
34 | }
35 |
36 | dependencies {
37 | implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
38 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
39 | implementation 'androidx.appcompat:appcompat:1.1.0'
40 | implementation 'androidx.core:core-ktx:1.5.0-alpha01'
41 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
42 |
43 | implementation project(path: ':sdk')
44 | implementation 'com.squareup.picasso:picasso:2.5.2'
45 | }
46 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
20 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
35 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/java/org/dp/facedetection/App.kt:
--------------------------------------------------------------------------------
1 | package org.dp.facedetection
2 |
3 | import android.app.Application
4 |
5 | class App : Application() {
6 | override fun onCreate() {
7 | super.onCreate()
8 | FaceDetect.init()
9 | }
10 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_camera.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_photo.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
14 |
15 |
22 |
23 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_pick.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyloveyd/Android-FaceDetection/12602c94a221cca65d585bd0d57eef5184cfd98f/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyloveyd/Android-FaceDetection/12602c94a221cca65d585bd0d57eef5184cfd98f/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyloveyd/Android-FaceDetection/12602c94a221cca65d585bd0d57eef5184cfd98f/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyloveyd/Android-FaceDetection/12602c94a221cca65d585bd0d57eef5184cfd98f/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyloveyd/Android-FaceDetection/12602c94a221cca65d585bd0d57eef5184cfd98f/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Facedetection
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/file_paths_public.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.3.72'
5 | repositories {
6 | maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
7 | google()
8 | maven { url "https://jitpack.io" }
9 | maven { url 'http://10.115.246.232:8081/repository/maven-releases/' }
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:4.0.0'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
22 | google()
23 | maven { url "https://jitpack.io" }
24 | maven { url 'http://10.115.246.232:8081/repository/maven-releases/' }
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
22 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyloveyd/Android-FaceDetection/12602c94a221cca65d585bd0d57eef5184cfd98f/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jul 06 19:14:54 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/screenshot/device-2019-11-16-131825.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyloveyd/Android-FaceDetection/12602c94a221cca65d585bd0d57eef5184cfd98f/screenshot/device-2019-11-16-131825.png
--------------------------------------------------------------------------------
/sdk/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/sdk/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 28
5 | buildToolsVersion "28.0.3"
6 |
7 | defaultConfig {
8 | ndk {
9 | abiFilters 'armeabi-v7a'
10 | }
11 | }
12 |
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/sdk/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/sdk/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 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/dp/facedetection/Face.java:
--------------------------------------------------------------------------------
1 | package org.dp.facedetection;
2 |
3 | import org.opencv.core.Rect;
4 |
5 | /**
6 | * 识别出的人脸信息
7 | *
8 | * Stay Hungry Stay Foolish
9 | * Author: dp on 2019/3/25 12:51
10 | */
11 | public class Face {
12 | public Rect faceRect;
13 | public int faceConfidence;
14 | public int faceAngle;
15 | }
16 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/dp/facedetection/FaceDetect.java:
--------------------------------------------------------------------------------
1 | package org.dp.facedetection;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.BitmapFactory;
5 |
6 | import org.opencv.android.Utils;
7 | import org.opencv.core.MatOfRect;
8 |
9 | import java.io.File;
10 | import java.io.FileInputStream;
11 | import java.io.IOException;
12 |
13 | /**
14 | * 人脸识别
15 | *
16 | * @author yidong
17 | * @date 2019-11-13
18 | */
19 | public class FaceDetect {
20 |
21 | static {
22 | System.loadLibrary("facedetection");
23 | }
24 |
25 | public static void init() {
26 | // 调用该方法仅仅是为了加载so库
27 | }
28 |
29 | private native Face[] faceDetect(long matAddr);
30 |
31 | /**
32 | * 执行人脸识别
33 | *
34 | * @param file 人脸图片文件
35 | * @return 人脸识别结果,如果发生异常就返回null
36 | */
37 | public Face[] doFaceDetect(File file) {
38 | Bitmap bmp = getBitmapFromFile(file);
39 | try {
40 | MatOfRect mat = new MatOfRect();
41 | Utils.bitmapToMat(bmp, mat);
42 | return faceDetect(mat.getNativeObjAddr());
43 | } catch (Exception e) {
44 | e.printStackTrace();
45 | }
46 | return null;
47 | }
48 |
49 | /**
50 | * File to Bitmap
51 | */
52 | private Bitmap getBitmapFromFile(File file) {
53 | FileInputStream stream = null;
54 | try {
55 | stream = new FileInputStream(file);
56 | return BitmapFactory.decodeStream(stream);
57 | } catch (IOException e) {
58 | e.printStackTrace();
59 | } finally {
60 | if (stream != null) {
61 | try {
62 | stream.close();
63 | } catch (IOException e) {
64 | e.printStackTrace();
65 | }
66 | }
67 | }
68 | return null;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/luban/CompressionPredicate.java:
--------------------------------------------------------------------------------
1 | package org.luban;
2 |
3 | /**
4 | * Created on 2018/1/3 19:43
5 | *
6 | * @author andy
7 | *
8 | * A functional interface (callback) that returns true or false for the given input path should be compressed.
9 | */
10 |
11 | public interface CompressionPredicate {
12 |
13 | /**
14 | * Determine the given input path should be compressed and return a boolean.
15 | *
16 | * @param path input path
17 | * @return the boolean result
18 | */
19 | boolean apply(String path);
20 | }
21 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/luban/Engine.java:
--------------------------------------------------------------------------------
1 | package org.luban;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.BitmapFactory;
5 | import android.graphics.Matrix;
6 |
7 | import java.io.ByteArrayOutputStream;
8 | import java.io.File;
9 | import java.io.FileOutputStream;
10 | import java.io.IOException;
11 |
12 | /**
13 | * Responsible for starting compress and managing active and cached resources.
14 | */
15 | class Engine {
16 | private InputStreamProvider srcImg;
17 | private File tagImg;
18 | private int srcWidth;
19 | private int srcHeight;
20 | private boolean focusAlpha;
21 |
22 | Engine(InputStreamProvider srcImg, File tagImg, boolean focusAlpha) throws IOException {
23 | this.tagImg = tagImg;
24 | this.srcImg = srcImg;
25 | this.focusAlpha = focusAlpha;
26 |
27 | BitmapFactory.Options options = new BitmapFactory.Options();
28 | options.inJustDecodeBounds = true;
29 | options.inSampleSize = 1;
30 |
31 | BitmapFactory.decodeStream(srcImg.open(), null, options);
32 | this.srcWidth = options.outWidth;
33 | this.srcHeight = options.outHeight;
34 | }
35 |
36 | private int computeSize() {
37 | srcWidth = srcWidth % 2 == 1 ? srcWidth + 1 : srcWidth;
38 | srcHeight = srcHeight % 2 == 1 ? srcHeight + 1 : srcHeight;
39 |
40 | int longSide = Math.max(srcWidth, srcHeight);
41 | int shortSide = Math.min(srcWidth, srcHeight);
42 |
43 | float scale = ((float) shortSide / longSide);
44 | if (scale <= 1 && scale > 0.5625) {
45 | if (longSide < 832) {
46 | return 1;
47 | } else if (longSide < 2495) {
48 | return 2;
49 | } else if (longSide > 2495 && longSide < 5120) {
50 | return 4;
51 | } else {
52 | return longSide / 640 == 0 ? 1 : longSide / 640;
53 | }
54 | } else if (scale <= 0.5625 && scale > 0.5) {
55 | return longSide / 640 == 0 ? 1 : longSide / 640;
56 | } else {
57 | return (int) Math.ceil(longSide / (640.0 / scale));
58 | }
59 | }
60 |
61 | private Bitmap rotatingImage(Bitmap bitmap, int angle) {
62 | Matrix matrix = new Matrix();
63 |
64 | matrix.postRotate(angle);
65 |
66 | return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
67 | }
68 |
69 | File compress() throws IOException {
70 | BitmapFactory.Options options = new BitmapFactory.Options();
71 | options.inSampleSize = computeSize();
72 |
73 | Bitmap tagBitmap = BitmapFactory.decodeStream(srcImg.open(), null, options);
74 | ByteArrayOutputStream stream = new ByteArrayOutputStream();
75 |
76 | if (Checker.SINGLE.isJPG(srcImg.open())) {
77 | tagBitmap = rotatingImage(tagBitmap, Checker.SINGLE.getOrientation(srcImg.open()));
78 | }
79 | tagBitmap.compress(focusAlpha ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, 75, stream);
80 | tagBitmap.recycle();
81 |
82 | FileOutputStream fos = new FileOutputStream(tagImg);
83 | fos.write(stream.toByteArray());
84 | fos.flush();
85 | fos.close();
86 | stream.close();
87 |
88 | return tagImg;
89 | }
90 | }
--------------------------------------------------------------------------------
/sdk/src/main/java/org/luban/InputStreamAdapter.java:
--------------------------------------------------------------------------------
1 | package org.luban;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 |
6 | /**
7 | * Automatically close the previous InputStream when opening a new InputStream,
8 | * and finally need to manually call {@link #close()} to release the resource.
9 | */
10 | public abstract class InputStreamAdapter implements InputStreamProvider {
11 |
12 | private InputStream inputStream;
13 |
14 | @Override
15 | public InputStream open() throws IOException {
16 | close();
17 | inputStream = openInternal();
18 | return inputStream;
19 | }
20 |
21 | public abstract InputStream openInternal() throws IOException;
22 |
23 | @Override
24 | public void close() {
25 | if (inputStream != null) {
26 | try {
27 | inputStream.close();
28 | } catch (IOException ignore) {
29 | } finally {
30 | inputStream = null;
31 | }
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/sdk/src/main/java/org/luban/InputStreamProvider.java:
--------------------------------------------------------------------------------
1 | package org.luban;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 |
6 | /**
7 | * 通过此接口获取输入流,以兼容文件、FileProvider方式获取到的图片
8 | *
9 | * Get the input stream through this interface, and obtain the picture using compatible files and FileProvider
10 | */
11 | public interface InputStreamProvider {
12 |
13 | InputStream open() throws IOException;
14 |
15 | void close();
16 |
17 | String getPath();
18 | }
19 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/luban/OnCompressListener.java:
--------------------------------------------------------------------------------
1 | package org.luban;
2 |
3 | import java.io.File;
4 |
5 | public interface OnCompressListener {
6 |
7 | /**
8 | * Fired when the compression is started, override to handle in your own code
9 | */
10 | void onStart();
11 |
12 | /**
13 | * Fired when a compression returns successfully, override to handle in your own code
14 | */
15 | void onSuccess(File file);
16 |
17 | /**
18 | * Fired when a compression fails to complete, override to handle in your own code
19 | */
20 | void onError(Throwable e);
21 | }
22 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/luban/OnRenameListener.java:
--------------------------------------------------------------------------------
1 | package org.luban;
2 |
3 | /**
4 | * Author: zibin
5 | * Datetime: 2018/5/18
6 | *
7 | * 提供修改压缩图片命名接口
8 | *
9 | * A functional interface (callback) that used to rename the file after compress.
10 | */
11 | public interface OnRenameListener {
12 |
13 | /**
14 | * 压缩前调用该方法用于修改压缩后文件名
15 | *
16 | * Call before compression begins.
17 | *
18 | * @param filePath 传入文件路径/ file path
19 | * @return 返回重命名后的字符串/ file name
20 | */
21 | String rename(String filePath);
22 | }
23 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/android/CameraActivity.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Activity;
5 | import android.content.pm.PackageManager;
6 | import android.os.Build;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | import static android.Manifest.permission.CAMERA;
12 |
13 | public class CameraActivity extends Activity {
14 |
15 | private static final int CAMERA_PERMISSION_REQUEST_CODE = 200;
16 |
17 | protected List extends CameraBridgeViewBase> getCameraViewList() {
18 | return new ArrayList();
19 | }
20 |
21 | protected void onCameraPermissionGranted() {
22 | List extends CameraBridgeViewBase> cameraViews = getCameraViewList();
23 | if (cameraViews == null) {
24 | return;
25 | }
26 | for (CameraBridgeViewBase cameraBridgeViewBase: cameraViews) {
27 | if (cameraBridgeViewBase != null) {
28 | cameraBridgeViewBase.setCameraPermissionGranted();
29 | }
30 | }
31 | }
32 |
33 | @Override
34 | protected void onStart() {
35 | super.onStart();
36 | boolean havePermission = true;
37 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
38 | if (checkSelfPermission(CAMERA) != PackageManager.PERMISSION_GRANTED) {
39 | requestPermissions(new String[]{CAMERA}, CAMERA_PERMISSION_REQUEST_CODE);
40 | havePermission = false;
41 | }
42 | }
43 | if (havePermission) {
44 | onCameraPermissionGranted();
45 | }
46 | }
47 |
48 | @Override
49 | @TargetApi(Build.VERSION_CODES.M)
50 | public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
51 | if (requestCode == CAMERA_PERMISSION_REQUEST_CODE && grantResults.length > 0
52 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
53 | onCameraPermissionGranted();
54 | }
55 | super.onRequestPermissionsResult(requestCode, permissions, grantResults);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/android/CameraGLSurfaceView.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.opengl.GLSurfaceView;
6 | import android.util.AttributeSet;
7 | import android.util.Log;
8 | import android.view.SurfaceHolder;
9 |
10 | import org.opencv.R;
11 |
12 | public class CameraGLSurfaceView extends GLSurfaceView {
13 |
14 | private static final String LOGTAG = "CameraGLSurfaceView";
15 |
16 | public interface CameraTextureListener {
17 | /**
18 | * This method is invoked when camera preview has started. After this method is invoked
19 | * the frames will start to be delivered to client via the onCameraFrame() callback.
20 | * @param width - the width of the frames that will be delivered
21 | * @param height - the height of the frames that will be delivered
22 | */
23 | public void onCameraViewStarted(int width, int height);
24 |
25 | /**
26 | * This method is invoked when camera preview has been stopped for some reason.
27 | * No frames will be delivered via onCameraFrame() callback after this method is called.
28 | */
29 | public void onCameraViewStopped();
30 |
31 | /**
32 | * This method is invoked when a new preview frame from Camera is ready.
33 | * @param texIn - the OpenGL texture ID that contains frame in RGBA format
34 | * @param texOut - the OpenGL texture ID that can be used to store modified frame image t display
35 | * @param width - the width of the frame
36 | * @param height - the height of the frame
37 | * @return `true` if `texOut` should be displayed, `false` - to show `texIn`
38 | */
39 | public boolean onCameraTexture(int texIn, int texOut, int width, int height);
40 | };
41 |
42 | private CameraTextureListener mTexListener;
43 | private CameraGLRendererBase mRenderer;
44 |
45 | public CameraGLSurfaceView(Context context, AttributeSet attrs) {
46 | super(context, attrs);
47 |
48 | TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
49 | int cameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);
50 | styledAttrs.recycle();
51 |
52 | if(android.os.Build.VERSION.SDK_INT >= 21)
53 | mRenderer = new Camera2Renderer(this);
54 | else
55 | mRenderer = new CameraRenderer(this);
56 |
57 | setCameraIndex(cameraIndex);
58 |
59 | setEGLContextClientVersion(2);
60 | setRenderer(mRenderer);
61 | setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
62 | }
63 |
64 | public void setCameraTextureListener(CameraTextureListener texListener)
65 | {
66 | mTexListener = texListener;
67 | }
68 |
69 | public CameraTextureListener getCameraTextureListener()
70 | {
71 | return mTexListener;
72 | }
73 |
74 | public void setCameraIndex(int cameraIndex) {
75 | mRenderer.setCameraIndex(cameraIndex);
76 | }
77 |
78 | public void setMaxCameraPreviewSize(int maxWidth, int maxHeight) {
79 | mRenderer.setMaxCameraPreviewSize(maxWidth, maxHeight);
80 | }
81 |
82 | @Override
83 | public void surfaceCreated(SurfaceHolder holder) {
84 | super.surfaceCreated(holder);
85 | }
86 |
87 | @Override
88 | public void surfaceDestroyed(SurfaceHolder holder) {
89 | mRenderer.mHaveSurface = false;
90 | super.surfaceDestroyed(holder);
91 | }
92 |
93 | @Override
94 | public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
95 | super.surfaceChanged(holder, format, w, h);
96 | }
97 |
98 | @Override
99 | public void onResume() {
100 | Log.i(LOGTAG, "onResume");
101 | super.onResume();
102 | mRenderer.onResume();
103 | }
104 |
105 | @Override
106 | public void onPause() {
107 | Log.i(LOGTAG, "onPause");
108 | mRenderer.onPause();
109 | super.onPause();
110 | }
111 |
112 | public void enableView() {
113 | mRenderer.enableView();
114 | }
115 |
116 | public void disableView() {
117 | mRenderer.disableView();
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/android/FpsMeter.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.Color;
5 | import android.graphics.Paint;
6 | import android.util.Log;
7 |
8 | import org.opencv.core.Core;
9 |
10 | import java.text.DecimalFormat;
11 |
12 | public class FpsMeter {
13 | private static final String TAG = "FpsMeter";
14 | private static final int STEP = 20;
15 | private static final DecimalFormat FPS_FORMAT = new DecimalFormat("0.00");
16 |
17 | private int mFramesCounter;
18 | private double mFrequency;
19 | private long mprevFrameTime;
20 | private String mStrfps;
21 | Paint mPaint;
22 | boolean mIsInitialized = false;
23 | int mWidth = 0;
24 | int mHeight = 0;
25 |
26 | public void init() {
27 | mFramesCounter = 0;
28 | mFrequency = Core.getTickFrequency();
29 | mprevFrameTime = Core.getTickCount();
30 | mStrfps = "";
31 |
32 | mPaint = new Paint();
33 | mPaint.setColor(Color.BLUE);
34 | mPaint.setTextSize(20);
35 | }
36 |
37 | public void measure() {
38 | if (!mIsInitialized) {
39 | init();
40 | mIsInitialized = true;
41 | } else {
42 | mFramesCounter++;
43 | if (mFramesCounter % STEP == 0) {
44 | long time = Core.getTickCount();
45 | double fps = STEP * mFrequency / (time - mprevFrameTime);
46 | mprevFrameTime = time;
47 | if (mWidth != 0 && mHeight != 0)
48 | mStrfps = FPS_FORMAT.format(fps) + " FPS@" + Integer.valueOf(mWidth) + "x" + Integer.valueOf(mHeight);
49 | else
50 | mStrfps = FPS_FORMAT.format(fps) + " FPS";
51 | Log.i(TAG, mStrfps);
52 | }
53 | }
54 | }
55 |
56 | public void setResolution(int width, int height) {
57 | mWidth = width;
58 | mHeight = height;
59 | }
60 |
61 | public void draw(Canvas canvas, float offsetx, float offsety) {
62 | Log.d(TAG, mStrfps);
63 | canvas.drawText(mStrfps, offsetx, offsety, mPaint);
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/android/InstallCallbackInterface.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | /**
4 | * Installation callback interface.
5 | */
6 | public interface InstallCallbackInterface
7 | {
8 | /**
9 | * New package installation is required.
10 | */
11 | static final int NEW_INSTALLATION = 0;
12 | /**
13 | * Current package installation is in progress.
14 | */
15 | static final int INSTALLATION_PROGRESS = 1;
16 |
17 | /**
18 | * Target package name.
19 | * @return Return target package name.
20 | */
21 | public String getPackageName();
22 | /**
23 | * Installation is approved.
24 | */
25 | public void install();
26 | /**
27 | * Installation is canceled.
28 | */
29 | public void cancel();
30 | /**
31 | * Wait for package installation.
32 | */
33 | public void wait_install();
34 | };
35 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/android/LoaderCallbackInterface.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | /**
4 | * Interface for callback object in case of asynchronous initialization of OpenCV.
5 | */
6 | public interface LoaderCallbackInterface
7 | {
8 | /**
9 | * OpenCV initialization finished successfully.
10 | */
11 | static final int SUCCESS = 0;
12 | /**
13 | * Google Play Market cannot be invoked.
14 | */
15 | static final int MARKET_ERROR = 2;
16 | /**
17 | * OpenCV library installation has been canceled by the user.
18 | */
19 | static final int INSTALL_CANCELED = 3;
20 | /**
21 | * This version of OpenCV Manager Service is incompatible with the app. Possibly, a service update is required.
22 | */
23 | static final int INCOMPATIBLE_MANAGER_VERSION = 4;
24 | /**
25 | * OpenCV library initialization has failed.
26 | */
27 | static final int INIT_FAILED = 0xff;
28 |
29 | /**
30 | * Callback method, called after OpenCV library initialization.
31 | * @param status status of initialization (see initialization status constants).
32 | */
33 | public void onManagerConnected(int status);
34 |
35 | /**
36 | * Callback method, called in case the package installation is needed.
37 | * @param callback answer object with approve and cancel methods and the package description.
38 | */
39 | public void onPackageInstall(final int operation, InstallCallbackInterface callback);
40 | };
41 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/android/OpenCVLoader.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * Helper class provides common initialization methods for OpenCV library.
7 | */
8 | public class OpenCVLoader
9 | {
10 | /**
11 | * OpenCV Library version 2.4.2.
12 | */
13 | public static final String OPENCV_VERSION_2_4_2 = "2.4.2";
14 |
15 | /**
16 | * OpenCV Library version 2.4.3.
17 | */
18 | public static final String OPENCV_VERSION_2_4_3 = "2.4.3";
19 |
20 | /**
21 | * OpenCV Library version 2.4.4.
22 | */
23 | public static final String OPENCV_VERSION_2_4_4 = "2.4.4";
24 |
25 | /**
26 | * OpenCV Library version 2.4.5.
27 | */
28 | public static final String OPENCV_VERSION_2_4_5 = "2.4.5";
29 |
30 | /**
31 | * OpenCV Library version 2.4.6.
32 | */
33 | public static final String OPENCV_VERSION_2_4_6 = "2.4.6";
34 |
35 | /**
36 | * OpenCV Library version 2.4.7.
37 | */
38 | public static final String OPENCV_VERSION_2_4_7 = "2.4.7";
39 |
40 | /**
41 | * OpenCV Library version 2.4.8.
42 | */
43 | public static final String OPENCV_VERSION_2_4_8 = "2.4.8";
44 |
45 | /**
46 | * OpenCV Library version 2.4.9.
47 | */
48 | public static final String OPENCV_VERSION_2_4_9 = "2.4.9";
49 |
50 | /**
51 | * OpenCV Library version 2.4.10.
52 | */
53 | public static final String OPENCV_VERSION_2_4_10 = "2.4.10";
54 |
55 | /**
56 | * OpenCV Library version 2.4.11.
57 | */
58 | public static final String OPENCV_VERSION_2_4_11 = "2.4.11";
59 |
60 | /**
61 | * OpenCV Library version 2.4.12.
62 | */
63 | public static final String OPENCV_VERSION_2_4_12 = "2.4.12";
64 |
65 | /**
66 | * OpenCV Library version 2.4.13.
67 | */
68 | public static final String OPENCV_VERSION_2_4_13 = "2.4.13";
69 |
70 | /**
71 | * OpenCV Library version 3.0.0.
72 | */
73 | public static final String OPENCV_VERSION_3_0_0 = "3.0.0";
74 |
75 | /**
76 | * OpenCV Library version 3.1.0.
77 | */
78 | public static final String OPENCV_VERSION_3_1_0 = "3.1.0";
79 |
80 | /**
81 | * OpenCV Library version 3.2.0.
82 | */
83 | public static final String OPENCV_VERSION_3_2_0 = "3.2.0";
84 |
85 | /**
86 | * OpenCV Library version 3.3.0.
87 | */
88 | public static final String OPENCV_VERSION_3_3_0 = "3.3.0";
89 |
90 | /**
91 | * OpenCV Library version 3.4.0.
92 | */
93 | public static final String OPENCV_VERSION_3_4_0 = "3.4.0";
94 |
95 | /**
96 | * Current OpenCV Library version
97 | */
98 | public static final String OPENCV_VERSION = "4.1.2";
99 |
100 |
101 | /**
102 | * Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
103 | * @return Returns true is initialization of OpenCV was successful.
104 | */
105 | public static boolean initDebug()
106 | {
107 | return StaticHelper.initOpenCV(false);
108 | }
109 |
110 | /**
111 | * Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
112 | * @param InitCuda load and initialize CUDA runtime libraries.
113 | * @return Returns true is initialization of OpenCV was successful.
114 | */
115 | public static boolean initDebug(boolean InitCuda)
116 | {
117 | return StaticHelper.initOpenCV(InitCuda);
118 | }
119 |
120 | /**
121 | * Loads and initializes OpenCV library using OpenCV Engine service.
122 | * @param Version OpenCV library version.
123 | * @param AppContext application context for connecting to the service.
124 | * @param Callback object, that implements LoaderCallbackInterface for handling the connection status.
125 | * @return Returns true if initialization of OpenCV is successful.
126 | */
127 | public static boolean initAsync(String Version, Context AppContext,
128 | LoaderCallbackInterface Callback)
129 | {
130 | return AsyncServiceHelper.initOpenCV(Version, AppContext, Callback);
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/android/StaticHelper.java:
--------------------------------------------------------------------------------
1 | package org.opencv.android;
2 |
3 | import android.util.Log;
4 |
5 | import org.opencv.core.Core;
6 |
7 | import java.util.StringTokenizer;
8 |
9 | class StaticHelper {
10 |
11 | public static boolean initOpenCV(boolean InitCuda)
12 | {
13 | boolean result;
14 | String libs = "";
15 |
16 | if(InitCuda)
17 | {
18 | loadLibrary("cudart");
19 | loadLibrary("nppc");
20 | loadLibrary("nppi");
21 | loadLibrary("npps");
22 | loadLibrary("cufft");
23 | loadLibrary("cublas");
24 | }
25 |
26 | Log.d(TAG, "Trying to get library list");
27 |
28 | try
29 | {
30 | System.loadLibrary("opencv_info");
31 | libs = getLibraryList();
32 | }
33 | catch(UnsatisfiedLinkError e)
34 | {
35 | Log.e(TAG, "OpenCV error: Cannot load info library for OpenCV");
36 | }
37 |
38 | Log.d(TAG, "Library list: \"" + libs + "\"");
39 | Log.d(TAG, "First attempt to load libs");
40 | if (initOpenCVLibs(libs))
41 | {
42 | Log.d(TAG, "First attempt to load libs is OK");
43 | String eol = System.getProperty("line.separator");
44 | for (String str : Core.getBuildInformation().split(eol))
45 | Log.i(TAG, str);
46 |
47 | result = true;
48 | }
49 | else
50 | {
51 | Log.d(TAG, "First attempt to load libs fails");
52 | result = false;
53 | }
54 |
55 | return result;
56 | }
57 |
58 | private static boolean loadLibrary(String Name)
59 | {
60 | boolean result = true;
61 |
62 | Log.d(TAG, "Trying to load library " + Name);
63 | try
64 | {
65 | System.loadLibrary(Name);
66 | Log.d(TAG, "Library " + Name + " loaded");
67 | }
68 | catch(UnsatisfiedLinkError e)
69 | {
70 | Log.d(TAG, "Cannot load library \"" + Name + "\"");
71 | e.printStackTrace();
72 | result = false;
73 | }
74 |
75 | return result;
76 | }
77 |
78 | private static boolean initOpenCVLibs(String Libs)
79 | {
80 | Log.d(TAG, "Trying to init OpenCV libs");
81 |
82 | boolean result = true;
83 |
84 | if ((null != Libs) && (Libs.length() != 0))
85 | {
86 | Log.d(TAG, "Trying to load libs by dependency list");
87 | StringTokenizer splitter = new StringTokenizer(Libs, ";");
88 | while(splitter.hasMoreTokens())
89 | {
90 | result &= loadLibrary(splitter.nextToken());
91 | }
92 | }
93 | else
94 | {
95 | // If dependencies list is not defined or empty.
96 | result = loadLibrary("opencv_java4");
97 | }
98 |
99 | return result;
100 | }
101 |
102 | private static final String TAG = "OpenCV/StaticHelper";
103 |
104 | private static native String getLibraryList();
105 | }
106 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/core/Algorithm.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.core;
5 |
6 |
7 |
8 | // C++: class Algorithm
9 | /**
10 | * This is a base class for all more or less complex algorithms in OpenCV
11 | *
12 | * especially for classes of algorithms, for which there can be multiple implementations. The examples
13 | * are stereo correspondence (for which there are algorithms like block matching, semi-global block
14 | * matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians
15 | * models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck
16 | * etc.).
17 | *
18 | * Here is example of SimpleBlobDetector use in your application via Algorithm interface:
19 | * SNIPPET: snippets/core_various.cpp Algorithm
20 | */
21 | public class Algorithm {
22 |
23 | protected final long nativeObj;
24 | protected Algorithm(long addr) { nativeObj = addr; }
25 |
26 | public long getNativeObjAddr() { return nativeObj; }
27 |
28 | // internal usage only
29 | public static Algorithm __fromPtr__(long addr) { return new Algorithm(addr); }
30 |
31 | //
32 | // C++: String cv::Algorithm::getDefaultName()
33 | //
34 |
35 | /**
36 | * Returns the algorithm string identifier.
37 | * This string is used as top level xml/yml node tag when the object is saved to a file or string.
38 | * @return automatically generated
39 | */
40 | public String getDefaultName() {
41 | return getDefaultName_0(nativeObj);
42 | }
43 |
44 |
45 | //
46 | // C++: bool cv::Algorithm::empty()
47 | //
48 |
49 | /**
50 | * Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
51 | * @return automatically generated
52 | */
53 | public boolean empty() {
54 | return empty_0(nativeObj);
55 | }
56 |
57 |
58 | //
59 | // C++: void cv::Algorithm::clear()
60 | //
61 |
62 | /**
63 | * Clears the algorithm state
64 | */
65 | public void clear() {
66 | clear_0(nativeObj);
67 | }
68 |
69 |
70 | //
71 | // C++: void cv::Algorithm::read(FileNode fn)
72 | //
73 |
74 | // Unknown type 'FileNode' (I), skipping the function
75 |
76 |
77 | //
78 | // C++: void cv::Algorithm::save(String filename)
79 | //
80 |
81 | /**
82 | * Saves the algorithm to a file.
83 | * In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).
84 | * @param filename automatically generated
85 | */
86 | public void save(String filename) {
87 | save_0(nativeObj, filename);
88 | }
89 |
90 |
91 | //
92 | // C++: void cv::Algorithm::write(Ptr_FileStorage fs, String name = String())
93 | //
94 |
95 | // Unknown type 'Ptr_FileStorage' (I), skipping the function
96 |
97 |
98 | @Override
99 | protected void finalize() throws Throwable {
100 | delete(nativeObj);
101 | }
102 |
103 |
104 |
105 | // C++: String cv::Algorithm::getDefaultName()
106 | private static native String getDefaultName_0(long nativeObj);
107 |
108 | // C++: bool cv::Algorithm::empty()
109 | private static native boolean empty_0(long nativeObj);
110 |
111 | // C++: void cv::Algorithm::clear()
112 | private static native void clear_0(long nativeObj);
113 |
114 | // C++: void cv::Algorithm::save(String filename)
115 | private static native void save_0(long nativeObj, String filename);
116 |
117 | // native support for java finalize()
118 | private static native void delete(long nativeObj);
119 |
120 | }
121 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/core/CvException.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | public class CvException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = 1L;
6 |
7 | public CvException(String msg) {
8 | super(msg);
9 | }
10 |
11 | @Override
12 | public String toString() {
13 | return "CvException [" + super.toString() + "]";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/core/CvType.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | public final class CvType {
4 |
5 | // type depth constants
6 | public static final int
7 | CV_8U = 0,
8 | CV_8S = 1,
9 | CV_16U = 2,
10 | CV_16S = 3,
11 | CV_32S = 4,
12 | CV_32F = 5,
13 | CV_64F = 6,
14 | CV_16F = 7;
15 |
16 | /**
17 | * @deprecated please use {@link #CV_16F}
18 | */
19 | @Deprecated
20 | public static final int CV_USRTYPE1 = CV_16F;
21 |
22 | // predefined type constants
23 | public static final int
24 | CV_8UC1 = CV_8UC(1), CV_8UC2 = CV_8UC(2), CV_8UC3 = CV_8UC(3), CV_8UC4 = CV_8UC(4),
25 | CV_8SC1 = CV_8SC(1), CV_8SC2 = CV_8SC(2), CV_8SC3 = CV_8SC(3), CV_8SC4 = CV_8SC(4),
26 | CV_16UC1 = CV_16UC(1), CV_16UC2 = CV_16UC(2), CV_16UC3 = CV_16UC(3), CV_16UC4 = CV_16UC(4),
27 | CV_16SC1 = CV_16SC(1), CV_16SC2 = CV_16SC(2), CV_16SC3 = CV_16SC(3), CV_16SC4 = CV_16SC(4),
28 | CV_32SC1 = CV_32SC(1), CV_32SC2 = CV_32SC(2), CV_32SC3 = CV_32SC(3), CV_32SC4 = CV_32SC(4),
29 | CV_32FC1 = CV_32FC(1), CV_32FC2 = CV_32FC(2), CV_32FC3 = CV_32FC(3), CV_32FC4 = CV_32FC(4),
30 | CV_64FC1 = CV_64FC(1), CV_64FC2 = CV_64FC(2), CV_64FC3 = CV_64FC(3), CV_64FC4 = CV_64FC(4),
31 | CV_16FC1 = CV_16FC(1), CV_16FC2 = CV_16FC(2), CV_16FC3 = CV_16FC(3), CV_16FC4 = CV_16FC(4);
32 |
33 | private static final int CV_CN_MAX = 512, CV_CN_SHIFT = 3, CV_DEPTH_MAX = (1 << CV_CN_SHIFT);
34 |
35 | public static final int makeType(int depth, int channels) {
36 | if (channels <= 0 || channels >= CV_CN_MAX) {
37 | throw new UnsupportedOperationException(
38 | "Channels count should be 1.." + (CV_CN_MAX - 1));
39 | }
40 | if (depth < 0 || depth >= CV_DEPTH_MAX) {
41 | throw new UnsupportedOperationException(
42 | "Data type depth should be 0.." + (CV_DEPTH_MAX - 1));
43 | }
44 | return (depth & (CV_DEPTH_MAX - 1)) + ((channels - 1) << CV_CN_SHIFT);
45 | }
46 |
47 | public static final int CV_8UC(int ch) {
48 | return makeType(CV_8U, ch);
49 | }
50 |
51 | public static final int CV_8SC(int ch) {
52 | return makeType(CV_8S, ch);
53 | }
54 |
55 | public static final int CV_16UC(int ch) {
56 | return makeType(CV_16U, ch);
57 | }
58 |
59 | public static final int CV_16SC(int ch) {
60 | return makeType(CV_16S, ch);
61 | }
62 |
63 | public static final int CV_32SC(int ch) {
64 | return makeType(CV_32S, ch);
65 | }
66 |
67 | public static final int CV_32FC(int ch) {
68 | return makeType(CV_32F, ch);
69 | }
70 |
71 | public static final int CV_64FC(int ch) {
72 | return makeType(CV_64F, ch);
73 | }
74 |
75 | public static final int CV_16FC(int ch) {
76 | return makeType(CV_16F, ch);
77 | }
78 |
79 | public static final int channels(int type) {
80 | return (type >> CV_CN_SHIFT) + 1;
81 | }
82 |
83 | public static final int depth(int type) {
84 | return type & (CV_DEPTH_MAX - 1);
85 | }
86 |
87 | public static final boolean isInteger(int type) {
88 | return depth(type) < CV_32F;
89 | }
90 |
91 | public static final int ELEM_SIZE(int type) {
92 | switch (depth(type)) {
93 | case CV_8U:
94 | case CV_8S:
95 | return channels(type);
96 | case CV_16U:
97 | case CV_16S:
98 | case CV_16F:
99 | return 2 * channels(type);
100 | case CV_32S:
101 | case CV_32F:
102 | return 4 * channels(type);
103 | case CV_64F:
104 | return 8 * channels(type);
105 | default:
106 | throw new UnsupportedOperationException(
107 | "Unsupported CvType value: " + type);
108 | }
109 | }
110 |
111 | public static final String typeToString(int type) {
112 | String s;
113 | switch (depth(type)) {
114 | case CV_8U:
115 | s = "CV_8U";
116 | break;
117 | case CV_8S:
118 | s = "CV_8S";
119 | break;
120 | case CV_16U:
121 | s = "CV_16U";
122 | break;
123 | case CV_16S:
124 | s = "CV_16S";
125 | break;
126 | case CV_32S:
127 | s = "CV_32S";
128 | break;
129 | case CV_32F:
130 | s = "CV_32F";
131 | break;
132 | case CV_64F:
133 | s = "CV_64F";
134 | break;
135 | case CV_16F:
136 | s = "CV_16F";
137 | break;
138 | default:
139 | throw new UnsupportedOperationException(
140 | "Unsupported CvType value: " + type);
141 | }
142 |
143 | int ch = channels(type);
144 | if (ch <= 4)
145 | return s + "C" + ch;
146 | else
147 | return s + "C(" + ch + ")";
148 | }
149 |
150 | }
151 |
--------------------------------------------------------------------------------
/sdk/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 | public boolean lessThan(DMatch it) {
49 | return distance < it.distance;
50 | }
51 |
52 | @Override
53 | public String toString() {
54 | return "DMatch [queryIdx=" + queryIdx + ", trainIdx=" + trainIdx
55 | + ", imgIdx=" + imgIdx + ", distance=" + distance + "]";
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/core/KeyPoint.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //javadoc: KeyPoint
4 | public class KeyPoint {
5 |
6 | /**
7 | * Coordinates of the keypoint.
8 | */
9 | public Point pt;
10 | /**
11 | * Diameter of the useful keypoint adjacent area.
12 | */
13 | public float size;
14 | /**
15 | * Computed orientation of the keypoint (-1 if not applicable).
16 | */
17 | public float angle;
18 | /**
19 | * The response, by which the strongest keypoints have been selected. Can
20 | * be used for further sorting or subsampling.
21 | */
22 | public float response;
23 | /**
24 | * Octave (pyramid layer), from which the keypoint has been extracted.
25 | */
26 | public int octave;
27 | /**
28 | * Object ID, that can be used to cluster keypoints by an object they
29 | * belong to.
30 | */
31 | public int class_id;
32 |
33 | // javadoc:KeyPoint::KeyPoint(x,y,_size,_angle,_response,_octave,_class_id)
34 | public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id) {
35 | pt = new Point(x, y);
36 | size = _size;
37 | angle = _angle;
38 | response = _response;
39 | octave = _octave;
40 | class_id = _class_id;
41 | }
42 |
43 | // javadoc: KeyPoint::KeyPoint()
44 | public KeyPoint() {
45 | this(0, 0, 0, -1, 0, 0, -1);
46 | }
47 |
48 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response, _octave)
49 | public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave) {
50 | this(x, y, _size, _angle, _response, _octave, -1);
51 | }
52 |
53 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response)
54 | public KeyPoint(float x, float y, float _size, float _angle, float _response) {
55 | this(x, y, _size, _angle, _response, 0, -1);
56 | }
57 |
58 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle)
59 | public KeyPoint(float x, float y, float _size, float _angle) {
60 | this(x, y, _size, _angle, 0, 0, -1);
61 | }
62 |
63 | // javadoc: KeyPoint::KeyPoint(x, y, _size)
64 | public KeyPoint(float x, float y, float _size) {
65 | this(x, y, _size, -1, 0, 0, -1);
66 | }
67 |
68 | @Override
69 | public String toString() {
70 | return "KeyPoint [pt=" + pt + ", size=" + size + ", angle=" + angle
71 | + ", response=" + response + ", octave=" + octave
72 | + ", class_id=" + class_id + "]";
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/sdk/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 MatOfByte(int offset, int length, byte...a) {
39 | super();
40 | fromArray(offset, length, a);
41 | }
42 |
43 | public void alloc(int elemNumber) {
44 | if(elemNumber>0)
45 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
46 | }
47 |
48 | public void fromArray(byte...a) {
49 | if(a==null || a.length==0)
50 | return;
51 | int num = a.length / _channels;
52 | alloc(num);
53 | put(0, 0, a); //TODO: check ret val!
54 | }
55 |
56 | public void fromArray(int offset, int length, byte...a) {
57 | if (offset < 0)
58 | throw new IllegalArgumentException("offset < 0");
59 | if (a == null)
60 | throw new NullPointerException();
61 | if (length < 0 || length + offset > a.length)
62 | throw new IllegalArgumentException("invalid 'length' parameter: " + Integer.toString(length));
63 | if (a.length == 0)
64 | return;
65 | int num = length / _channels;
66 | alloc(num);
67 | put(0, 0, a, offset, length); //TODO: check ret val!
68 | }
69 |
70 | public byte[] toArray() {
71 | int num = checkVector(_channels, _depth);
72 | if(num < 0)
73 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
74 | byte[] a = new byte[num * _channels];
75 | if(num == 0)
76 | return a;
77 | get(0, 0, a); //TODO: check ret val!
78 | return a;
79 | }
80 |
81 | public void fromList(List lb) {
82 | if(lb==null || lb.size()==0)
83 | return;
84 | Byte ab[] = lb.toArray(new Byte[0]);
85 | byte a[] = new byte[ab.length];
86 | for(int i=0; i toList() {
92 | byte[] a = toArray();
93 | Byte ab[] = new Byte[a.length];
94 | for(int i=0; i0)
40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
41 | }
42 |
43 |
44 | public void fromArray(DMatch...a) {
45 | if(a==null || a.length==0)
46 | return;
47 | int num = a.length;
48 | alloc(num);
49 | float buff[] = new float[num * _channels];
50 | for(int i=0; i ldm) {
73 | DMatch adm[] = ldm.toArray(new DMatch[0]);
74 | fromArray(adm);
75 | }
76 |
77 | public List toList() {
78 | DMatch[] adm = toArray();
79 | return Arrays.asList(adm);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/sdk/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 toList() {
73 | double[] a = toArray();
74 | Double ab[] = new Double[a.length];
75 | for(int i=0; i0)
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 toList() {
73 | float[] a = toArray();
74 | Float ab[] = new Float[a.length];
75 | for(int i=0; i0)
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 toList() {
73 | float[] a = toArray();
74 | Float ab[] = new Float[a.length];
75 | for(int i=0; i0)
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 toList() {
73 | float[] a = toArray();
74 | Float ab[] = new Float[a.length];
75 | for(int i=0; i0)
41 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
42 | }
43 |
44 | public void fromArray(int...a) {
45 | if(a==null || a.length==0)
46 | return;
47 | int num = a.length / _channels;
48 | alloc(num);
49 | put(0, 0, a); //TODO: check ret val!
50 | }
51 |
52 | public int[] toArray() {
53 | int num = checkVector(_channels, _depth);
54 | if(num < 0)
55 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
56 | int[] a = new int[num * _channels];
57 | if(num == 0)
58 | return a;
59 | get(0, 0, a); //TODO: check ret val!
60 | return a;
61 | }
62 |
63 | public void fromList(List lb) {
64 | if(lb==null || lb.size()==0)
65 | return;
66 | Integer ab[] = lb.toArray(new Integer[0]);
67 | int a[] = new int[ab.length];
68 | for(int i=0; i toList() {
74 | int[] a = toArray();
75 | Integer ab[] = new Integer[a.length];
76 | for(int i=0; i0)
41 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
42 | }
43 |
44 | public void fromArray(int...a) {
45 | if(a==null || a.length==0)
46 | return;
47 | int num = a.length / _channels;
48 | alloc(num);
49 | put(0, 0, a); //TODO: check ret val!
50 | }
51 |
52 | public int[] toArray() {
53 | int num = checkVector(_channels, _depth);
54 | if(num < 0)
55 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
56 | int[] a = new int[num * _channels];
57 | if(num == 0)
58 | return a;
59 | get(0, 0, a); //TODO: check ret val!
60 | return a;
61 | }
62 |
63 | public void fromList(List lb) {
64 | if(lb==null || lb.size()==0)
65 | return;
66 | Integer ab[] = lb.toArray(new Integer[0]);
67 | int a[] = new int[ab.length];
68 | for(int i=0; i toList() {
74 | int[] a = toArray();
75 | Integer ab[] = new Integer[a.length];
76 | for(int i=0; i0)
40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
41 | }
42 |
43 | public void fromArray(KeyPoint...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 lkp) {
76 | KeyPoint akp[] = lkp.toArray(new KeyPoint[0]);
77 | fromArray(akp);
78 | }
79 |
80 | public List toList() {
81 | KeyPoint[] akp = toArray();
82 | return Arrays.asList(akp);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/sdk/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 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 |
--------------------------------------------------------------------------------
/sdk/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 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 |
--------------------------------------------------------------------------------
/sdk/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 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 |
--------------------------------------------------------------------------------
/sdk/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 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 |
--------------------------------------------------------------------------------
/sdk/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 |
7 | public class MatOfRect extends Mat {
8 | // 32SC4
9 | private static final int _depth = CvType.CV_32S;
10 | private static final int _channels = 4;
11 |
12 | public MatOfRect() {
13 | super();
14 | }
15 |
16 | protected MatOfRect(long addr) {
17 | super(addr);
18 | if( !empty() && checkVector(_channels, _depth) < 0 )
19 | throw new IllegalArgumentException("Incompatible Mat");
20 | //FIXME: do we need release() here?
21 | }
22 |
23 | public static MatOfRect fromNativeAddr(long addr) {
24 | return new MatOfRect(addr);
25 | }
26 |
27 | public MatOfRect(Mat m) {
28 | super(m, Range.all());
29 | if( !empty() && checkVector(_channels, _depth) < 0 )
30 | throw new IllegalArgumentException("Incompatible Mat");
31 | //FIXME: do we need release() here?
32 | }
33 |
34 | public MatOfRect(Rect...a) {
35 | super();
36 | fromArray(a);
37 | }
38 |
39 | public void alloc(int elemNumber) {
40 | if(elemNumber>0)
41 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
42 | }
43 |
44 | public void fromArray(Rect...a) {
45 | if(a==null || a.length==0)
46 | return;
47 | int num = a.length;
48 | alloc(num);
49 | int buff[] = new int[num * _channels];
50 | for(int i=0; i 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 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/core/MatOfRect2d.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 |
7 | public class MatOfRect2d extends Mat {
8 | // 64FC4
9 | private static final int _depth = CvType.CV_64F;
10 | private static final int _channels = 4;
11 |
12 | public MatOfRect2d() {
13 | super();
14 | }
15 |
16 | protected MatOfRect2d(long addr) {
17 | super(addr);
18 | if( !empty() && checkVector(_channels, _depth) < 0 )
19 | throw new IllegalArgumentException("Incompatible Mat");
20 | //FIXME: do we need release() here?
21 | }
22 |
23 | public static MatOfRect2d fromNativeAddr(long addr) {
24 | return new MatOfRect2d(addr);
25 | }
26 |
27 | public MatOfRect2d(Mat m) {
28 | super(m, Range.all());
29 | if( !empty() && checkVector(_channels, _depth) < 0 )
30 | throw new IllegalArgumentException("Incompatible Mat");
31 | //FIXME: do we need release() here?
32 | }
33 |
34 | public MatOfRect2d(Rect2d...a) {
35 | super();
36 | fromArray(a);
37 | }
38 |
39 | public void alloc(int elemNumber) {
40 | if(elemNumber>0)
41 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
42 | }
43 |
44 | public void fromArray(Rect2d...a) {
45 | if(a==null || a.length==0)
46 | return;
47 | int num = a.length;
48 | alloc(num);
49 | double buff[] = new double[num * _channels];
50 | for(int i=0; i lr) {
73 | Rect2d ap[] = lr.toArray(new Rect2d[0]);
74 | fromArray(ap);
75 | }
76 |
77 | public List toList() {
78 | Rect2d[] ar = toArray();
79 | return Arrays.asList(ar);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/core/MatOfRotatedRect.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 |
7 |
8 | public class MatOfRotatedRect extends Mat {
9 | // 32FC5
10 | private static final int _depth = CvType.CV_32F;
11 | private static final int _channels = 5;
12 |
13 | public MatOfRotatedRect() {
14 | super();
15 | }
16 |
17 | protected MatOfRotatedRect(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 MatOfRotatedRect fromNativeAddr(long addr) {
25 | return new MatOfRotatedRect(addr);
26 | }
27 |
28 | public MatOfRotatedRect(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 MatOfRotatedRect(RotatedRect...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(RotatedRect...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 lr) {
76 | RotatedRect ap[] = lr.toArray(new RotatedRect[0]);
77 | fromArray(ap);
78 | }
79 |
80 | public List toList() {
81 | RotatedRect[] ar = toArray();
82 | return Arrays.asList(ar);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/sdk/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) return true;
55 | if (!(obj instanceof Point)) return false;
56 | Point it = (Point) obj;
57 | return x == it.x && y == it.y;
58 | }
59 |
60 | public boolean inside(Rect r) {
61 | return r.contains(this);
62 | }
63 |
64 | @Override
65 | public String toString() {
66 | return "{" + x + ", " + y + "}";
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/sdk/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) return true;
70 | if (!(obj instanceof Point3)) return false;
71 | Point3 it = (Point3) obj;
72 | return x == it.x && y == it.y && z == it.z;
73 | }
74 |
75 | @Override
76 | public String toString() {
77 | return "{" + x + ", " + y + ", " + z + "}";
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/sdk/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) return true;
73 | if (!(obj instanceof Range)) return false;
74 | Range it = (Range) obj;
75 | return start == it.start && end == it.end;
76 | }
77 |
78 | @Override
79 | public String toString() {
80 | return "[" + start + ", " + end + ")";
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/sdk/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 empty() {
69 | return width <= 0 || height <= 0;
70 | }
71 |
72 | public boolean contains(Point p) {
73 | return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height;
74 | }
75 |
76 | @Override
77 | public int hashCode() {
78 | final int prime = 31;
79 | int result = 1;
80 | long temp;
81 | temp = Double.doubleToLongBits(height);
82 | result = prime * result + (int) (temp ^ (temp >>> 32));
83 | temp = Double.doubleToLongBits(width);
84 | result = prime * result + (int) (temp ^ (temp >>> 32));
85 | temp = Double.doubleToLongBits(x);
86 | result = prime * result + (int) (temp ^ (temp >>> 32));
87 | temp = Double.doubleToLongBits(y);
88 | result = prime * result + (int) (temp ^ (temp >>> 32));
89 | return result;
90 | }
91 |
92 | @Override
93 | public boolean equals(Object obj) {
94 | if (this == obj) return true;
95 | if (!(obj instanceof Rect)) return false;
96 | Rect it = (Rect) obj;
97 | return x == it.x && y == it.y && width == it.width && height == it.height;
98 | }
99 |
100 | @Override
101 | public String toString() {
102 | return "{" + x + ", " + y + ", " + width + "x" + height + "}";
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/core/Rect2d.java:
--------------------------------------------------------------------------------
1 | package org.opencv.core;
2 |
3 | //javadoc:Rect2d_
4 | public class Rect2d {
5 |
6 | public double x, y, width, height;
7 |
8 | public Rect2d(double x, double y, double width, double height) {
9 | this.x = x;
10 | this.y = y;
11 | this.width = width;
12 | this.height = height;
13 | }
14 |
15 | public Rect2d() {
16 | this(0, 0, 0, 0);
17 | }
18 |
19 | public Rect2d(Point p1, Point p2) {
20 | x = (double) (p1.x < p2.x ? p1.x : p2.x);
21 | y = (double) (p1.y < p2.y ? p1.y : p2.y);
22 | width = (double) (p1.x > p2.x ? p1.x : p2.x) - x;
23 | height = (double) (p1.y > p2.y ? p1.y : p2.y) - y;
24 | }
25 |
26 | public Rect2d(Point p, Size s) {
27 | this((double) p.x, (double) p.y, (double) s.width, (double) s.height);
28 | }
29 |
30 | public Rect2d(double[] vals) {
31 | set(vals);
32 | }
33 |
34 | public void set(double[] vals) {
35 | if (vals != null) {
36 | x = vals.length > 0 ? (double) vals[0] : 0;
37 | y = vals.length > 1 ? (double) vals[1] : 0;
38 | width = vals.length > 2 ? (double) vals[2] : 0;
39 | height = vals.length > 3 ? (double) vals[3] : 0;
40 | } else {
41 | x = 0;
42 | y = 0;
43 | width = 0;
44 | height = 0;
45 | }
46 | }
47 |
48 | public Rect2d clone() {
49 | return new Rect2d(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 empty() {
69 | return width <= 0 || height <= 0;
70 | }
71 |
72 | public boolean contains(Point p) {
73 | return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height;
74 | }
75 |
76 | @Override
77 | public int hashCode() {
78 | final int prime = 31;
79 | int result = 1;
80 | long temp;
81 | temp = Double.doubleToLongBits(height);
82 | result = prime * result + (int) (temp ^ (temp >>> 32));
83 | temp = Double.doubleToLongBits(width);
84 | result = prime * result + (int) (temp ^ (temp >>> 32));
85 | temp = Double.doubleToLongBits(x);
86 | result = prime * result + (int) (temp ^ (temp >>> 32));
87 | temp = Double.doubleToLongBits(y);
88 | result = prime * result + (int) (temp ^ (temp >>> 32));
89 | return result;
90 | }
91 |
92 | @Override
93 | public boolean equals(Object obj) {
94 | if (this == obj) return true;
95 | if (!(obj instanceof Rect2d)) return false;
96 | Rect2d it = (Rect2d) obj;
97 | return x == it.x && y == it.y && width == it.width && height == it.height;
98 | }
99 |
100 | @Override
101 | public String toString() {
102 | return "{" + x + ", " + y + ", " + width + "x" + height + "}";
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/sdk/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.y = 0;
37 | size.width = 0;
38 | size.height = 0;
39 | angle = 0;
40 | }
41 | }
42 |
43 | public void points(Point pt[])
44 | {
45 | double _angle = angle * Math.PI / 180.0;
46 | double b = (double) Math.cos(_angle) * 0.5f;
47 | double a = (double) Math.sin(_angle) * 0.5f;
48 |
49 | pt[0] = new Point(
50 | center.x - a * size.height - b * size.width,
51 | center.y + b * size.height - a * size.width);
52 |
53 | pt[1] = new Point(
54 | center.x + a * size.height - b * size.width,
55 | center.y - b * size.height - a * size.width);
56 |
57 | pt[2] = new Point(
58 | 2 * center.x - pt[0].x,
59 | 2 * center.y - pt[0].y);
60 |
61 | pt[3] = new Point(
62 | 2 * center.x - pt[1].x,
63 | 2 * center.y - pt[1].y);
64 | }
65 |
66 | public Rect boundingRect()
67 | {
68 | Point pt[] = new Point[4];
69 | points(pt);
70 | 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)),
71 | (int) Math.floor(Math.min(Math.min(Math.min(pt[0].y, pt[1].y), pt[2].y), pt[3].y)),
72 | (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].x, pt[1].x), pt[2].x), pt[3].x)),
73 | (int) Math.ceil(Math.max(Math.max(Math.max(pt[0].y, pt[1].y), pt[2].y), pt[3].y)));
74 | r.width -= r.x - 1;
75 | r.height -= r.y - 1;
76 | return r;
77 | }
78 |
79 | public RotatedRect clone() {
80 | return new RotatedRect(center, size, angle);
81 | }
82 |
83 | @Override
84 | public int hashCode() {
85 | final int prime = 31;
86 | int result = 1;
87 | long temp;
88 | temp = Double.doubleToLongBits(center.x);
89 | result = prime * result + (int) (temp ^ (temp >>> 32));
90 | temp = Double.doubleToLongBits(center.y);
91 | result = prime * result + (int) (temp ^ (temp >>> 32));
92 | temp = Double.doubleToLongBits(size.width);
93 | result = prime * result + (int) (temp ^ (temp >>> 32));
94 | temp = Double.doubleToLongBits(size.height);
95 | result = prime * result + (int) (temp ^ (temp >>> 32));
96 | temp = Double.doubleToLongBits(angle);
97 | result = prime * result + (int) (temp ^ (temp >>> 32));
98 | return result;
99 | }
100 |
101 | @Override
102 | public boolean equals(Object obj) {
103 | if (this == obj) return true;
104 | if (!(obj instanceof RotatedRect)) return false;
105 | RotatedRect it = (RotatedRect) obj;
106 | return center.equals(it.center) && size.equals(it.size) && angle == it.angle;
107 | }
108 |
109 | @Override
110 | public String toString() {
111 | return "{ " + center + " " + size + " * " + angle + " }";
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/sdk/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,
53 | val[2] * it.val[2] * scale, 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) return true;
79 | if (!(obj instanceof Scalar)) return false;
80 | Scalar it = (Scalar) obj;
81 | if (!java.util.Arrays.equals(val, it.val)) return false;
82 | return true;
83 | }
84 |
85 | @Override
86 | public String toString() {
87 | return "[" + val[0] + ", " + val[1] + ", " + val[2] + ", " + val[3] + "]";
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/sdk/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 boolean empty() {
41 | return width <= 0 || height <= 0;
42 | }
43 |
44 | public Size clone() {
45 | return new Size(width, height);
46 | }
47 |
48 | @Override
49 | public int hashCode() {
50 | final int prime = 31;
51 | int result = 1;
52 | long temp;
53 | temp = Double.doubleToLongBits(height);
54 | result = prime * result + (int) (temp ^ (temp >>> 32));
55 | temp = Double.doubleToLongBits(width);
56 | result = prime * result + (int) (temp ^ (temp >>> 32));
57 | return result;
58 | }
59 |
60 | @Override
61 | public boolean equals(Object obj) {
62 | if (this == obj) return true;
63 | if (!(obj instanceof Size)) return false;
64 | Size it = (Size) obj;
65 | return width == it.width && height == it.height;
66 | }
67 |
68 | @Override
69 | public String toString() {
70 | return (int)width + "x" + (int)height;
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/sdk/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 iterative algorithm is terminated.
16 | */
17 | public static final int EPS = 2;
18 |
19 | public int type;
20 | public int maxCount;
21 | public double epsilon;
22 |
23 | /**
24 | * Termination criteria for iterative algorithms.
25 | *
26 | * @param type
27 | * the type of termination criteria: COUNT, EPS or COUNT + EPS.
28 | * @param maxCount
29 | * the maximum number of iterations/elements.
30 | * @param epsilon
31 | * the desired accuracy.
32 | */
33 | public TermCriteria(int type, int maxCount, double epsilon) {
34 | this.type = type;
35 | this.maxCount = maxCount;
36 | this.epsilon = epsilon;
37 | }
38 |
39 | /**
40 | * Termination criteria for iterative algorithms.
41 | */
42 | public TermCriteria() {
43 | this(0, 0, 0.0);
44 | }
45 |
46 | public TermCriteria(double[] vals) {
47 | set(vals);
48 | }
49 |
50 | public void set(double[] vals) {
51 | if (vals != null) {
52 | type = vals.length > 0 ? (int) vals[0] : 0;
53 | maxCount = vals.length > 1 ? (int) vals[1] : 0;
54 | epsilon = vals.length > 2 ? (double) vals[2] : 0;
55 | } else {
56 | type = 0;
57 | maxCount = 0;
58 | epsilon = 0;
59 | }
60 | }
61 |
62 | public TermCriteria clone() {
63 | return new TermCriteria(type, maxCount, epsilon);
64 | }
65 |
66 | @Override
67 | public int hashCode() {
68 | final int prime = 31;
69 | int result = 1;
70 | long temp;
71 | temp = Double.doubleToLongBits(type);
72 | result = prime * result + (int) (temp ^ (temp >>> 32));
73 | temp = Double.doubleToLongBits(maxCount);
74 | result = prime * result + (int) (temp ^ (temp >>> 32));
75 | temp = Double.doubleToLongBits(epsilon);
76 | result = prime * result + (int) (temp ^ (temp >>> 32));
77 | return result;
78 | }
79 |
80 | @Override
81 | public boolean equals(Object obj) {
82 | if (this == obj) return true;
83 | if (!(obj instanceof TermCriteria)) return false;
84 | TermCriteria it = (TermCriteria) obj;
85 | return type == it.type && maxCount == it.maxCount && epsilon == it.epsilon;
86 | }
87 |
88 | @Override
89 | public String toString() {
90 | return "{ type: " + type + ", maxCount: " + maxCount + ", epsilon: " + epsilon + "}";
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/core/TickMeter.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.core;
5 |
6 |
7 |
8 | // C++: class TickMeter
9 | /**
10 | * a Class to measure passing time.
11 | *
12 | * The class computes passing time by counting the number of ticks per second. That is, the following code computes the
13 | * execution time in seconds:
14 | *
15 | * TickMeter tm;
16 | * tm.start();
17 | * // do something ...
18 | * tm.stop();
19 | * std::cout << tm.getTimeSec();
20 | *
21 | *
22 | * It is also possible to compute the average time over multiple runs:
23 | *
24 | * TickMeter tm;
25 | * for (int i = 0; i < 100; i++)
26 | * {
27 | * tm.start();
28 | * // do something ...
29 | * tm.stop();
30 | * }
31 | * double average_time = tm.getTimeSec() / tm.getCounter();
32 | * std::cout << "Average time in second per iteration is: " << average_time << std::endl;
33 | *
34 | * SEE: getTickCount, getTickFrequency
35 | */
36 | public class TickMeter {
37 |
38 | protected final long nativeObj;
39 | protected TickMeter(long addr) { nativeObj = addr; }
40 |
41 | public long getNativeObjAddr() { return nativeObj; }
42 |
43 | // internal usage only
44 | public static TickMeter __fromPtr__(long addr) { return new TickMeter(addr); }
45 |
46 | //
47 | // C++: cv::TickMeter::TickMeter()
48 | //
49 |
50 | public TickMeter() {
51 | nativeObj = TickMeter_0();
52 | }
53 |
54 |
55 | //
56 | // C++: double cv::TickMeter::getTimeMicro()
57 | //
58 |
59 | /**
60 | * returns passed time in microseconds.
61 | * @return automatically generated
62 | */
63 | public double getTimeMicro() {
64 | return getTimeMicro_0(nativeObj);
65 | }
66 |
67 |
68 | //
69 | // C++: double cv::TickMeter::getTimeMilli()
70 | //
71 |
72 | /**
73 | * returns passed time in milliseconds.
74 | * @return automatically generated
75 | */
76 | public double getTimeMilli() {
77 | return getTimeMilli_0(nativeObj);
78 | }
79 |
80 |
81 | //
82 | // C++: double cv::TickMeter::getTimeSec()
83 | //
84 |
85 | /**
86 | * returns passed time in seconds.
87 | * @return automatically generated
88 | */
89 | public double getTimeSec() {
90 | return getTimeSec_0(nativeObj);
91 | }
92 |
93 |
94 | //
95 | // C++: int64 cv::TickMeter::getCounter()
96 | //
97 |
98 | /**
99 | * returns internal counter value.
100 | * @return automatically generated
101 | */
102 | public long getCounter() {
103 | return getCounter_0(nativeObj);
104 | }
105 |
106 |
107 | //
108 | // C++: int64 cv::TickMeter::getTimeTicks()
109 | //
110 |
111 | /**
112 | * returns counted ticks.
113 | * @return automatically generated
114 | */
115 | public long getTimeTicks() {
116 | return getTimeTicks_0(nativeObj);
117 | }
118 |
119 |
120 | //
121 | // C++: void cv::TickMeter::reset()
122 | //
123 |
124 | /**
125 | * resets internal values.
126 | */
127 | public void reset() {
128 | reset_0(nativeObj);
129 | }
130 |
131 |
132 | //
133 | // C++: void cv::TickMeter::start()
134 | //
135 |
136 | /**
137 | * starts counting ticks.
138 | */
139 | public void start() {
140 | start_0(nativeObj);
141 | }
142 |
143 |
144 | //
145 | // C++: void cv::TickMeter::stop()
146 | //
147 |
148 | /**
149 | * stops counting ticks.
150 | */
151 | public void stop() {
152 | stop_0(nativeObj);
153 | }
154 |
155 |
156 | @Override
157 | protected void finalize() throws Throwable {
158 | delete(nativeObj);
159 | }
160 |
161 |
162 |
163 | // C++: cv::TickMeter::TickMeter()
164 | private static native long TickMeter_0();
165 |
166 | // C++: double cv::TickMeter::getTimeMicro()
167 | private static native double getTimeMicro_0(long nativeObj);
168 |
169 | // C++: double cv::TickMeter::getTimeMilli()
170 | private static native double getTimeMilli_0(long nativeObj);
171 |
172 | // C++: double cv::TickMeter::getTimeSec()
173 | private static native double getTimeSec_0(long nativeObj);
174 |
175 | // C++: int64 cv::TickMeter::getCounter()
176 | private static native long getCounter_0(long nativeObj);
177 |
178 | // C++: int64 cv::TickMeter::getTimeTicks()
179 | private static native long getTimeTicks_0(long nativeObj);
180 |
181 | // C++: void cv::TickMeter::reset()
182 | private static native void reset_0(long nativeObj);
183 |
184 | // C++: void cv::TickMeter::start()
185 | private static native void start_0(long nativeObj);
186 |
187 | // C++: void cv::TickMeter::stop()
188 | private static native void stop_0(long nativeObj);
189 |
190 | // native support for java finalize()
191 | private static native void delete(long nativeObj);
192 |
193 | }
194 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/dnn/ClassificationModel.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.dnn;
5 |
6 | import org.opencv.core.Mat;
7 |
8 | // C++: class ClassificationModel
9 | /**
10 | * This class represents high-level API for classification models.
11 | *
12 | * ClassificationModel allows to set params for preprocessing input image.
13 | * ClassificationModel creates net from file with trained weights and config,
14 | * sets preprocessing input, runs forward pass and return top-1 prediction.
15 | */
16 | public class ClassificationModel extends Model {
17 |
18 | protected ClassificationModel(long addr) { super(addr); }
19 |
20 | // internal usage only
21 | public static ClassificationModel __fromPtr__(long addr) { return new ClassificationModel(addr); }
22 |
23 | //
24 | // C++: cv::dnn::ClassificationModel::ClassificationModel(Net network)
25 | //
26 |
27 | /**
28 | * Create model from deep learning network.
29 | * @param network Net object.
30 | */
31 | public ClassificationModel(Net network) {
32 | super(ClassificationModel_0(network.nativeObj));
33 | }
34 |
35 |
36 | //
37 | // C++: cv::dnn::ClassificationModel::ClassificationModel(String model, String config = "")
38 | //
39 |
40 | /**
41 | * Create classification model from network represented in one of the supported formats.
42 | * An order of {@code model} and {@code config} arguments does not matter.
43 | * @param model Binary file contains trained weights.
44 | * @param config Text file contains network configuration.
45 | */
46 | public ClassificationModel(String model, String config) {
47 | super(ClassificationModel_1(model, config));
48 | }
49 |
50 | /**
51 | * Create classification model from network represented in one of the supported formats.
52 | * An order of {@code model} and {@code config} arguments does not matter.
53 | * @param model Binary file contains trained weights.
54 | */
55 | public ClassificationModel(String model) {
56 | super(ClassificationModel_2(model));
57 | }
58 |
59 |
60 | //
61 | // C++: void cv::dnn::ClassificationModel::classify(Mat frame, int& classId, float& conf)
62 | //
63 |
64 | public void classify(Mat frame, int[] classId, float[] conf) {
65 | double[] classId_out = new double[1];
66 | double[] conf_out = new double[1];
67 | classify_0(nativeObj, frame.nativeObj, classId_out, conf_out);
68 | if(classId!=null) classId[0] = (int)classId_out[0];
69 | if(conf!=null) conf[0] = (float)conf_out[0];
70 | }
71 |
72 |
73 | @Override
74 | protected void finalize() throws Throwable {
75 | delete(nativeObj);
76 | }
77 |
78 |
79 |
80 | // C++: cv::dnn::ClassificationModel::ClassificationModel(Net network)
81 | private static native long ClassificationModel_0(long network_nativeObj);
82 |
83 | // C++: cv::dnn::ClassificationModel::ClassificationModel(String model, String config = "")
84 | private static native long ClassificationModel_1(String model, String config);
85 | private static native long ClassificationModel_2(String model);
86 |
87 | // C++: void cv::dnn::ClassificationModel::classify(Mat frame, int& classId, float& conf)
88 | private static native void classify_0(long nativeObj, long frame_nativeObj, double[] classId_out, double[] conf_out);
89 |
90 | // native support for java finalize()
91 | private static native void delete(long nativeObj);
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/dnn/DictValue.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.dnn;
5 |
6 |
7 |
8 | // C++: class DictValue
9 | /**
10 | * This struct stores the scalar value (or array) of one of the following type: double, cv::String or int64.
11 | * TODO: Maybe int64 is useless because double type exactly stores at least 2^52 integers.
12 | */
13 | public class DictValue {
14 |
15 | protected final long nativeObj;
16 | protected DictValue(long addr) { nativeObj = addr; }
17 |
18 | public long getNativeObjAddr() { return nativeObj; }
19 |
20 | // internal usage only
21 | public static DictValue __fromPtr__(long addr) { return new DictValue(addr); }
22 |
23 | //
24 | // C++: cv::dnn::DictValue::DictValue(String s)
25 | //
26 |
27 | public DictValue(String s) {
28 | nativeObj = DictValue_0(s);
29 | }
30 |
31 |
32 | //
33 | // C++: cv::dnn::DictValue::DictValue(double p)
34 | //
35 |
36 | public DictValue(double p) {
37 | nativeObj = DictValue_1(p);
38 | }
39 |
40 |
41 | //
42 | // C++: cv::dnn::DictValue::DictValue(int i)
43 | //
44 |
45 | public DictValue(int i) {
46 | nativeObj = DictValue_2(i);
47 | }
48 |
49 |
50 | //
51 | // C++: String cv::dnn::DictValue::getStringValue(int idx = -1)
52 | //
53 |
54 | public String getStringValue(int idx) {
55 | return getStringValue_0(nativeObj, idx);
56 | }
57 |
58 | public String getStringValue() {
59 | return getStringValue_1(nativeObj);
60 | }
61 |
62 |
63 | //
64 | // C++: bool cv::dnn::DictValue::isInt()
65 | //
66 |
67 | public boolean isInt() {
68 | return isInt_0(nativeObj);
69 | }
70 |
71 |
72 | //
73 | // C++: bool cv::dnn::DictValue::isReal()
74 | //
75 |
76 | public boolean isReal() {
77 | return isReal_0(nativeObj);
78 | }
79 |
80 |
81 | //
82 | // C++: bool cv::dnn::DictValue::isString()
83 | //
84 |
85 | public boolean isString() {
86 | return isString_0(nativeObj);
87 | }
88 |
89 |
90 | //
91 | // C++: double cv::dnn::DictValue::getRealValue(int idx = -1)
92 | //
93 |
94 | public double getRealValue(int idx) {
95 | return getRealValue_0(nativeObj, idx);
96 | }
97 |
98 | public double getRealValue() {
99 | return getRealValue_1(nativeObj);
100 | }
101 |
102 |
103 | //
104 | // C++: int cv::dnn::DictValue::getIntValue(int idx = -1)
105 | //
106 |
107 | public int getIntValue(int idx) {
108 | return getIntValue_0(nativeObj, idx);
109 | }
110 |
111 | public int getIntValue() {
112 | return getIntValue_1(nativeObj);
113 | }
114 |
115 |
116 | @Override
117 | protected void finalize() throws Throwable {
118 | delete(nativeObj);
119 | }
120 |
121 |
122 |
123 | // C++: cv::dnn::DictValue::DictValue(String s)
124 | private static native long DictValue_0(String s);
125 |
126 | // C++: cv::dnn::DictValue::DictValue(double p)
127 | private static native long DictValue_1(double p);
128 |
129 | // C++: cv::dnn::DictValue::DictValue(int i)
130 | private static native long DictValue_2(int i);
131 |
132 | // C++: String cv::dnn::DictValue::getStringValue(int idx = -1)
133 | private static native String getStringValue_0(long nativeObj, int idx);
134 | private static native String getStringValue_1(long nativeObj);
135 |
136 | // C++: bool cv::dnn::DictValue::isInt()
137 | private static native boolean isInt_0(long nativeObj);
138 |
139 | // C++: bool cv::dnn::DictValue::isReal()
140 | private static native boolean isReal_0(long nativeObj);
141 |
142 | // C++: bool cv::dnn::DictValue::isString()
143 | private static native boolean isString_0(long nativeObj);
144 |
145 | // C++: double cv::dnn::DictValue::getRealValue(int idx = -1)
146 | private static native double getRealValue_0(long nativeObj, int idx);
147 | private static native double getRealValue_1(long nativeObj);
148 |
149 | // C++: int cv::dnn::DictValue::getIntValue(int idx = -1)
150 | private static native int getIntValue_0(long nativeObj, int idx);
151 | private static native int getIntValue_1(long nativeObj);
152 |
153 | // native support for java finalize()
154 | private static native void delete(long nativeObj);
155 |
156 | }
157 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/dnn/SegmentationModel.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.dnn;
5 |
6 | import org.opencv.core.Mat;
7 |
8 | // C++: class SegmentationModel
9 | /**
10 | * This class represents high-level API for segmentation models
11 | *
12 | * SegmentationModel allows to set params for preprocessing input image.
13 | * SegmentationModel creates net from file with trained weights and config,
14 | * sets preprocessing input, runs forward pass and returns the class prediction for each pixel.
15 | */
16 | public class SegmentationModel extends Model {
17 |
18 | protected SegmentationModel(long addr) { super(addr); }
19 |
20 | // internal usage only
21 | public static SegmentationModel __fromPtr__(long addr) { return new SegmentationModel(addr); }
22 |
23 | //
24 | // C++: cv::dnn::SegmentationModel::SegmentationModel(Net network)
25 | //
26 |
27 | /**
28 | * Create model from deep learning network.
29 | * @param network Net object.
30 | */
31 | public SegmentationModel(Net network) {
32 | super(SegmentationModel_0(network.nativeObj));
33 | }
34 |
35 |
36 | //
37 | // C++: cv::dnn::SegmentationModel::SegmentationModel(String model, String config = "")
38 | //
39 |
40 | /**
41 | * Create segmentation model from network represented in one of the supported formats.
42 | * An order of {@code model} and {@code config} arguments does not matter.
43 | * @param model Binary file contains trained weights.
44 | * @param config Text file contains network configuration.
45 | */
46 | public SegmentationModel(String model, String config) {
47 | super(SegmentationModel_1(model, config));
48 | }
49 |
50 | /**
51 | * Create segmentation model from network represented in one of the supported formats.
52 | * An order of {@code model} and {@code config} arguments does not matter.
53 | * @param model Binary file contains trained weights.
54 | */
55 | public SegmentationModel(String model) {
56 | super(SegmentationModel_2(model));
57 | }
58 |
59 |
60 | //
61 | // C++: void cv::dnn::SegmentationModel::segment(Mat frame, Mat& mask)
62 | //
63 |
64 | /**
65 | * Given the {@code input} frame, create input blob, run net
66 | * @param mask Allocated class prediction for each pixel
67 | * @param frame automatically generated
68 | */
69 | public void segment(Mat frame, Mat mask) {
70 | segment_0(nativeObj, frame.nativeObj, mask.nativeObj);
71 | }
72 |
73 |
74 | @Override
75 | protected void finalize() throws Throwable {
76 | delete(nativeObj);
77 | }
78 |
79 |
80 |
81 | // C++: cv::dnn::SegmentationModel::SegmentationModel(Net network)
82 | private static native long SegmentationModel_0(long network_nativeObj);
83 |
84 | // C++: cv::dnn::SegmentationModel::SegmentationModel(String model, String config = "")
85 | private static native long SegmentationModel_1(String model, String config);
86 | private static native long SegmentationModel_2(String model);
87 |
88 | // C++: void cv::dnn::SegmentationModel::segment(Mat frame, Mat& mask)
89 | private static native void segment_0(long nativeObj, long frame_nativeObj, long mask_nativeObj);
90 |
91 | // native support for java finalize()
92 | private static native void delete(long nativeObj);
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/features2d/BOWImgDescriptorExtractor.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.features2d;
5 |
6 | import org.opencv.core.Mat;
7 | import org.opencv.core.MatOfKeyPoint;
8 |
9 | // C++: class BOWImgDescriptorExtractor
10 | /**
11 | * Class to compute an image descriptor using the *bag of visual words*.
12 | *
13 | * Such a computation consists of the following steps:
14 | *
15 | * 1. Compute descriptors for a given image and its keypoints set.
16 | * 2. Find the nearest visual words from the vocabulary for each keypoint descriptor.
17 | * 3. Compute the bag-of-words image descriptor as is a normalized histogram of vocabulary words
18 | * encountered in the image. The i-th bin of the histogram is a frequency of i-th word of the
19 | * vocabulary in the given image.
20 | */
21 | public class BOWImgDescriptorExtractor {
22 |
23 | protected final long nativeObj;
24 | protected BOWImgDescriptorExtractor(long addr) { nativeObj = addr; }
25 |
26 | public long getNativeObjAddr() { return nativeObj; }
27 |
28 | // internal usage only
29 | public static BOWImgDescriptorExtractor __fromPtr__(long addr) { return new BOWImgDescriptorExtractor(addr); }
30 |
31 | //
32 | // C++: cv::BOWImgDescriptorExtractor::BOWImgDescriptorExtractor(Ptr_DescriptorExtractor dextractor, Ptr_DescriptorMatcher dmatcher)
33 | //
34 |
35 | // Unknown type 'Ptr_DescriptorExtractor' (I), skipping the function
36 |
37 |
38 | //
39 | // C++: Mat cv::BOWImgDescriptorExtractor::getVocabulary()
40 | //
41 |
42 | /**
43 | * Returns the set vocabulary.
44 | * @return automatically generated
45 | */
46 | public Mat getVocabulary() {
47 | return new Mat(getVocabulary_0(nativeObj));
48 | }
49 |
50 |
51 | //
52 | // C++: int cv::BOWImgDescriptorExtractor::descriptorSize()
53 | //
54 |
55 | /**
56 | * Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0.
57 | * @return automatically generated
58 | */
59 | public int descriptorSize() {
60 | return descriptorSize_0(nativeObj);
61 | }
62 |
63 |
64 | //
65 | // C++: int cv::BOWImgDescriptorExtractor::descriptorType()
66 | //
67 |
68 | /**
69 | * Returns an image descriptor type.
70 | * @return automatically generated
71 | */
72 | public int descriptorType() {
73 | return descriptorType_0(nativeObj);
74 | }
75 |
76 |
77 | //
78 | // C++: void cv::BOWImgDescriptorExtractor::compute2(Mat image, vector_KeyPoint keypoints, Mat& imgDescriptor)
79 | //
80 |
81 | /**
82 | *
83 | * @param imgDescriptor Computed output image descriptor.
84 | * pointIdxsOfClusters[i] are keypoint indices that belong to the i -th cluster (word of vocabulary)
85 | * returned if it is non-zero.
86 | * @param image automatically generated
87 | * @param keypoints automatically generated
88 | */
89 | public void compute(Mat image, MatOfKeyPoint keypoints, Mat imgDescriptor) {
90 | Mat keypoints_mat = keypoints;
91 | compute_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, imgDescriptor.nativeObj);
92 | }
93 |
94 |
95 | //
96 | // C++: void cv::BOWImgDescriptorExtractor::setVocabulary(Mat vocabulary)
97 | //
98 |
99 | /**
100 | * Sets a visual vocabulary.
101 | *
102 | * @param vocabulary Vocabulary (can be trained using the inheritor of BOWTrainer ). Each row of the
103 | * vocabulary is a visual word (cluster center).
104 | */
105 | public void setVocabulary(Mat vocabulary) {
106 | setVocabulary_0(nativeObj, vocabulary.nativeObj);
107 | }
108 |
109 |
110 | @Override
111 | protected void finalize() throws Throwable {
112 | delete(nativeObj);
113 | }
114 |
115 |
116 |
117 | // C++: Mat cv::BOWImgDescriptorExtractor::getVocabulary()
118 | private static native long getVocabulary_0(long nativeObj);
119 |
120 | // C++: int cv::BOWImgDescriptorExtractor::descriptorSize()
121 | private static native int descriptorSize_0(long nativeObj);
122 |
123 | // C++: int cv::BOWImgDescriptorExtractor::descriptorType()
124 | private static native int descriptorType_0(long nativeObj);
125 |
126 | // C++: void cv::BOWImgDescriptorExtractor::compute2(Mat image, vector_KeyPoint keypoints, Mat& imgDescriptor)
127 | private static native void compute_0(long nativeObj, long image_nativeObj, long keypoints_mat_nativeObj, long imgDescriptor_nativeObj);
128 |
129 | // C++: void cv::BOWImgDescriptorExtractor::setVocabulary(Mat vocabulary)
130 | private static native void setVocabulary_0(long nativeObj, long vocabulary_nativeObj);
131 |
132 | // native support for java finalize()
133 | private static native void delete(long nativeObj);
134 |
135 | }
136 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/features2d/BOWKMeansTrainer.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.features2d;
5 |
6 | import org.opencv.core.Mat;
7 | import org.opencv.core.TermCriteria;
8 |
9 | // C++: class BOWKMeansTrainer
10 | /**
11 | * kmeans -based class to train visual vocabulary using the *bag of visual words* approach. :
12 | */
13 | public class BOWKMeansTrainer extends BOWTrainer {
14 |
15 | protected BOWKMeansTrainer(long addr) { super(addr); }
16 |
17 | // internal usage only
18 | public static BOWKMeansTrainer __fromPtr__(long addr) { return new BOWKMeansTrainer(addr); }
19 |
20 | //
21 | // C++: cv::BOWKMeansTrainer::BOWKMeansTrainer(int clusterCount, TermCriteria termcrit = TermCriteria(), int attempts = 3, int flags = KMEANS_PP_CENTERS)
22 | //
23 |
24 | /**
25 | * The constructor.
26 | *
27 | * SEE: cv::kmeans
28 | * @param clusterCount automatically generated
29 | * @param termcrit automatically generated
30 | * @param attempts automatically generated
31 | * @param flags automatically generated
32 | */
33 | public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit, int attempts, int flags) {
34 | super(BOWKMeansTrainer_0(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon, attempts, flags));
35 | }
36 |
37 | /**
38 | * The constructor.
39 | *
40 | * SEE: cv::kmeans
41 | * @param clusterCount automatically generated
42 | * @param termcrit automatically generated
43 | * @param attempts automatically generated
44 | */
45 | public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit, int attempts) {
46 | super(BOWKMeansTrainer_1(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon, attempts));
47 | }
48 |
49 | /**
50 | * The constructor.
51 | *
52 | * SEE: cv::kmeans
53 | * @param clusterCount automatically generated
54 | * @param termcrit automatically generated
55 | */
56 | public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit) {
57 | super(BOWKMeansTrainer_2(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon));
58 | }
59 |
60 | /**
61 | * The constructor.
62 | *
63 | * SEE: cv::kmeans
64 | * @param clusterCount automatically generated
65 | */
66 | public BOWKMeansTrainer(int clusterCount) {
67 | super(BOWKMeansTrainer_3(clusterCount));
68 | }
69 |
70 |
71 | //
72 | // C++: Mat cv::BOWKMeansTrainer::cluster(Mat descriptors)
73 | //
74 |
75 | public Mat cluster(Mat descriptors) {
76 | return new Mat(cluster_0(nativeObj, descriptors.nativeObj));
77 | }
78 |
79 |
80 | //
81 | // C++: Mat cv::BOWKMeansTrainer::cluster()
82 | //
83 |
84 | public Mat cluster() {
85 | return new Mat(cluster_1(nativeObj));
86 | }
87 |
88 |
89 | @Override
90 | protected void finalize() throws Throwable {
91 | delete(nativeObj);
92 | }
93 |
94 |
95 |
96 | // C++: cv::BOWKMeansTrainer::BOWKMeansTrainer(int clusterCount, TermCriteria termcrit = TermCriteria(), int attempts = 3, int flags = KMEANS_PP_CENTERS)
97 | private static native long BOWKMeansTrainer_0(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon, int attempts, int flags);
98 | private static native long BOWKMeansTrainer_1(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon, int attempts);
99 | private static native long BOWKMeansTrainer_2(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon);
100 | private static native long BOWKMeansTrainer_3(int clusterCount);
101 |
102 | // C++: Mat cv::BOWKMeansTrainer::cluster(Mat descriptors)
103 | private static native long cluster_0(long nativeObj, long descriptors_nativeObj);
104 |
105 | // C++: Mat cv::BOWKMeansTrainer::cluster()
106 | private static native long cluster_1(long nativeObj);
107 |
108 | // native support for java finalize()
109 | private static native void delete(long nativeObj);
110 |
111 | }
112 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/features2d/BOWTrainer.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.features2d;
5 |
6 | import org.opencv.core.Mat;
7 | import org.opencv.utils.Converters;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | // C++: class BOWTrainer
13 | /**
14 | * Abstract base class for training the *bag of visual words* vocabulary from a set of descriptors.
15 | *
16 | * For details, see, for example, *Visual Categorization with Bags of Keypoints* by Gabriella Csurka,
17 | * Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. :
18 | */
19 | public class BOWTrainer {
20 |
21 | protected final long nativeObj;
22 | protected BOWTrainer(long addr) { nativeObj = addr; }
23 |
24 | public long getNativeObjAddr() { return nativeObj; }
25 |
26 | // internal usage only
27 | public static BOWTrainer __fromPtr__(long addr) { return new BOWTrainer(addr); }
28 |
29 | //
30 | // C++: Mat cv::BOWTrainer::cluster(Mat descriptors)
31 | //
32 |
33 | /**
34 | * Clusters train descriptors.
35 | *
36 | * @param descriptors Descriptors to cluster. Each row of the descriptors matrix is a descriptor.
37 | * Descriptors are not added to the inner train descriptor set.
38 | *
39 | * The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first
40 | * variant of the method, train descriptors stored in the object are clustered. In the second variant,
41 | * input descriptors are clustered.
42 | * @return automatically generated
43 | */
44 | public Mat cluster(Mat descriptors) {
45 | return new Mat(cluster_0(nativeObj, descriptors.nativeObj));
46 | }
47 |
48 |
49 | //
50 | // C++: Mat cv::BOWTrainer::cluster()
51 | //
52 |
53 | public Mat cluster() {
54 | return new Mat(cluster_1(nativeObj));
55 | }
56 |
57 |
58 | //
59 | // C++: int cv::BOWTrainer::descriptorsCount()
60 | //
61 |
62 | /**
63 | * Returns the count of all descriptors stored in the training set.
64 | * @return automatically generated
65 | */
66 | public int descriptorsCount() {
67 | return descriptorsCount_0(nativeObj);
68 | }
69 |
70 |
71 | //
72 | // C++: vector_Mat cv::BOWTrainer::getDescriptors()
73 | //
74 |
75 | /**
76 | * Returns a training set of descriptors.
77 | * @return automatically generated
78 | */
79 | public List getDescriptors() {
80 | List retVal = new ArrayList();
81 | Mat retValMat = new Mat(getDescriptors_0(nativeObj));
82 | Converters.Mat_to_vector_Mat(retValMat, retVal);
83 | return retVal;
84 | }
85 |
86 |
87 | //
88 | // C++: void cv::BOWTrainer::add(Mat descriptors)
89 | //
90 |
91 | /**
92 | * Adds descriptors to a training set.
93 | *
94 | * @param descriptors Descriptors to add to a training set. Each row of the descriptors matrix is a
95 | * descriptor.
96 | *
97 | * The training set is clustered using clustermethod to construct the vocabulary.
98 | */
99 | public void add(Mat descriptors) {
100 | add_0(nativeObj, descriptors.nativeObj);
101 | }
102 |
103 |
104 | //
105 | // C++: void cv::BOWTrainer::clear()
106 | //
107 |
108 | public void clear() {
109 | clear_0(nativeObj);
110 | }
111 |
112 |
113 | @Override
114 | protected void finalize() throws Throwable {
115 | delete(nativeObj);
116 | }
117 |
118 |
119 |
120 | // C++: Mat cv::BOWTrainer::cluster(Mat descriptors)
121 | private static native long cluster_0(long nativeObj, long descriptors_nativeObj);
122 |
123 | // C++: Mat cv::BOWTrainer::cluster()
124 | private static native long cluster_1(long nativeObj);
125 |
126 | // C++: int cv::BOWTrainer::descriptorsCount()
127 | private static native int descriptorsCount_0(long nativeObj);
128 |
129 | // C++: vector_Mat cv::BOWTrainer::getDescriptors()
130 | private static native long getDescriptors_0(long nativeObj);
131 |
132 | // C++: void cv::BOWTrainer::add(Mat descriptors)
133 | private static native void add_0(long nativeObj, long descriptors_nativeObj);
134 |
135 | // C++: void cv::BOWTrainer::clear()
136 | private static native void clear_0(long nativeObj);
137 |
138 | // native support for java finalize()
139 | private static native void delete(long nativeObj);
140 |
141 | }
142 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/features2d/FlannBasedMatcher.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.features2d;
5 |
6 | // C++: class FlannBasedMatcher
7 | /**
8 | * Flann-based descriptor matcher.
9 | *
10 | * This matcher trains cv::flann::Index on a train descriptor collection and calls its nearest search
11 | * methods to find the best matches. So, this matcher may be faster when matching a large train
12 | * collection than the brute force matcher. FlannBasedMatcher does not support masking permissible
13 | * matches of descriptor sets because flann::Index does not support this. :
14 | */
15 | public class FlannBasedMatcher extends DescriptorMatcher {
16 |
17 | protected FlannBasedMatcher(long addr) { super(addr); }
18 |
19 | // internal usage only
20 | public static FlannBasedMatcher __fromPtr__(long addr) { return new FlannBasedMatcher(addr); }
21 |
22 | //
23 | // C++: cv::FlannBasedMatcher::FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr(), Ptr_flann_SearchParams searchParams = makePtr())
24 | //
25 |
26 | public FlannBasedMatcher() {
27 | super(FlannBasedMatcher_0());
28 | }
29 |
30 |
31 | //
32 | // C++: static Ptr_FlannBasedMatcher cv::FlannBasedMatcher::create()
33 | //
34 |
35 | public static FlannBasedMatcher create() {
36 | return FlannBasedMatcher.__fromPtr__(create_0());
37 | }
38 |
39 |
40 | @Override
41 | protected void finalize() throws Throwable {
42 | delete(nativeObj);
43 | }
44 |
45 |
46 |
47 | // C++: cv::FlannBasedMatcher::FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr(), Ptr_flann_SearchParams searchParams = makePtr())
48 | private static native long FlannBasedMatcher_0();
49 |
50 | // C++: static Ptr_FlannBasedMatcher cv::FlannBasedMatcher::create()
51 | private static native long create_0();
52 |
53 | // native support for java finalize()
54 | private static native void delete(long nativeObj);
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/features2d/SimpleBlobDetector.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.features2d;
5 |
6 | // C++: class SimpleBlobDetector
7 | /**
8 | * Class for extracting blobs from an image. :
9 | *
10 | * The class implements a simple algorithm for extracting blobs from an image:
11 | *
12 | * 1. Convert the source image to binary images by applying thresholding with several thresholds from
13 | * minThreshold (inclusive) to maxThreshold (exclusive) with distance thresholdStep between
14 | * neighboring thresholds.
15 | * 2. Extract connected components from every binary image by findContours and calculate their
16 | * centers.
17 | * 3. Group centers from several binary images by their coordinates. Close centers form one group that
18 | * corresponds to one blob, which is controlled by the minDistBetweenBlobs parameter.
19 | * 4. From the groups, estimate final centers of blobs and their radiuses and return as locations and
20 | * sizes of keypoints.
21 | *
22 | * This class performs several filtrations of returned blobs. You should set filterBy\* to true/false
23 | * to turn on/off corresponding filtration. Available filtrations:
24 | *
25 | *
26 | * -
27 | * By color. This filter compares the intensity of a binary image at the center of a blob to
28 | * blobColor. If they differ, the blob is filtered out. Use blobColor = 0 to extract dark blobs
29 | * and blobColor = 255 to extract light blobs.
30 | *
31 | * -
32 | * By area. Extracted blobs have an area between minArea (inclusive) and maxArea (exclusive).
33 | *
34 | * -
35 | * By circularity. Extracted blobs have circularity
36 | * (\(\frac{4*\pi*Area}{perimeter * perimeter}\)) between minCircularity (inclusive) and
37 | * maxCircularity (exclusive).
38 | *
39 | * -
40 | * By ratio of the minimum inertia to maximum inertia. Extracted blobs have this ratio
41 | * between minInertiaRatio (inclusive) and maxInertiaRatio (exclusive).
42 | *
43 | * -
44 | * By convexity. Extracted blobs have convexity (area / area of blob convex hull) between
45 | * minConvexity (inclusive) and maxConvexity (exclusive).
46 | *
47 | *
48 | *
49 | * Default values of parameters are tuned to extract dark circular blobs.
50 | */
51 | public class SimpleBlobDetector extends Feature2D {
52 |
53 | protected SimpleBlobDetector(long addr) { super(addr); }
54 |
55 | // internal usage only
56 | public static SimpleBlobDetector __fromPtr__(long addr) { return new SimpleBlobDetector(addr); }
57 |
58 | //
59 | // C++: static Ptr_SimpleBlobDetector cv::SimpleBlobDetector::create(SimpleBlobDetector_Params parameters = SimpleBlobDetector::Params())
60 | //
61 |
62 | public static SimpleBlobDetector create() {
63 | return SimpleBlobDetector.__fromPtr__(create_0());
64 | }
65 |
66 |
67 | //
68 | // C++: String cv::SimpleBlobDetector::getDefaultName()
69 | //
70 |
71 | public String getDefaultName() {
72 | return getDefaultName_0(nativeObj);
73 | }
74 |
75 |
76 | @Override
77 | protected void finalize() throws Throwable {
78 | delete(nativeObj);
79 | }
80 |
81 |
82 |
83 | // C++: static Ptr_SimpleBlobDetector cv::SimpleBlobDetector::create(SimpleBlobDetector_Params parameters = SimpleBlobDetector::Params())
84 | private static native long create_0();
85 |
86 | // C++: String cv::SimpleBlobDetector::getDefaultName()
87 | private static native String getDefaultName_0(long nativeObj);
88 |
89 | // native support for java finalize()
90 | private static native void delete(long nativeObj);
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/imgproc/CLAHE.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.imgproc;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 | import org.opencv.core.Size;
9 |
10 | // C++: class CLAHE
11 | /**
12 | * Base class for Contrast Limited Adaptive Histogram Equalization.
13 | */
14 | public class CLAHE extends Algorithm {
15 |
16 | protected CLAHE(long addr) { super(addr); }
17 |
18 | // internal usage only
19 | public static CLAHE __fromPtr__(long addr) { return new CLAHE(addr); }
20 |
21 | //
22 | // C++: Size cv::CLAHE::getTilesGridSize()
23 | //
24 |
25 | public Size getTilesGridSize() {
26 | return new Size(getTilesGridSize_0(nativeObj));
27 | }
28 |
29 |
30 | //
31 | // C++: double cv::CLAHE::getClipLimit()
32 | //
33 |
34 | public double getClipLimit() {
35 | return getClipLimit_0(nativeObj);
36 | }
37 |
38 |
39 | //
40 | // C++: void cv::CLAHE::apply(Mat src, Mat& dst)
41 | //
42 |
43 | /**
44 | * Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization.
45 | *
46 | * @param src Source image of type CV_8UC1 or CV_16UC1.
47 | * @param dst Destination image.
48 | */
49 | public void apply(Mat src, Mat dst) {
50 | apply_0(nativeObj, src.nativeObj, dst.nativeObj);
51 | }
52 |
53 |
54 | //
55 | // C++: void cv::CLAHE::collectGarbage()
56 | //
57 |
58 | public void collectGarbage() {
59 | collectGarbage_0(nativeObj);
60 | }
61 |
62 |
63 | //
64 | // C++: void cv::CLAHE::setClipLimit(double clipLimit)
65 | //
66 |
67 | /**
68 | * Sets threshold for contrast limiting.
69 | *
70 | * @param clipLimit threshold value.
71 | */
72 | public void setClipLimit(double clipLimit) {
73 | setClipLimit_0(nativeObj, clipLimit);
74 | }
75 |
76 |
77 | //
78 | // C++: void cv::CLAHE::setTilesGridSize(Size tileGridSize)
79 | //
80 |
81 | /**
82 | * Sets size of grid for histogram equalization. Input image will be divided into
83 | * equally sized rectangular tiles.
84 | *
85 | * @param tileGridSize defines the number of tiles in row and column.
86 | */
87 | public void setTilesGridSize(Size tileGridSize) {
88 | setTilesGridSize_0(nativeObj, tileGridSize.width, tileGridSize.height);
89 | }
90 |
91 |
92 | @Override
93 | protected void finalize() throws Throwable {
94 | delete(nativeObj);
95 | }
96 |
97 |
98 |
99 | // C++: Size cv::CLAHE::getTilesGridSize()
100 | private static native double[] getTilesGridSize_0(long nativeObj);
101 |
102 | // C++: double cv::CLAHE::getClipLimit()
103 | private static native double getClipLimit_0(long nativeObj);
104 |
105 | // C++: void cv::CLAHE::apply(Mat src, Mat& dst)
106 | private static native void apply_0(long nativeObj, long src_nativeObj, long dst_nativeObj);
107 |
108 | // C++: void cv::CLAHE::collectGarbage()
109 | private static native void collectGarbage_0(long nativeObj);
110 |
111 | // C++: void cv::CLAHE::setClipLimit(double clipLimit)
112 | private static native void setClipLimit_0(long nativeObj, double clipLimit);
113 |
114 | // C++: void cv::CLAHE::setTilesGridSize(Size tileGridSize)
115 | private static native void setTilesGridSize_0(long nativeObj, double tileGridSize_width, double tileGridSize_height);
116 |
117 | // native support for java finalize()
118 | private static native void delete(long nativeObj);
119 |
120 | }
121 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/imgproc/GeneralizedHoughBallard.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.imgproc;
5 |
6 | // C++: class GeneralizedHoughBallard
7 | /**
8 | * finds arbitrary template in the grayscale image using Generalized Hough Transform
9 | *
10 | * Detects position only without translation and rotation CITE: Ballard1981 .
11 | */
12 | public class GeneralizedHoughBallard extends GeneralizedHough {
13 |
14 | protected GeneralizedHoughBallard(long addr) { super(addr); }
15 |
16 | // internal usage only
17 | public static GeneralizedHoughBallard __fromPtr__(long addr) { return new GeneralizedHoughBallard(addr); }
18 |
19 | //
20 | // C++: int cv::GeneralizedHoughBallard::getLevels()
21 | //
22 |
23 | public int getLevels() {
24 | return getLevels_0(nativeObj);
25 | }
26 |
27 |
28 | //
29 | // C++: int cv::GeneralizedHoughBallard::getVotesThreshold()
30 | //
31 |
32 | public int getVotesThreshold() {
33 | return getVotesThreshold_0(nativeObj);
34 | }
35 |
36 |
37 | //
38 | // C++: void cv::GeneralizedHoughBallard::setLevels(int levels)
39 | //
40 |
41 | public void setLevels(int levels) {
42 | setLevels_0(nativeObj, levels);
43 | }
44 |
45 |
46 | //
47 | // C++: void cv::GeneralizedHoughBallard::setVotesThreshold(int votesThreshold)
48 | //
49 |
50 | public void setVotesThreshold(int votesThreshold) {
51 | setVotesThreshold_0(nativeObj, votesThreshold);
52 | }
53 |
54 |
55 | @Override
56 | protected void finalize() throws Throwable {
57 | delete(nativeObj);
58 | }
59 |
60 |
61 |
62 | // C++: int cv::GeneralizedHoughBallard::getLevels()
63 | private static native int getLevels_0(long nativeObj);
64 |
65 | // C++: int cv::GeneralizedHoughBallard::getVotesThreshold()
66 | private static native int getVotesThreshold_0(long nativeObj);
67 |
68 | // C++: void cv::GeneralizedHoughBallard::setLevels(int levels)
69 | private static native void setLevels_0(long nativeObj, int levels);
70 |
71 | // C++: void cv::GeneralizedHoughBallard::setVotesThreshold(int votesThreshold)
72 | private static native void setVotesThreshold_0(long nativeObj, int votesThreshold);
73 |
74 | // native support for java finalize()
75 | private static native void delete(long nativeObj);
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/ml/Ml.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.ml;
5 |
6 |
7 |
8 | // C++: class Ml
9 |
10 | public class Ml {
11 |
12 | // C++: enum SampleTypes
13 | public static final int
14 | ROW_SAMPLE = 0,
15 | COL_SAMPLE = 1;
16 |
17 |
18 | // C++: enum VariableTypes
19 | public static final int
20 | VAR_NUMERICAL = 0,
21 | VAR_ORDERED = 0,
22 | VAR_CATEGORICAL = 1;
23 |
24 |
25 | // C++: enum ErrorTypes
26 | public static final int
27 | TEST_ERROR = 0,
28 | TRAIN_ERROR = 1;
29 |
30 |
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/ml/ParamGrid.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.ml;
5 |
6 | // C++: class ParamGrid
7 | /**
8 | * The structure represents the logarithmic grid range of statmodel parameters.
9 | *
10 | * It is used for optimizing statmodel accuracy by varying model parameters, the accuracy estimate
11 | * being computed by cross-validation.
12 | */
13 | public class ParamGrid {
14 |
15 | protected final long nativeObj;
16 | protected ParamGrid(long addr) { nativeObj = addr; }
17 |
18 | public long getNativeObjAddr() { return nativeObj; }
19 |
20 | // internal usage only
21 | public static ParamGrid __fromPtr__(long addr) { return new ParamGrid(addr); }
22 |
23 | //
24 | // C++: static Ptr_ParamGrid cv::ml::ParamGrid::create(double minVal = 0., double maxVal = 0., double logstep = 1.)
25 | //
26 |
27 | /**
28 | * Creates a ParamGrid Ptr that can be given to the %SVM::trainAuto method
29 | *
30 | * @param minVal minimum value of the parameter grid
31 | * @param maxVal maximum value of the parameter grid
32 | * @param logstep Logarithmic step for iterating the statmodel parameter
33 | * @return automatically generated
34 | */
35 | public static ParamGrid create(double minVal, double maxVal, double logstep) {
36 | return ParamGrid.__fromPtr__(create_0(minVal, maxVal, logstep));
37 | }
38 |
39 | /**
40 | * Creates a ParamGrid Ptr that can be given to the %SVM::trainAuto method
41 | *
42 | * @param minVal minimum value of the parameter grid
43 | * @param maxVal maximum value of the parameter grid
44 | * @return automatically generated
45 | */
46 | public static ParamGrid create(double minVal, double maxVal) {
47 | return ParamGrid.__fromPtr__(create_1(minVal, maxVal));
48 | }
49 |
50 | /**
51 | * Creates a ParamGrid Ptr that can be given to the %SVM::trainAuto method
52 | *
53 | * @param minVal minimum value of the parameter grid
54 | * @return automatically generated
55 | */
56 | public static ParamGrid create(double minVal) {
57 | return ParamGrid.__fromPtr__(create_2(minVal));
58 | }
59 |
60 | /**
61 | * Creates a ParamGrid Ptr that can be given to the %SVM::trainAuto method
62 | *
63 | * @return automatically generated
64 | */
65 | public static ParamGrid create() {
66 | return ParamGrid.__fromPtr__(create_3());
67 | }
68 |
69 |
70 | //
71 | // C++: double ParamGrid::minVal
72 | //
73 |
74 | public double get_minVal() {
75 | return get_minVal_0(nativeObj);
76 | }
77 |
78 |
79 | //
80 | // C++: void ParamGrid::minVal
81 | //
82 |
83 | public void set_minVal(double minVal) {
84 | set_minVal_0(nativeObj, minVal);
85 | }
86 |
87 |
88 | //
89 | // C++: double ParamGrid::maxVal
90 | //
91 |
92 | public double get_maxVal() {
93 | return get_maxVal_0(nativeObj);
94 | }
95 |
96 |
97 | //
98 | // C++: void ParamGrid::maxVal
99 | //
100 |
101 | public void set_maxVal(double maxVal) {
102 | set_maxVal_0(nativeObj, maxVal);
103 | }
104 |
105 |
106 | //
107 | // C++: double ParamGrid::logStep
108 | //
109 |
110 | public double get_logStep() {
111 | return get_logStep_0(nativeObj);
112 | }
113 |
114 |
115 | //
116 | // C++: void ParamGrid::logStep
117 | //
118 |
119 | public void set_logStep(double logStep) {
120 | set_logStep_0(nativeObj, logStep);
121 | }
122 |
123 |
124 | @Override
125 | protected void finalize() throws Throwable {
126 | delete(nativeObj);
127 | }
128 |
129 |
130 |
131 | // C++: static Ptr_ParamGrid cv::ml::ParamGrid::create(double minVal = 0., double maxVal = 0., double logstep = 1.)
132 | private static native long create_0(double minVal, double maxVal, double logstep);
133 | private static native long create_1(double minVal, double maxVal);
134 | private static native long create_2(double minVal);
135 | private static native long create_3();
136 |
137 | // C++: double ParamGrid::minVal
138 | private static native double get_minVal_0(long nativeObj);
139 |
140 | // C++: void ParamGrid::minVal
141 | private static native void set_minVal_0(long nativeObj, double minVal);
142 |
143 | // C++: double ParamGrid::maxVal
144 | private static native double get_maxVal_0(long nativeObj);
145 |
146 | // C++: void ParamGrid::maxVal
147 | private static native void set_maxVal_0(long nativeObj, double maxVal);
148 |
149 | // C++: double ParamGrid::logStep
150 | private static native double get_logStep_0(long nativeObj);
151 |
152 | // C++: void ParamGrid::logStep
153 | private static native void set_logStep_0(long nativeObj, double logStep);
154 |
155 | // native support for java finalize()
156 | private static native void delete(long nativeObj);
157 |
158 | }
159 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/objdetect/BaseCascadeClassifier.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.objdetect;
5 |
6 | import org.opencv.core.Algorithm;
7 |
8 | // C++: class BaseCascadeClassifier
9 |
10 | public class BaseCascadeClassifier extends Algorithm {
11 |
12 | protected BaseCascadeClassifier(long addr) { super(addr); }
13 |
14 | // internal usage only
15 | public static BaseCascadeClassifier __fromPtr__(long addr) { return new BaseCascadeClassifier(addr); }
16 |
17 | @Override
18 | protected void finalize() throws Throwable {
19 | delete(nativeObj);
20 | }
21 |
22 |
23 |
24 | // native support for java finalize()
25 | private static native void delete(long nativeObj);
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/objdetect/Objdetect.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.objdetect;
5 |
6 | import org.opencv.core.Mat;
7 | import org.opencv.core.MatOfInt;
8 | import org.opencv.core.MatOfRect;
9 |
10 | // C++: class Objdetect
11 |
12 | public class Objdetect {
13 |
14 | // C++: enum
15 | public static final int
16 | CASCADE_DO_CANNY_PRUNING = 1,
17 | CASCADE_SCALE_IMAGE = 2,
18 | CASCADE_FIND_BIGGEST_OBJECT = 4,
19 | CASCADE_DO_ROUGH_SEARCH = 8;
20 |
21 |
22 | // C++: enum ObjectStatus
23 | public static final int
24 | DetectionBasedTracker_DETECTED_NOT_SHOWN_YET = 0,
25 | DetectionBasedTracker_DETECTED = 1,
26 | DetectionBasedTracker_DETECTED_TEMPORARY_LOST = 2,
27 | DetectionBasedTracker_WRONG_OBJECT = 3;
28 |
29 |
30 | //
31 | // C++: void cv::groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2)
32 | //
33 |
34 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps) {
35 | Mat rectList_mat = rectList;
36 | Mat weights_mat = weights;
37 | groupRectangles_0(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold, eps);
38 | }
39 |
40 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold) {
41 | Mat rectList_mat = rectList;
42 | Mat weights_mat = weights;
43 | groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold);
44 | }
45 |
46 |
47 |
48 |
49 | // C++: void cv::groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2)
50 | private static native void groupRectangles_0(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold, double eps);
51 | private static native void groupRectangles_1(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold);
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/osgi/OpenCVInterface.java:
--------------------------------------------------------------------------------
1 | package org.opencv.osgi;
2 |
3 | /**
4 | * Dummy interface to allow some integration testing within OSGi implementation.
5 | */
6 | public interface OpenCVInterface
7 | {
8 | }
9 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/osgi/OpenCVNativeLoader.java:
--------------------------------------------------------------------------------
1 | package org.opencv.osgi;
2 |
3 | import java.util.logging.Level;
4 | import java.util.logging.Logger;
5 |
6 | /**
7 | * This class is intended to provide a convenient way to load OpenCV's native
8 | * library from the Java bundle. If Blueprint is enabled in the OSGi container
9 | * this class will be instantiated automatically and the init() method called
10 | * loading the native library.
11 | */
12 | public class OpenCVNativeLoader implements OpenCVInterface {
13 |
14 | public void init() {
15 | System.loadLibrary("opencv_java4");
16 | Logger.getLogger("org.opencv.osgi").log(Level.INFO, "Successfully loaded OpenCV native library.");
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/AlignExposures.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 | import org.opencv.utils.Converters;
9 |
10 | import java.util.List;
11 |
12 | // C++: class AlignExposures
13 | /**
14 | * The base class for algorithms that align images of the same scene with different exposures
15 | */
16 | public class AlignExposures extends Algorithm {
17 |
18 | protected AlignExposures(long addr) { super(addr); }
19 |
20 | // internal usage only
21 | public static AlignExposures __fromPtr__(long addr) { return new AlignExposures(addr); }
22 |
23 | //
24 | // C++: void cv::AlignExposures::process(vector_Mat src, vector_Mat dst, Mat times, Mat response)
25 | //
26 |
27 | /**
28 | * Aligns images
29 | *
30 | * @param src vector of input images
31 | * @param dst vector of aligned images
32 | * @param times vector of exposure time values for each image
33 | * @param response 256x1 matrix with inverse camera response function for each pixel value, it should
34 | * have the same number of channels as images.
35 | */
36 | public void process(List src, List dst, Mat times, Mat response) {
37 | Mat src_mat = Converters.vector_Mat_to_Mat(src);
38 | Mat dst_mat = Converters.vector_Mat_to_Mat(dst);
39 | process_0(nativeObj, src_mat.nativeObj, dst_mat.nativeObj, times.nativeObj, response.nativeObj);
40 | }
41 |
42 |
43 | @Override
44 | protected void finalize() throws Throwable {
45 | delete(nativeObj);
46 | }
47 |
48 |
49 |
50 | // C++: void cv::AlignExposures::process(vector_Mat src, vector_Mat dst, Mat times, Mat response)
51 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_mat_nativeObj, long times_nativeObj, long response_nativeObj);
52 |
53 | // native support for java finalize()
54 | private static native void delete(long nativeObj);
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/CalibrateCRF.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 | import org.opencv.utils.Converters;
9 |
10 | import java.util.List;
11 |
12 | // C++: class CalibrateCRF
13 | /**
14 | * The base class for camera response calibration algorithms.
15 | */
16 | public class CalibrateCRF extends Algorithm {
17 |
18 | protected CalibrateCRF(long addr) { super(addr); }
19 |
20 | // internal usage only
21 | public static CalibrateCRF __fromPtr__(long addr) { return new CalibrateCRF(addr); }
22 |
23 | //
24 | // C++: void cv::CalibrateCRF::process(vector_Mat src, Mat& dst, Mat times)
25 | //
26 |
27 | /**
28 | * Recovers inverse camera response.
29 | *
30 | * @param src vector of input images
31 | * @param dst 256x1 matrix with inverse camera response function
32 | * @param times vector of exposure time values for each image
33 | */
34 | public void process(List src, Mat dst, Mat times) {
35 | Mat src_mat = Converters.vector_Mat_to_Mat(src);
36 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj);
37 | }
38 |
39 |
40 | @Override
41 | protected void finalize() throws Throwable {
42 | delete(nativeObj);
43 | }
44 |
45 |
46 |
47 | // C++: void cv::CalibrateCRF::process(vector_Mat src, Mat& dst, Mat times)
48 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj);
49 |
50 | // native support for java finalize()
51 | private static native void delete(long nativeObj);
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/CalibrateDebevec.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | // C++: class CalibrateDebevec
7 | /**
8 | * Inverse camera response function is extracted for each brightness value by minimizing an objective
9 | * function as linear system. Objective function is constructed using pixel values on the same position
10 | * in all images, extra term is added to make the result smoother.
11 | *
12 | * For more information see CITE: DM97 .
13 | */
14 | public class CalibrateDebevec extends CalibrateCRF {
15 |
16 | protected CalibrateDebevec(long addr) { super(addr); }
17 |
18 | // internal usage only
19 | public static CalibrateDebevec __fromPtr__(long addr) { return new CalibrateDebevec(addr); }
20 |
21 | //
22 | // C++: bool cv::CalibrateDebevec::getRandom()
23 | //
24 |
25 | public boolean getRandom() {
26 | return getRandom_0(nativeObj);
27 | }
28 |
29 |
30 | //
31 | // C++: float cv::CalibrateDebevec::getLambda()
32 | //
33 |
34 | public float getLambda() {
35 | return getLambda_0(nativeObj);
36 | }
37 |
38 |
39 | //
40 | // C++: int cv::CalibrateDebevec::getSamples()
41 | //
42 |
43 | public int getSamples() {
44 | return getSamples_0(nativeObj);
45 | }
46 |
47 |
48 | //
49 | // C++: void cv::CalibrateDebevec::setLambda(float lambda)
50 | //
51 |
52 | public void setLambda(float lambda) {
53 | setLambda_0(nativeObj, lambda);
54 | }
55 |
56 |
57 | //
58 | // C++: void cv::CalibrateDebevec::setRandom(bool random)
59 | //
60 |
61 | public void setRandom(boolean random) {
62 | setRandom_0(nativeObj, random);
63 | }
64 |
65 |
66 | //
67 | // C++: void cv::CalibrateDebevec::setSamples(int samples)
68 | //
69 |
70 | public void setSamples(int samples) {
71 | setSamples_0(nativeObj, samples);
72 | }
73 |
74 |
75 | @Override
76 | protected void finalize() throws Throwable {
77 | delete(nativeObj);
78 | }
79 |
80 |
81 |
82 | // C++: bool cv::CalibrateDebevec::getRandom()
83 | private static native boolean getRandom_0(long nativeObj);
84 |
85 | // C++: float cv::CalibrateDebevec::getLambda()
86 | private static native float getLambda_0(long nativeObj);
87 |
88 | // C++: int cv::CalibrateDebevec::getSamples()
89 | private static native int getSamples_0(long nativeObj);
90 |
91 | // C++: void cv::CalibrateDebevec::setLambda(float lambda)
92 | private static native void setLambda_0(long nativeObj, float lambda);
93 |
94 | // C++: void cv::CalibrateDebevec::setRandom(bool random)
95 | private static native void setRandom_0(long nativeObj, boolean random);
96 |
97 | // C++: void cv::CalibrateDebevec::setSamples(int samples)
98 | private static native void setSamples_0(long nativeObj, int samples);
99 |
100 | // native support for java finalize()
101 | private static native void delete(long nativeObj);
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/CalibrateRobertson.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | import org.opencv.core.Mat;
7 |
8 | // C++: class CalibrateRobertson
9 | /**
10 | * Inverse camera response function is extracted for each brightness value by minimizing an objective
11 | * function as linear system. This algorithm uses all image pixels.
12 | *
13 | * For more information see CITE: RB99 .
14 | */
15 | public class CalibrateRobertson extends CalibrateCRF {
16 |
17 | protected CalibrateRobertson(long addr) { super(addr); }
18 |
19 | // internal usage only
20 | public static CalibrateRobertson __fromPtr__(long addr) { return new CalibrateRobertson(addr); }
21 |
22 | //
23 | // C++: Mat cv::CalibrateRobertson::getRadiance()
24 | //
25 |
26 | public Mat getRadiance() {
27 | return new Mat(getRadiance_0(nativeObj));
28 | }
29 |
30 |
31 | //
32 | // C++: float cv::CalibrateRobertson::getThreshold()
33 | //
34 |
35 | public float getThreshold() {
36 | return getThreshold_0(nativeObj);
37 | }
38 |
39 |
40 | //
41 | // C++: int cv::CalibrateRobertson::getMaxIter()
42 | //
43 |
44 | public int getMaxIter() {
45 | return getMaxIter_0(nativeObj);
46 | }
47 |
48 |
49 | //
50 | // C++: void cv::CalibrateRobertson::setMaxIter(int max_iter)
51 | //
52 |
53 | public void setMaxIter(int max_iter) {
54 | setMaxIter_0(nativeObj, max_iter);
55 | }
56 |
57 |
58 | //
59 | // C++: void cv::CalibrateRobertson::setThreshold(float threshold)
60 | //
61 |
62 | public void setThreshold(float threshold) {
63 | setThreshold_0(nativeObj, threshold);
64 | }
65 |
66 |
67 | @Override
68 | protected void finalize() throws Throwable {
69 | delete(nativeObj);
70 | }
71 |
72 |
73 |
74 | // C++: Mat cv::CalibrateRobertson::getRadiance()
75 | private static native long getRadiance_0(long nativeObj);
76 |
77 | // C++: float cv::CalibrateRobertson::getThreshold()
78 | private static native float getThreshold_0(long nativeObj);
79 |
80 | // C++: int cv::CalibrateRobertson::getMaxIter()
81 | private static native int getMaxIter_0(long nativeObj);
82 |
83 | // C++: void cv::CalibrateRobertson::setMaxIter(int max_iter)
84 | private static native void setMaxIter_0(long nativeObj, int max_iter);
85 |
86 | // C++: void cv::CalibrateRobertson::setThreshold(float threshold)
87 | private static native void setThreshold_0(long nativeObj, float threshold);
88 |
89 | // native support for java finalize()
90 | private static native void delete(long nativeObj);
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/MergeDebevec.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | import org.opencv.core.Mat;
7 | import org.opencv.utils.Converters;
8 |
9 | import java.util.List;
10 |
11 | // C++: class MergeDebevec
12 | /**
13 | * The resulting HDR image is calculated as weighted average of the exposures considering exposure
14 | * values and camera response.
15 | *
16 | * For more information see CITE: DM97 .
17 | */
18 | public class MergeDebevec extends MergeExposures {
19 |
20 | protected MergeDebevec(long addr) { super(addr); }
21 |
22 | // internal usage only
23 | public static MergeDebevec __fromPtr__(long addr) { return new MergeDebevec(addr); }
24 |
25 | //
26 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times, Mat response)
27 | //
28 |
29 | public void process(List src, Mat dst, Mat times, Mat response) {
30 | Mat src_mat = Converters.vector_Mat_to_Mat(src);
31 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj);
32 | }
33 |
34 |
35 | //
36 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times)
37 | //
38 |
39 | public void process(List src, Mat dst, Mat times) {
40 | Mat src_mat = Converters.vector_Mat_to_Mat(src);
41 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj);
42 | }
43 |
44 |
45 | @Override
46 | protected void finalize() throws Throwable {
47 | delete(nativeObj);
48 | }
49 |
50 |
51 |
52 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times, Mat response)
53 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj);
54 |
55 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times)
56 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj);
57 |
58 | // native support for java finalize()
59 | private static native void delete(long nativeObj);
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/MergeExposures.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 | import org.opencv.utils.Converters;
9 |
10 | import java.util.List;
11 |
12 | // C++: class MergeExposures
13 | /**
14 | * The base class algorithms that can merge exposure sequence to a single image.
15 | */
16 | public class MergeExposures extends Algorithm {
17 |
18 | protected MergeExposures(long addr) { super(addr); }
19 |
20 | // internal usage only
21 | public static MergeExposures __fromPtr__(long addr) { return new MergeExposures(addr); }
22 |
23 | //
24 | // C++: void cv::MergeExposures::process(vector_Mat src, Mat& dst, Mat times, Mat response)
25 | //
26 |
27 | /**
28 | * Merges images.
29 | *
30 | * @param src vector of input images
31 | * @param dst result image
32 | * @param times vector of exposure time values for each image
33 | * @param response 256x1 matrix with inverse camera response function for each pixel value, it should
34 | * have the same number of channels as images.
35 | */
36 | public void process(List src, Mat dst, Mat times, Mat response) {
37 | Mat src_mat = Converters.vector_Mat_to_Mat(src);
38 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj);
39 | }
40 |
41 |
42 | @Override
43 | protected void finalize() throws Throwable {
44 | delete(nativeObj);
45 | }
46 |
47 |
48 |
49 | // C++: void cv::MergeExposures::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, long times_nativeObj, long response_nativeObj);
51 |
52 | // native support for java finalize()
53 | private static native void delete(long nativeObj);
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/MergeMertens.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | import org.opencv.core.Mat;
7 | import org.opencv.utils.Converters;
8 |
9 | import java.util.List;
10 |
11 | // C++: class MergeMertens
12 | /**
13 | * Pixels are weighted using contrast, saturation and well-exposedness measures, than images are
14 | * combined using laplacian pyramids.
15 | *
16 | * The resulting image weight is constructed as weighted average of contrast, saturation and
17 | * well-exposedness measures.
18 | *
19 | * The resulting image doesn't require tonemapping and can be converted to 8-bit image by multiplying
20 | * by 255, but it's recommended to apply gamma correction and/or linear tonemapping.
21 | *
22 | * For more information see CITE: MK07 .
23 | */
24 | public class MergeMertens extends MergeExposures {
25 |
26 | protected MergeMertens(long addr) { super(addr); }
27 |
28 | // internal usage only
29 | public static MergeMertens __fromPtr__(long addr) { return new MergeMertens(addr); }
30 |
31 | //
32 | // C++: float cv::MergeMertens::getContrastWeight()
33 | //
34 |
35 | public float getContrastWeight() {
36 | return getContrastWeight_0(nativeObj);
37 | }
38 |
39 |
40 | //
41 | // C++: float cv::MergeMertens::getExposureWeight()
42 | //
43 |
44 | public float getExposureWeight() {
45 | return getExposureWeight_0(nativeObj);
46 | }
47 |
48 |
49 | //
50 | // C++: float cv::MergeMertens::getSaturationWeight()
51 | //
52 |
53 | public float getSaturationWeight() {
54 | return getSaturationWeight_0(nativeObj);
55 | }
56 |
57 |
58 | //
59 | // C++: void cv::MergeMertens::process(vector_Mat src, Mat& dst, Mat times, Mat response)
60 | //
61 |
62 | public void process(List src, Mat dst, Mat times, Mat response) {
63 | Mat src_mat = Converters.vector_Mat_to_Mat(src);
64 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj);
65 | }
66 |
67 |
68 | //
69 | // C++: void cv::MergeMertens::process(vector_Mat src, Mat& dst)
70 | //
71 |
72 | /**
73 | * Short version of process, that doesn't take extra arguments.
74 | *
75 | * @param src vector of input images
76 | * @param dst result image
77 | */
78 | public void process(List src, Mat dst) {
79 | Mat src_mat = Converters.vector_Mat_to_Mat(src);
80 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj);
81 | }
82 |
83 |
84 | //
85 | // C++: void cv::MergeMertens::setContrastWeight(float contrast_weiht)
86 | //
87 |
88 | public void setContrastWeight(float contrast_weiht) {
89 | setContrastWeight_0(nativeObj, contrast_weiht);
90 | }
91 |
92 |
93 | //
94 | // C++: void cv::MergeMertens::setExposureWeight(float exposure_weight)
95 | //
96 |
97 | public void setExposureWeight(float exposure_weight) {
98 | setExposureWeight_0(nativeObj, exposure_weight);
99 | }
100 |
101 |
102 | //
103 | // C++: void cv::MergeMertens::setSaturationWeight(float saturation_weight)
104 | //
105 |
106 | public void setSaturationWeight(float saturation_weight) {
107 | setSaturationWeight_0(nativeObj, saturation_weight);
108 | }
109 |
110 |
111 | @Override
112 | protected void finalize() throws Throwable {
113 | delete(nativeObj);
114 | }
115 |
116 |
117 |
118 | // C++: float cv::MergeMertens::getContrastWeight()
119 | private static native float getContrastWeight_0(long nativeObj);
120 |
121 | // C++: float cv::MergeMertens::getExposureWeight()
122 | private static native float getExposureWeight_0(long nativeObj);
123 |
124 | // C++: float cv::MergeMertens::getSaturationWeight()
125 | private static native float getSaturationWeight_0(long nativeObj);
126 |
127 | // C++: void cv::MergeMertens::process(vector_Mat src, Mat& dst, Mat times, Mat response)
128 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj);
129 |
130 | // C++: void cv::MergeMertens::process(vector_Mat src, Mat& dst)
131 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj);
132 |
133 | // C++: void cv::MergeMertens::setContrastWeight(float contrast_weiht)
134 | private static native void setContrastWeight_0(long nativeObj, float contrast_weiht);
135 |
136 | // C++: void cv::MergeMertens::setExposureWeight(float exposure_weight)
137 | private static native void setExposureWeight_0(long nativeObj, float exposure_weight);
138 |
139 | // C++: void cv::MergeMertens::setSaturationWeight(float saturation_weight)
140 | private static native void setSaturationWeight_0(long nativeObj, float saturation_weight);
141 |
142 | // native support for java finalize()
143 | private static native void delete(long nativeObj);
144 |
145 | }
146 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/MergeRobertson.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | import org.opencv.core.Mat;
7 | import org.opencv.utils.Converters;
8 |
9 | import java.util.List;
10 |
11 | // C++: class MergeRobertson
12 | /**
13 | * The resulting HDR image is calculated as weighted average of the exposures considering exposure
14 | * values and camera response.
15 | *
16 | * For more information see CITE: RB99 .
17 | */
18 | public class MergeRobertson extends MergeExposures {
19 |
20 | protected MergeRobertson(long addr) { super(addr); }
21 |
22 | // internal usage only
23 | public static MergeRobertson __fromPtr__(long addr) { return new MergeRobertson(addr); }
24 |
25 | //
26 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times, Mat response)
27 | //
28 |
29 | public void process(List src, Mat dst, Mat times, Mat response) {
30 | Mat src_mat = Converters.vector_Mat_to_Mat(src);
31 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj);
32 | }
33 |
34 |
35 | //
36 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times)
37 | //
38 |
39 | public void process(List src, Mat dst, Mat times) {
40 | Mat src_mat = Converters.vector_Mat_to_Mat(src);
41 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj);
42 | }
43 |
44 |
45 | @Override
46 | protected void finalize() throws Throwable {
47 | delete(nativeObj);
48 | }
49 |
50 |
51 |
52 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times, Mat response)
53 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj);
54 |
55 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times)
56 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj);
57 |
58 | // native support for java finalize()
59 | private static native void delete(long nativeObj);
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/Tonemap.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 |
9 | // C++: class Tonemap
10 | /**
11 | * Base class for tonemapping algorithms - tools that are used to map HDR image to 8-bit range.
12 | */
13 | public class Tonemap extends Algorithm {
14 |
15 | protected Tonemap(long addr) { super(addr); }
16 |
17 | // internal usage only
18 | public static Tonemap __fromPtr__(long addr) { return new Tonemap(addr); }
19 |
20 | //
21 | // C++: float cv::Tonemap::getGamma()
22 | //
23 |
24 | public float getGamma() {
25 | return getGamma_0(nativeObj);
26 | }
27 |
28 |
29 | //
30 | // C++: void cv::Tonemap::process(Mat src, Mat& dst)
31 | //
32 |
33 | /**
34 | * Tonemaps image
35 | *
36 | * @param src source image - CV_32FC3 Mat (float 32 bits 3 channels)
37 | * @param dst destination image - CV_32FC3 Mat with values in [0, 1] range
38 | */
39 | public void process(Mat src, Mat dst) {
40 | process_0(nativeObj, src.nativeObj, dst.nativeObj);
41 | }
42 |
43 |
44 | //
45 | // C++: void cv::Tonemap::setGamma(float gamma)
46 | //
47 |
48 | public void setGamma(float gamma) {
49 | setGamma_0(nativeObj, gamma);
50 | }
51 |
52 |
53 | @Override
54 | protected void finalize() throws Throwable {
55 | delete(nativeObj);
56 | }
57 |
58 |
59 |
60 | // C++: float cv::Tonemap::getGamma()
61 | private static native float getGamma_0(long nativeObj);
62 |
63 | // C++: void cv::Tonemap::process(Mat src, Mat& dst)
64 | private static native void process_0(long nativeObj, long src_nativeObj, long dst_nativeObj);
65 |
66 | // C++: void cv::Tonemap::setGamma(float gamma)
67 | private static native void setGamma_0(long nativeObj, float gamma);
68 |
69 | // native support for java finalize()
70 | private static native void delete(long nativeObj);
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/TonemapDrago.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | // C++: class TonemapDrago
7 | /**
8 | * Adaptive logarithmic mapping is a fast global tonemapping algorithm that scales the image in
9 | * logarithmic domain.
10 | *
11 | * Since it's a global operator the same function is applied to all the pixels, it is controlled by the
12 | * bias parameter.
13 | *
14 | * Optional saturation enhancement is possible as described in CITE: FL02 .
15 | *
16 | * For more information see CITE: DM03 .
17 | */
18 | public class TonemapDrago extends Tonemap {
19 |
20 | protected TonemapDrago(long addr) { super(addr); }
21 |
22 | // internal usage only
23 | public static TonemapDrago __fromPtr__(long addr) { return new TonemapDrago(addr); }
24 |
25 | //
26 | // C++: float cv::TonemapDrago::getBias()
27 | //
28 |
29 | public float getBias() {
30 | return getBias_0(nativeObj);
31 | }
32 |
33 |
34 | //
35 | // C++: float cv::TonemapDrago::getSaturation()
36 | //
37 |
38 | public float getSaturation() {
39 | return getSaturation_0(nativeObj);
40 | }
41 |
42 |
43 | //
44 | // C++: void cv::TonemapDrago::setBias(float bias)
45 | //
46 |
47 | public void setBias(float bias) {
48 | setBias_0(nativeObj, bias);
49 | }
50 |
51 |
52 | //
53 | // C++: void cv::TonemapDrago::setSaturation(float saturation)
54 | //
55 |
56 | public void setSaturation(float saturation) {
57 | setSaturation_0(nativeObj, saturation);
58 | }
59 |
60 |
61 | @Override
62 | protected void finalize() throws Throwable {
63 | delete(nativeObj);
64 | }
65 |
66 |
67 |
68 | // C++: float cv::TonemapDrago::getBias()
69 | private static native float getBias_0(long nativeObj);
70 |
71 | // C++: float cv::TonemapDrago::getSaturation()
72 | private static native float getSaturation_0(long nativeObj);
73 |
74 | // C++: void cv::TonemapDrago::setBias(float bias)
75 | private static native void setBias_0(long nativeObj, float bias);
76 |
77 | // C++: void cv::TonemapDrago::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 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/TonemapMantiuk.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | // C++: class TonemapMantiuk
7 | /**
8 | * This algorithm transforms image to contrast using gradients on all levels of gaussian pyramid,
9 | * transforms contrast values to HVS response and scales the response. After this the image is
10 | * reconstructed from new contrast values.
11 | *
12 | * For more information see CITE: MM06 .
13 | */
14 | public class TonemapMantiuk extends Tonemap {
15 |
16 | protected TonemapMantiuk(long addr) { super(addr); }
17 |
18 | // internal usage only
19 | public static TonemapMantiuk __fromPtr__(long addr) { return new TonemapMantiuk(addr); }
20 |
21 | //
22 | // C++: float cv::TonemapMantiuk::getSaturation()
23 | //
24 |
25 | public float getSaturation() {
26 | return getSaturation_0(nativeObj);
27 | }
28 |
29 |
30 | //
31 | // C++: float cv::TonemapMantiuk::getScale()
32 | //
33 |
34 | public float getScale() {
35 | return getScale_0(nativeObj);
36 | }
37 |
38 |
39 | //
40 | // C++: void cv::TonemapMantiuk::setSaturation(float saturation)
41 | //
42 |
43 | public void setSaturation(float saturation) {
44 | setSaturation_0(nativeObj, saturation);
45 | }
46 |
47 |
48 | //
49 | // C++: void cv::TonemapMantiuk::setScale(float scale)
50 | //
51 |
52 | public void setScale(float scale) {
53 | setScale_0(nativeObj, scale);
54 | }
55 |
56 |
57 | @Override
58 | protected void finalize() throws Throwable {
59 | delete(nativeObj);
60 | }
61 |
62 |
63 |
64 | // C++: float cv::TonemapMantiuk::getSaturation()
65 | private static native float getSaturation_0(long nativeObj);
66 |
67 | // C++: float cv::TonemapMantiuk::getScale()
68 | private static native float getScale_0(long nativeObj);
69 |
70 | // C++: void cv::TonemapMantiuk::setSaturation(float saturation)
71 | private static native void setSaturation_0(long nativeObj, float saturation);
72 |
73 | // C++: void cv::TonemapMantiuk::setScale(float scale)
74 | private static native void setScale_0(long nativeObj, float scale);
75 |
76 | // native support for java finalize()
77 | private static native void delete(long nativeObj);
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/photo/TonemapReinhard.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.photo;
5 |
6 | // C++: class TonemapReinhard
7 | /**
8 | * This is a global tonemapping operator that models human visual system.
9 | *
10 | * Mapping function is controlled by adaptation parameter, that is computed using light adaptation and
11 | * color adaptation.
12 | *
13 | * For more information see CITE: RD05 .
14 | */
15 | public class TonemapReinhard extends Tonemap {
16 |
17 | protected TonemapReinhard(long addr) { super(addr); }
18 |
19 | // internal usage only
20 | public static TonemapReinhard __fromPtr__(long addr) { return new TonemapReinhard(addr); }
21 |
22 | //
23 | // C++: float cv::TonemapReinhard::getColorAdaptation()
24 | //
25 |
26 | public float getColorAdaptation() {
27 | return getColorAdaptation_0(nativeObj);
28 | }
29 |
30 |
31 | //
32 | // C++: float cv::TonemapReinhard::getIntensity()
33 | //
34 |
35 | public float getIntensity() {
36 | return getIntensity_0(nativeObj);
37 | }
38 |
39 |
40 | //
41 | // C++: float cv::TonemapReinhard::getLightAdaptation()
42 | //
43 |
44 | public float getLightAdaptation() {
45 | return getLightAdaptation_0(nativeObj);
46 | }
47 |
48 |
49 | //
50 | // C++: void cv::TonemapReinhard::setColorAdaptation(float color_adapt)
51 | //
52 |
53 | public void setColorAdaptation(float color_adapt) {
54 | setColorAdaptation_0(nativeObj, color_adapt);
55 | }
56 |
57 |
58 | //
59 | // C++: void cv::TonemapReinhard::setIntensity(float intensity)
60 | //
61 |
62 | public void setIntensity(float intensity) {
63 | setIntensity_0(nativeObj, intensity);
64 | }
65 |
66 |
67 | //
68 | // C++: void cv::TonemapReinhard::setLightAdaptation(float light_adapt)
69 | //
70 |
71 | public void setLightAdaptation(float light_adapt) {
72 | setLightAdaptation_0(nativeObj, light_adapt);
73 | }
74 |
75 |
76 | @Override
77 | protected void finalize() throws Throwable {
78 | delete(nativeObj);
79 | }
80 |
81 |
82 |
83 | // C++: float cv::TonemapReinhard::getColorAdaptation()
84 | private static native float getColorAdaptation_0(long nativeObj);
85 |
86 | // C++: float cv::TonemapReinhard::getIntensity()
87 | private static native float getIntensity_0(long nativeObj);
88 |
89 | // C++: float cv::TonemapReinhard::getLightAdaptation()
90 | private static native float getLightAdaptation_0(long nativeObj);
91 |
92 | // C++: void cv::TonemapReinhard::setColorAdaptation(float color_adapt)
93 | private static native void setColorAdaptation_0(long nativeObj, float color_adapt);
94 |
95 | // C++: void cv::TonemapReinhard::setIntensity(float intensity)
96 | private static native void setIntensity_0(long nativeObj, float intensity);
97 |
98 | // C++: void cv::TonemapReinhard::setLightAdaptation(float light_adapt)
99 | private static native void setLightAdaptation_0(long nativeObj, float light_adapt);
100 |
101 | // native support for java finalize()
102 | private static native void delete(long nativeObj);
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/video/BackgroundSubtractor.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 |
9 | // C++: class BackgroundSubtractor
10 | /**
11 | * Base class for background/foreground segmentation. :
12 | *
13 | * The class is only used to define the common interface for the whole family of background/foreground
14 | * segmentation algorithms.
15 | */
16 | public class BackgroundSubtractor extends Algorithm {
17 |
18 | protected BackgroundSubtractor(long addr) { super(addr); }
19 |
20 | // internal usage only
21 | public static BackgroundSubtractor __fromPtr__(long addr) { return new BackgroundSubtractor(addr); }
22 |
23 | //
24 | // C++: void cv::BackgroundSubtractor::apply(Mat image, Mat& fgmask, double learningRate = -1)
25 | //
26 |
27 | /**
28 | * Computes a foreground mask.
29 | *
30 | * @param image Next video frame.
31 | * @param fgmask The output foreground mask as an 8-bit binary image.
32 | * @param learningRate The value between 0 and 1 that indicates how fast the background model is
33 | * learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
34 | * rate. 0 means that the background model is not updated at all, 1 means that the background model
35 | * is completely reinitialized from the last frame.
36 | */
37 | public void apply(Mat image, Mat fgmask, double learningRate) {
38 | apply_0(nativeObj, image.nativeObj, fgmask.nativeObj, learningRate);
39 | }
40 |
41 | /**
42 | * Computes a foreground mask.
43 | *
44 | * @param image Next video frame.
45 | * @param fgmask The output foreground mask as an 8-bit binary image.
46 | * learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
47 | * rate. 0 means that the background model is not updated at all, 1 means that the background model
48 | * is completely reinitialized from the last frame.
49 | */
50 | public void apply(Mat image, Mat fgmask) {
51 | apply_1(nativeObj, image.nativeObj, fgmask.nativeObj);
52 | }
53 |
54 |
55 | //
56 | // C++: void cv::BackgroundSubtractor::getBackgroundImage(Mat& backgroundImage)
57 | //
58 |
59 | /**
60 | * Computes a background image.
61 | *
62 | * @param backgroundImage The output background image.
63 | *
64 | * Note: Sometimes the background image can be very blurry, as it contain the average background
65 | * statistics.
66 | */
67 | public void getBackgroundImage(Mat backgroundImage) {
68 | getBackgroundImage_0(nativeObj, backgroundImage.nativeObj);
69 | }
70 |
71 |
72 | @Override
73 | protected void finalize() throws Throwable {
74 | delete(nativeObj);
75 | }
76 |
77 |
78 |
79 | // C++: void cv::BackgroundSubtractor::apply(Mat image, Mat& fgmask, double learningRate = -1)
80 | private static native void apply_0(long nativeObj, long image_nativeObj, long fgmask_nativeObj, double learningRate);
81 | private static native void apply_1(long nativeObj, long image_nativeObj, long fgmask_nativeObj);
82 |
83 | // C++: void cv::BackgroundSubtractor::getBackgroundImage(Mat& backgroundImage)
84 | private static native void getBackgroundImage_0(long nativeObj, long backgroundImage_nativeObj);
85 |
86 | // native support for java finalize()
87 | private static native void delete(long nativeObj);
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/video/DenseOpticalFlow.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 |
9 | // C++: class DenseOpticalFlow
10 | /**
11 | * Base class for dense optical flow algorithms
12 | */
13 | public class DenseOpticalFlow extends Algorithm {
14 |
15 | protected DenseOpticalFlow(long addr) { super(addr); }
16 |
17 | // internal usage only
18 | public static DenseOpticalFlow __fromPtr__(long addr) { return new DenseOpticalFlow(addr); }
19 |
20 | //
21 | // C++: void cv::DenseOpticalFlow::calc(Mat I0, Mat I1, Mat& flow)
22 | //
23 |
24 | /**
25 | * Calculates an optical flow.
26 | *
27 | * @param I0 first 8-bit single-channel input image.
28 | * @param I1 second input image of the same size and the same type as prev.
29 | * @param flow computed flow image that has the same size as prev and type CV_32FC2.
30 | */
31 | public void calc(Mat I0, Mat I1, Mat flow) {
32 | calc_0(nativeObj, I0.nativeObj, I1.nativeObj, flow.nativeObj);
33 | }
34 |
35 |
36 | //
37 | // C++: void cv::DenseOpticalFlow::collectGarbage()
38 | //
39 |
40 | /**
41 | * Releases all inner buffers.
42 | */
43 | public void collectGarbage() {
44 | collectGarbage_0(nativeObj);
45 | }
46 |
47 |
48 | @Override
49 | protected void finalize() throws Throwable {
50 | delete(nativeObj);
51 | }
52 |
53 |
54 |
55 | // C++: void cv::DenseOpticalFlow::calc(Mat I0, Mat I1, Mat& flow)
56 | private static native void calc_0(long nativeObj, long I0_nativeObj, long I1_nativeObj, long flow_nativeObj);
57 |
58 | // C++: void cv::DenseOpticalFlow::collectGarbage()
59 | private static native void collectGarbage_0(long nativeObj);
60 |
61 | // native support for java finalize()
62 | private static native void delete(long nativeObj);
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/sdk/src/main/java/org/opencv/video/SparseOpticalFlow.java:
--------------------------------------------------------------------------------
1 | //
2 | // This file is auto-generated. Please don't modify it!
3 | //
4 | package org.opencv.video;
5 |
6 | import org.opencv.core.Algorithm;
7 | import org.opencv.core.Mat;
8 |
9 | // C++: class SparseOpticalFlow
10 | /**
11 | * Base interface for sparse optical flow algorithms.
12 | */
13 | public class SparseOpticalFlow extends Algorithm {
14 |
15 | protected SparseOpticalFlow(long addr) { super(addr); }
16 |
17 | // internal usage only
18 | public static SparseOpticalFlow __fromPtr__(long addr) { return new SparseOpticalFlow(addr); }
19 |
20 | //
21 | // C++: void cv::SparseOpticalFlow::calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat& nextPts, Mat& status, Mat& err = cv::Mat())
22 | //
23 |
24 | /**
25 | * Calculates a sparse optical flow.
26 | *
27 | * @param prevImg First input image.
28 | * @param nextImg Second input image of the same size and the same type as prevImg.
29 | * @param prevPts Vector of 2D points for which the flow needs to be found.
30 | * @param nextPts Output vector of 2D points containing the calculated new positions of input features in the second image.
31 | * @param status Output status vector. Each element of the vector is set to 1 if the
32 | * flow for the corresponding features has been found. Otherwise, it is set to 0.
33 | * @param err Optional output vector that contains error response for each point (inverse confidence).
34 | */
35 | public void calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat nextPts, Mat status, Mat err) {
36 | calc_0(nativeObj, prevImg.nativeObj, nextImg.nativeObj, prevPts.nativeObj, nextPts.nativeObj, status.nativeObj, err.nativeObj);
37 | }
38 |
39 | /**
40 | * Calculates a sparse optical flow.
41 | *
42 | * @param prevImg First input image.
43 | * @param nextImg Second input image of the same size and the same type as prevImg.
44 | * @param prevPts Vector of 2D points for which the flow needs to be found.
45 | * @param nextPts Output vector of 2D points containing the calculated new positions of input features in the second image.
46 | * @param status Output status vector. Each element of the vector is set to 1 if the
47 | * flow for the corresponding features has been found. Otherwise, it is set to 0.
48 | */
49 | public void calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat nextPts, Mat status) {
50 | calc_1(nativeObj, prevImg.nativeObj, nextImg.nativeObj, prevPts.nativeObj, nextPts.nativeObj, status.nativeObj);
51 | }
52 |
53 |
54 | @Override
55 | protected void finalize() throws Throwable {
56 | delete(nativeObj);
57 | }
58 |
59 |
60 |
61 | // C++: void cv::SparseOpticalFlow::calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat& nextPts, Mat& status, Mat& err = cv::Mat())
62 | private static native void calc_0(long nativeObj, long prevImg_nativeObj, long nextImg_nativeObj, long prevPts_nativeObj, long nextPts_nativeObj, long status_nativeObj, long err_nativeObj);
63 | private static native void calc_1(long nativeObj, long prevImg_nativeObj, long nextImg_nativeObj, long prevPts_nativeObj, long nextPts_nativeObj, long status_nativeObj);
64 |
65 | // native support for java finalize()
66 | private static native void delete(long nativeObj);
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/sdk/src/main/jniLibs/armeabi-v7a/libc++_shared.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyloveyd/Android-FaceDetection/12602c94a221cca65d585bd0d57eef5184cfd98f/sdk/src/main/jniLibs/armeabi-v7a/libc++_shared.so
--------------------------------------------------------------------------------
/sdk/src/main/jniLibs/armeabi-v7a/libfacedetection.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyloveyd/Android-FaceDetection/12602c94a221cca65d585bd0d57eef5184cfd98f/sdk/src/main/jniLibs/armeabi-v7a/libfacedetection.so
--------------------------------------------------------------------------------
/sdk/src/main/jniLibs/armeabi-v7a/libopencv_java4.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onlyloveyd/Android-FaceDetection/12602c94a221cca65d585bd0d57eef5184cfd98f/sdk/src/main/jniLibs/armeabi-v7a/libopencv_java4.so
--------------------------------------------------------------------------------
/sdk/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':sdk'
--------------------------------------------------------------------------------