├── app ├── .gitignore ├── .DS_Store ├── src │ ├── .DS_Store │ ├── main │ │ ├── .DS_Store │ │ ├── cpp │ │ │ └── .DS_Store │ │ ├── java │ │ │ ├── .DS_Store │ │ │ └── com │ │ │ │ ├── .DS_Store │ │ │ │ └── martin │ │ │ │ ├── .DS_Store │ │ │ │ └── ads │ │ │ │ └── .DS_Store │ │ ├── jniLibs │ │ │ ├── .DS_Store │ │ │ └── armeabi-v7a │ │ │ │ └── libopencv_java3.so │ │ ├── res │ │ │ ├── drawable │ │ │ │ └── timg.jpg │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── layout │ │ │ │ └── activity_main2.xml │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── martin │ │ │ └── ads │ │ │ └── testopencv │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── martin │ │ └── ads │ │ └── testopencv │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro ├── build.gradle └── CMakeLists.txt ├── OpenCVLibrary340 ├── .gitignore ├── src │ └── main │ │ ├── java │ │ └── org │ │ │ └── opencv │ │ │ ├── osgi │ │ │ ├── OpenCVInterface.java │ │ │ └── OpenCVNativeLoader.java │ │ │ ├── core │ │ │ ├── CvException.java │ │ │ ├── DMatch.java │ │ │ ├── Point.java │ │ │ ├── Size.java │ │ │ ├── Point3.java │ │ │ ├── Range.java │ │ │ ├── MatOfPoint.java │ │ │ ├── MatOfPoint2f.java │ │ │ ├── MatOfByte.java │ │ │ ├── MatOfInt.java │ │ │ ├── MatOfInt4.java │ │ │ ├── MatOfFloat.java │ │ │ ├── MatOfFloat4.java │ │ │ ├── MatOfFloat6.java │ │ │ ├── MatOfDouble.java │ │ │ ├── MatOfPoint3.java │ │ │ ├── MatOfPoint3f.java │ │ │ ├── MatOfRect.java │ │ │ ├── MatOfRect2d.java │ │ │ ├── Algorithm.java │ │ │ ├── Scalar.java │ │ │ ├── KeyPoint.java │ │ │ ├── MatOfDMatch.java │ │ │ ├── MatOfKeyPoint.java │ │ │ ├── TermCriteria.java │ │ │ ├── Rect.java │ │ │ ├── Rect2d.java │ │ │ ├── RotatedRect.java │ │ │ ├── TickMeter.java │ │ │ └── CvType.java │ │ │ ├── ml │ │ │ ├── Ml.java │ │ │ ├── NormalBayesClassifier.java │ │ │ ├── ParamGrid.java │ │ │ ├── ANN_MLP_ANNEAL.java │ │ │ └── Boost.java │ │ │ ├── objdetect │ │ │ ├── BaseCascadeClassifier.java │ │ │ └── Objdetect.java │ │ │ ├── android │ │ │ ├── InstallCallbackInterface.java │ │ │ ├── LoaderCallbackInterface.java │ │ │ ├── FpsMeter.java │ │ │ ├── StaticHelper.java │ │ │ ├── OpenCVLoader.java │ │ │ └── CameraGLSurfaceView.java │ │ │ ├── engine │ │ │ └── OpenCVEngineInterface.aidl │ │ │ ├── photo │ │ │ ├── CalibrateCRF.java │ │ │ ├── MergeExposures.java │ │ │ ├── AlignExposures.java │ │ │ ├── Tonemap.java │ │ │ ├── MergeDebevec.java │ │ │ ├── MergeRobertson.java │ │ │ ├── TonemapDrago.java │ │ │ ├── TonemapMantiuk.java │ │ │ ├── CalibrateRobertson.java │ │ │ ├── CalibrateDebevec.java │ │ │ ├── TonemapReinhard.java │ │ │ ├── TonemapDurand.java │ │ │ └── MergeMertens.java │ │ │ ├── video │ │ │ ├── DenseOpticalFlow.java │ │ │ ├── SparseOpticalFlow.java │ │ │ └── BackgroundSubtractor.java │ │ │ ├── features2d │ │ │ ├── FlannBasedMatcher.java │ │ │ ├── BFMatcher.java │ │ │ ├── BOWKMeansTrainer.java │ │ │ ├── BOWTrainer.java │ │ │ ├── BOWImgDescriptorExtractor.java │ │ │ └── FastFeatureDetector.java │ │ │ └── imgproc │ │ │ ├── CLAHE.java │ │ │ └── LineSegmentDetector.java │ │ ├── res │ │ └── values │ │ │ └── attrs.xml │ │ ├── AndroidManifest.xml │ │ └── aidl │ │ └── org │ │ └── opencv │ │ └── engine │ │ └── OpenCVEngineInterface.aidl ├── lint.xml └── build.gradle ├── settings.gradle ├── .DS_Store ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── caches │ └── build_file_checksums.ser ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── misc.xml └── codeStyles │ └── Project.xml ├── README.md ├── gradle.properties ├── .gitignore └── gradlew.bat /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /OpenCVLibrary340/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':OpenCVLibrary340' -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/.DS_Store -------------------------------------------------------------------------------- /app/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/.DS_Store -------------------------------------------------------------------------------- /app/src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/.DS_Store -------------------------------------------------------------------------------- /app/src/main/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/.DS_Store -------------------------------------------------------------------------------- /app/src/main/cpp/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/cpp/.DS_Store -------------------------------------------------------------------------------- /app/src/main/java/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/java/.DS_Store -------------------------------------------------------------------------------- /app/src/main/java/com/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/java/com/.DS_Store -------------------------------------------------------------------------------- /app/src/main/jniLibs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/jniLibs/.DS_Store -------------------------------------------------------------------------------- /app/src/main/res/drawable/timg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/res/drawable/timg.jpg -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | TestOpencv 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /app/src/main/java/com/martin/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/java/com/martin/.DS_Store -------------------------------------------------------------------------------- /app/src/main/java/com/martin/ads/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/java/com/martin/ads/.DS_Store -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libopencv_java3.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/jniLibs/armeabi-v7a/libopencv_java3.so -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/o0o0oo00/TestOpencv/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TestOpencv 2 | 利用OpenCV的Grabcut算法,在Android上实现抠图,本人能力有限,只是用Java实现的抠图 3 | 项目的构成还有待优化,因为我不会~~~ 4 | 一会儿精简OpenCV库 5 | 借鉴的这位大哥项目,非常感谢~ 6 | https://github.com/Martin20150405/OpenCV4AndroidWithCmake 7 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /OpenCVLibrary340/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 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Feb 28 19:56:57 CST 2018 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-4.4-rc-3-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /OpenCVLibrary340/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /OpenCVLibrary340/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 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /OpenCVLibrary340/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 26 5 | buildToolsVersion '27.0.1' 6 | 7 | defaultConfig { 8 | minSdkVersion 17 9 | targetSdkVersion 26 10 | } 11 | 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/martin/ads/testopencv/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.martin.ads.testopencv; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/ml/Ml.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | 8 | 9 | // C++: class Ml 10 | //javadoc: Ml 11 | 12 | public class Ml { 13 | 14 | public static final int 15 | VAR_NUMERICAL = 0, 16 | VAR_ORDERED = 0, 17 | VAR_CATEGORICAL = 1, 18 | TEST_ERROR = 0, 19 | TRAIN_ERROR = 1, 20 | ROW_SAMPLE = 0, 21 | COL_SAMPLE = 1; 22 | 23 | 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/objdetect/BaseCascadeClassifier.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.objdetect; 6 | 7 | import org.opencv.core.Algorithm; 8 | 9 | // C++: class BaseCascadeClassifier 10 | //javadoc: BaseCascadeClassifier 11 | 12 | public class BaseCascadeClassifier extends Algorithm { 13 | 14 | protected BaseCascadeClassifier(long addr) { super(addr); } 15 | 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 | -------------------------------------------------------------------------------- /OpenCVLibrary340/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_java3"); 16 | Logger.getLogger("org.opencv.osgi").log(Level.INFO, "Successfully loaded OpenCV native library."); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /OpenCVLibrary340/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 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/martin/ads/testopencv/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.martin.ads.testopencv; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.martin.ads.testopencv", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /OpenCVLibrary340/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 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # IntelliJ 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/tasks.xml 39 | .idea/gradle.xml 40 | .idea/dictionaries 41 | .idea/libraries 42 | 43 | # Keystore files 44 | # Uncomment the following line if you do not want to check your keystore files in. 45 | #*.jks 46 | 47 | # External native build folder generated in Android Studio 2.2 and later 48 | .externalNativeBuild 49 | 50 | # Google Services (e.g. APIs or Firebase) 51 | google-services.json 52 | 53 | # Freeline 54 | freeline.py 55 | freeline/ 56 | freeline_project_description.json 57 | 58 | # fastlane 59 | fastlane/report.xml 60 | fastlane/Preview.html 61 | fastlane/screenshots 62 | fastlane/test_output 63 | fastlane/readme.md 64 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/photo/CalibrateCRF.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Algorithm; 10 | import org.opencv.core.Mat; 11 | import org.opencv.utils.Converters; 12 | 13 | // C++: class CalibrateCRF 14 | //javadoc: CalibrateCRF 15 | 16 | public class CalibrateCRF extends Algorithm { 17 | 18 | protected CalibrateCRF(long addr) { super(addr); } 19 | 20 | 21 | // 22 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 23 | // 24 | 25 | //javadoc: CalibrateCRF::process(src, dst, times) 26 | public void process(List src, Mat dst, Mat times) 27 | { 28 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 29 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 30 | 31 | return; 32 | } 33 | 34 | 35 | @Override 36 | protected void finalize() throws Throwable { 37 | delete(nativeObj); 38 | } 39 | 40 | 41 | 42 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 43 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj); 44 | 45 | // native support for java finalize() 46 | private static native void delete(long nativeObj); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /OpenCVLibrary340/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 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/photo/MergeExposures.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Algorithm; 10 | import org.opencv.core.Mat; 11 | import org.opencv.utils.Converters; 12 | 13 | // C++: class MergeExposures 14 | //javadoc: MergeExposures 15 | 16 | public class MergeExposures extends Algorithm { 17 | 18 | protected MergeExposures(long addr) { super(addr); } 19 | 20 | 21 | // 22 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 23 | // 24 | 25 | //javadoc: MergeExposures::process(src, dst, times, response) 26 | public void process(List src, Mat dst, Mat times, Mat response) 27 | { 28 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 29 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 30 | 31 | return; 32 | } 33 | 34 | 35 | @Override 36 | protected void finalize() throws Throwable { 37 | delete(nativeObj); 38 | } 39 | 40 | 41 | 42 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 43 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj); 44 | 45 | // native support for java finalize() 46 | private static native void delete(long nativeObj); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/photo/AlignExposures.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Algorithm; 10 | import org.opencv.core.Mat; 11 | import org.opencv.utils.Converters; 12 | 13 | // C++: class AlignExposures 14 | //javadoc: AlignExposures 15 | 16 | public class AlignExposures extends Algorithm { 17 | 18 | protected AlignExposures(long addr) { super(addr); } 19 | 20 | 21 | // 22 | // C++: void process(vector_Mat src, vector_Mat dst, Mat times, Mat response) 23 | // 24 | 25 | //javadoc: AlignExposures::process(src, dst, times, response) 26 | public void process(List src, List dst, Mat times, Mat response) 27 | { 28 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 29 | Mat dst_mat = Converters.vector_Mat_to_Mat(dst); 30 | process_0(nativeObj, src_mat.nativeObj, dst_mat.nativeObj, times.nativeObj, response.nativeObj); 31 | 32 | return; 33 | } 34 | 35 | 36 | @Override 37 | protected void finalize() throws Throwable { 38 | delete(nativeObj); 39 | } 40 | 41 | 42 | 43 | // C++: void process(vector_Mat src, vector_Mat dst, Mat times, Mat response) 44 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_mat_nativeObj, long times_nativeObj, long response_nativeObj); 45 | 46 | // native support for java finalize() 47 | private static native void delete(long nativeObj); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 26 5 | defaultConfig { 6 | applicationId "com.martin.ads.testopencv" 7 | minSdkVersion 20 8 | targetSdkVersion 27 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | externalNativeBuild { 13 | cmake { 14 | arguments "-DANDROID_ARM_NEON=TRUE", "-DANDROID_TOOLCHAIN=clang", "-DCMAKE_BUILD_TYPE=Release" 15 | //'-DANDROID_STL=gnustl_static' 16 | cppFlags "-std=c++11", "-frtti", "-fexceptions" 17 | } 18 | } 19 | ndk { 20 | abiFilters 'armeabi-v7a' 21 | } 22 | } 23 | buildTypes { 24 | release { 25 | minifyEnabled false 26 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 27 | } 28 | } 29 | externalNativeBuild { 30 | cmake { 31 | path "CMakeLists.txt" 32 | } 33 | } 34 | } 35 | 36 | dependencies { 37 | implementation fileTree(dir: 'libs', include: ['*.jar']) 38 | implementation 'com.android.support:appcompat-v7:26.1.0' 39 | implementation project(':OpenCVLibrary340') 40 | implementation 'com.android.support.constraint:constraint-layout:1.0.2' 41 | testImplementation 'junit:junit:4.12' 42 | androidTestImplementation 'com.android.support.test:runner:1.0.1' 43 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 44 | } 45 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/video/DenseOpticalFlow.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | 10 | // C++: class DenseOpticalFlow 11 | //javadoc: DenseOpticalFlow 12 | 13 | public class DenseOpticalFlow extends Algorithm { 14 | 15 | protected DenseOpticalFlow(long addr) { super(addr); } 16 | 17 | 18 | // 19 | // C++: void calc(Mat I0, Mat I1, Mat& flow) 20 | // 21 | 22 | //javadoc: DenseOpticalFlow::calc(I0, I1, flow) 23 | public void calc(Mat I0, Mat I1, Mat flow) 24 | { 25 | 26 | calc_0(nativeObj, I0.nativeObj, I1.nativeObj, flow.nativeObj); 27 | 28 | return; 29 | } 30 | 31 | 32 | // 33 | // C++: void collectGarbage() 34 | // 35 | 36 | //javadoc: DenseOpticalFlow::collectGarbage() 37 | public void collectGarbage() 38 | { 39 | 40 | collectGarbage_0(nativeObj); 41 | 42 | return; 43 | } 44 | 45 | 46 | @Override 47 | protected void finalize() throws Throwable { 48 | delete(nativeObj); 49 | } 50 | 51 | 52 | 53 | // C++: void calc(Mat I0, Mat I1, Mat& flow) 54 | private static native void calc_0(long nativeObj, long I0_nativeObj, long I1_nativeObj, long flow_nativeObj); 55 | 56 | // C++: void collectGarbage() 57 | private static native void collectGarbage_0(long nativeObj); 58 | 59 | // native support for java finalize() 60 | private static native void delete(long nativeObj); 61 | 62 | } 63 | -------------------------------------------------------------------------------- /OpenCVLibrary340/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 | -------------------------------------------------------------------------------- /OpenCVLibrary340/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 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/features2d/FlannBasedMatcher.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.features2d; 6 | 7 | 8 | 9 | // C++: class FlannBasedMatcher 10 | //javadoc: FlannBasedMatcher 11 | 12 | public class FlannBasedMatcher extends DescriptorMatcher { 13 | 14 | protected FlannBasedMatcher(long addr) { super(addr); } 15 | 16 | 17 | // 18 | // C++: FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr(), Ptr_flann_SearchParams searchParams = makePtr()) 19 | // 20 | 21 | //javadoc: FlannBasedMatcher::FlannBasedMatcher() 22 | public FlannBasedMatcher() 23 | { 24 | 25 | super( FlannBasedMatcher_0() ); 26 | 27 | return; 28 | } 29 | 30 | 31 | // 32 | // C++: static Ptr_FlannBasedMatcher create() 33 | // 34 | 35 | //javadoc: FlannBasedMatcher::create() 36 | public static FlannBasedMatcher create() 37 | { 38 | 39 | FlannBasedMatcher retVal = new FlannBasedMatcher(create_0()); 40 | 41 | return retVal; 42 | } 43 | 44 | 45 | @Override 46 | protected void finalize() throws Throwable { 47 | delete(nativeObj); 48 | } 49 | 50 | 51 | 52 | // C++: FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr(), Ptr_flann_SearchParams searchParams = makePtr()) 53 | private static native long FlannBasedMatcher_0(); 54 | 55 | // C++: static Ptr_FlannBasedMatcher create() 56 | private static native long create_0(); 57 | 58 | // native support for java finalize() 59 | private static native void delete(long nativeObj); 60 | 61 | } 62 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/photo/Tonemap.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | 10 | // C++: class Tonemap 11 | //javadoc: Tonemap 12 | 13 | public class Tonemap extends Algorithm { 14 | 15 | protected Tonemap(long addr) { super(addr); } 16 | 17 | 18 | // 19 | // C++: float getGamma() 20 | // 21 | 22 | //javadoc: Tonemap::getGamma() 23 | public float getGamma() 24 | { 25 | 26 | float retVal = getGamma_0(nativeObj); 27 | 28 | return retVal; 29 | } 30 | 31 | 32 | // 33 | // C++: void process(Mat src, Mat& dst) 34 | // 35 | 36 | //javadoc: Tonemap::process(src, dst) 37 | public void process(Mat src, Mat dst) 38 | { 39 | 40 | process_0(nativeObj, src.nativeObj, dst.nativeObj); 41 | 42 | return; 43 | } 44 | 45 | 46 | // 47 | // C++: void setGamma(float gamma) 48 | // 49 | 50 | //javadoc: Tonemap::setGamma(gamma) 51 | public void setGamma(float gamma) 52 | { 53 | 54 | setGamma_0(nativeObj, gamma); 55 | 56 | return; 57 | } 58 | 59 | 60 | @Override 61 | protected void finalize() throws Throwable { 62 | delete(nativeObj); 63 | } 64 | 65 | 66 | 67 | // C++: float getGamma() 68 | private static native float getGamma_0(long nativeObj); 69 | 70 | // C++: void process(Mat src, Mat& dst) 71 | private static native void process_0(long nativeObj, long src_nativeObj, long dst_nativeObj); 72 | 73 | // C++: void setGamma(float gamma) 74 | private static native void setGamma_0(long nativeObj, float gamma); 75 | 76 | // native support for java finalize() 77 | private static native void delete(long nativeObj); 78 | 79 | } 80 | -------------------------------------------------------------------------------- /OpenCVLibrary340/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 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/objdetect/Objdetect.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.objdetect; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Mat; 10 | import org.opencv.core.MatOfInt; 11 | import org.opencv.core.MatOfRect; 12 | import org.opencv.utils.Converters; 13 | 14 | // C++: class Objdetect 15 | //javadoc: Objdetect 16 | 17 | public class Objdetect { 18 | 19 | public static final int 20 | CASCADE_DO_CANNY_PRUNING = 1, 21 | CASCADE_SCALE_IMAGE = 2, 22 | CASCADE_FIND_BIGGEST_OBJECT = 4, 23 | CASCADE_DO_ROUGH_SEARCH = 8; 24 | 25 | 26 | // 27 | // C++: void groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2) 28 | // 29 | 30 | //javadoc: groupRectangles(rectList, weights, groupThreshold, eps) 31 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps) 32 | { 33 | Mat rectList_mat = rectList; 34 | Mat weights_mat = weights; 35 | groupRectangles_0(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold, eps); 36 | 37 | return; 38 | } 39 | 40 | //javadoc: groupRectangles(rectList, weights, groupThreshold) 41 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold) 42 | { 43 | Mat rectList_mat = rectList; 44 | Mat weights_mat = weights; 45 | groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold); 46 | 47 | return; 48 | } 49 | 50 | 51 | 52 | 53 | // C++: void groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2) 54 | private static native void groupRectangles_0(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold, double eps); 55 | private static native void groupRectangles_1(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold); 56 | 57 | } 58 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/photo/MergeDebevec.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Mat; 10 | import org.opencv.utils.Converters; 11 | 12 | // C++: class MergeDebevec 13 | //javadoc: MergeDebevec 14 | 15 | public class MergeDebevec extends MergeExposures { 16 | 17 | protected MergeDebevec(long addr) { super(addr); } 18 | 19 | 20 | // 21 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 22 | // 23 | 24 | //javadoc: MergeDebevec::process(src, dst, times, response) 25 | public void process(List src, Mat dst, Mat times, Mat response) 26 | { 27 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 28 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 29 | 30 | return; 31 | } 32 | 33 | 34 | // 35 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 36 | // 37 | 38 | //javadoc: MergeDebevec::process(src, dst, times) 39 | public void process(List src, Mat dst, Mat times) 40 | { 41 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 42 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 43 | 44 | return; 45 | } 46 | 47 | 48 | @Override 49 | protected void finalize() throws Throwable { 50 | delete(nativeObj); 51 | } 52 | 53 | 54 | 55 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 56 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj); 57 | 58 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 59 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj); 60 | 61 | // native support for java finalize() 62 | private static native void delete(long nativeObj); 63 | 64 | } 65 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/photo/MergeRobertson.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Mat; 10 | import org.opencv.utils.Converters; 11 | 12 | // C++: class MergeRobertson 13 | //javadoc: MergeRobertson 14 | 15 | public class MergeRobertson extends MergeExposures { 16 | 17 | protected MergeRobertson(long addr) { super(addr); } 18 | 19 | 20 | // 21 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 22 | // 23 | 24 | //javadoc: MergeRobertson::process(src, dst, times, response) 25 | public void process(List src, Mat dst, Mat times, Mat response) 26 | { 27 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 28 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 29 | 30 | return; 31 | } 32 | 33 | 34 | // 35 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 36 | // 37 | 38 | //javadoc: MergeRobertson::process(src, dst, times) 39 | public void process(List src, Mat dst, Mat times) 40 | { 41 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 42 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 43 | 44 | return; 45 | } 46 | 47 | 48 | @Override 49 | protected void finalize() throws Throwable { 50 | delete(nativeObj); 51 | } 52 | 53 | 54 | 55 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 56 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj); 57 | 58 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 59 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj); 60 | 61 | // native support for java finalize() 62 | private static native void delete(long nativeObj); 63 | 64 | } 65 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/video/SparseOpticalFlow.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | 10 | // C++: class SparseOpticalFlow 11 | //javadoc: SparseOpticalFlow 12 | 13 | public class SparseOpticalFlow extends Algorithm { 14 | 15 | protected SparseOpticalFlow(long addr) { super(addr); } 16 | 17 | 18 | // 19 | // C++: void calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat& nextPts, Mat& status, Mat& err = cv::Mat()) 20 | // 21 | 22 | //javadoc: SparseOpticalFlow::calc(prevImg, nextImg, prevPts, nextPts, status, err) 23 | public void calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat nextPts, Mat status, Mat err) 24 | { 25 | 26 | calc_0(nativeObj, prevImg.nativeObj, nextImg.nativeObj, prevPts.nativeObj, nextPts.nativeObj, status.nativeObj, err.nativeObj); 27 | 28 | return; 29 | } 30 | 31 | //javadoc: SparseOpticalFlow::calc(prevImg, nextImg, prevPts, nextPts, status) 32 | public void calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat nextPts, Mat status) 33 | { 34 | 35 | calc_1(nativeObj, prevImg.nativeObj, nextImg.nativeObj, prevPts.nativeObj, nextPts.nativeObj, status.nativeObj); 36 | 37 | return; 38 | } 39 | 40 | 41 | @Override 42 | protected void finalize() throws Throwable { 43 | delete(nativeObj); 44 | } 45 | 46 | 47 | 48 | // C++: void calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat& nextPts, Mat& status, Mat& err = cv::Mat()) 49 | 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); 50 | private static native void calc_1(long nativeObj, long prevImg_nativeObj, long nextImg_nativeObj, long prevPts_nativeObj, long nextPts_nativeObj, long status_nativeObj); 51 | 52 | // native support for java finalize() 53 | private static native void delete(long nativeObj); 54 | 55 | } 56 | -------------------------------------------------------------------------------- /OpenCVLibrary340/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 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/features2d/BFMatcher.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.features2d; 6 | 7 | 8 | 9 | // C++: class BFMatcher 10 | //javadoc: BFMatcher 11 | 12 | public class BFMatcher extends DescriptorMatcher { 13 | 14 | protected BFMatcher(long addr) { super(addr); } 15 | 16 | 17 | // 18 | // C++: BFMatcher(int normType = NORM_L2, bool crossCheck = false) 19 | // 20 | 21 | //javadoc: BFMatcher::BFMatcher(normType, crossCheck) 22 | public BFMatcher(int normType, boolean crossCheck) 23 | { 24 | 25 | super( BFMatcher_0(normType, crossCheck) ); 26 | 27 | return; 28 | } 29 | 30 | //javadoc: BFMatcher::BFMatcher() 31 | public BFMatcher() 32 | { 33 | 34 | super( BFMatcher_1() ); 35 | 36 | return; 37 | } 38 | 39 | 40 | // 41 | // C++: static Ptr_BFMatcher create(int normType = NORM_L2, bool crossCheck = false) 42 | // 43 | 44 | //javadoc: BFMatcher::create(normType, crossCheck) 45 | public static BFMatcher create(int normType, boolean crossCheck) 46 | { 47 | 48 | BFMatcher retVal = new BFMatcher(create_0(normType, crossCheck)); 49 | 50 | return retVal; 51 | } 52 | 53 | //javadoc: BFMatcher::create() 54 | public static BFMatcher create() 55 | { 56 | 57 | BFMatcher retVal = new BFMatcher(create_1()); 58 | 59 | return retVal; 60 | } 61 | 62 | 63 | @Override 64 | protected void finalize() throws Throwable { 65 | delete(nativeObj); 66 | } 67 | 68 | 69 | 70 | // C++: BFMatcher(int normType = NORM_L2, bool crossCheck = false) 71 | private static native long BFMatcher_0(int normType, boolean crossCheck); 72 | private static native long BFMatcher_1(); 73 | 74 | // C++: static Ptr_BFMatcher create(int normType = NORM_L2, bool crossCheck = false) 75 | private static native long create_0(int normType, boolean crossCheck); 76 | private static native long create_1(); 77 | 78 | // native support for java finalize() 79 | private static native void delete(long nativeObj); 80 | 81 | } 82 | -------------------------------------------------------------------------------- /OpenCVLibrary340/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 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/video/BackgroundSubtractor.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | 10 | // C++: class BackgroundSubtractor 11 | //javadoc: BackgroundSubtractor 12 | 13 | public class BackgroundSubtractor extends Algorithm { 14 | 15 | protected BackgroundSubtractor(long addr) { super(addr); } 16 | 17 | 18 | // 19 | // C++: void apply(Mat image, Mat& fgmask, double learningRate = -1) 20 | // 21 | 22 | //javadoc: BackgroundSubtractor::apply(image, fgmask, learningRate) 23 | public void apply(Mat image, Mat fgmask, double learningRate) 24 | { 25 | 26 | apply_0(nativeObj, image.nativeObj, fgmask.nativeObj, learningRate); 27 | 28 | return; 29 | } 30 | 31 | //javadoc: BackgroundSubtractor::apply(image, fgmask) 32 | public void apply(Mat image, Mat fgmask) 33 | { 34 | 35 | apply_1(nativeObj, image.nativeObj, fgmask.nativeObj); 36 | 37 | return; 38 | } 39 | 40 | 41 | // 42 | // C++: void getBackgroundImage(Mat& backgroundImage) 43 | // 44 | 45 | //javadoc: BackgroundSubtractor::getBackgroundImage(backgroundImage) 46 | public void getBackgroundImage(Mat backgroundImage) 47 | { 48 | 49 | getBackgroundImage_0(nativeObj, backgroundImage.nativeObj); 50 | 51 | return; 52 | } 53 | 54 | 55 | @Override 56 | protected void finalize() throws Throwable { 57 | delete(nativeObj); 58 | } 59 | 60 | 61 | 62 | // C++: void apply(Mat image, Mat& fgmask, double learningRate = -1) 63 | private static native void apply_0(long nativeObj, long image_nativeObj, long fgmask_nativeObj, double learningRate); 64 | private static native void apply_1(long nativeObj, long image_nativeObj, long fgmask_nativeObj); 65 | 66 | // C++: void getBackgroundImage(Mat& backgroundImage) 67 | private static native void getBackgroundImage_0(long nativeObj, long backgroundImage_nativeObj); 68 | 69 | // native support for java finalize() 70 | private static native void delete(long nativeObj); 71 | 72 | } 73 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/photo/TonemapDrago.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | 8 | 9 | // C++: class TonemapDrago 10 | //javadoc: TonemapDrago 11 | 12 | public class TonemapDrago extends Tonemap { 13 | 14 | protected TonemapDrago(long addr) { super(addr); } 15 | 16 | 17 | // 18 | // C++: float getBias() 19 | // 20 | 21 | //javadoc: TonemapDrago::getBias() 22 | public float getBias() 23 | { 24 | 25 | float retVal = getBias_0(nativeObj); 26 | 27 | return retVal; 28 | } 29 | 30 | 31 | // 32 | // C++: float getSaturation() 33 | // 34 | 35 | //javadoc: TonemapDrago::getSaturation() 36 | public float getSaturation() 37 | { 38 | 39 | float retVal = getSaturation_0(nativeObj); 40 | 41 | return retVal; 42 | } 43 | 44 | 45 | // 46 | // C++: void setBias(float bias) 47 | // 48 | 49 | //javadoc: TonemapDrago::setBias(bias) 50 | public void setBias(float bias) 51 | { 52 | 53 | setBias_0(nativeObj, bias); 54 | 55 | return; 56 | } 57 | 58 | 59 | // 60 | // C++: void setSaturation(float saturation) 61 | // 62 | 63 | //javadoc: TonemapDrago::setSaturation(saturation) 64 | public void setSaturation(float saturation) 65 | { 66 | 67 | setSaturation_0(nativeObj, saturation); 68 | 69 | return; 70 | } 71 | 72 | 73 | @Override 74 | protected void finalize() throws Throwable { 75 | delete(nativeObj); 76 | } 77 | 78 | 79 | 80 | // C++: float getBias() 81 | private static native float getBias_0(long nativeObj); 82 | 83 | // C++: float getSaturation() 84 | private static native float getSaturation_0(long nativeObj); 85 | 86 | // C++: void setBias(float bias) 87 | private static native void setBias_0(long nativeObj, float bias); 88 | 89 | // C++: void setSaturation(float saturation) 90 | private static native void setSaturation_0(long nativeObj, float saturation); 91 | 92 | // native support for java finalize() 93 | private static native void delete(long nativeObj); 94 | 95 | } 96 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/photo/TonemapMantiuk.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | 8 | 9 | // C++: class TonemapMantiuk 10 | //javadoc: TonemapMantiuk 11 | 12 | public class TonemapMantiuk extends Tonemap { 13 | 14 | protected TonemapMantiuk(long addr) { super(addr); } 15 | 16 | 17 | // 18 | // C++: float getSaturation() 19 | // 20 | 21 | //javadoc: TonemapMantiuk::getSaturation() 22 | public float getSaturation() 23 | { 24 | 25 | float retVal = getSaturation_0(nativeObj); 26 | 27 | return retVal; 28 | } 29 | 30 | 31 | // 32 | // C++: float getScale() 33 | // 34 | 35 | //javadoc: TonemapMantiuk::getScale() 36 | public float getScale() 37 | { 38 | 39 | float retVal = getScale_0(nativeObj); 40 | 41 | return retVal; 42 | } 43 | 44 | 45 | // 46 | // C++: void setSaturation(float saturation) 47 | // 48 | 49 | //javadoc: TonemapMantiuk::setSaturation(saturation) 50 | public void setSaturation(float saturation) 51 | { 52 | 53 | setSaturation_0(nativeObj, saturation); 54 | 55 | return; 56 | } 57 | 58 | 59 | // 60 | // C++: void setScale(float scale) 61 | // 62 | 63 | //javadoc: TonemapMantiuk::setScale(scale) 64 | public void setScale(float scale) 65 | { 66 | 67 | setScale_0(nativeObj, scale); 68 | 69 | return; 70 | } 71 | 72 | 73 | @Override 74 | protected void finalize() throws Throwable { 75 | delete(nativeObj); 76 | } 77 | 78 | 79 | 80 | // C++: float getSaturation() 81 | private static native float getSaturation_0(long nativeObj); 82 | 83 | // C++: float getScale() 84 | private static native float getScale_0(long nativeObj); 85 | 86 | // C++: void setSaturation(float saturation) 87 | private static native void setSaturation_0(long nativeObj, float saturation); 88 | 89 | // C++: void setScale(float scale) 90 | private static native void setScale_0(long nativeObj, float scale); 91 | 92 | // native support for java finalize() 93 | private static native void delete(long nativeObj); 94 | 95 | } 96 | -------------------------------------------------------------------------------- /OpenCVLibrary340/src/main/java/org/opencv/android/FpsMeter.java: -------------------------------------------------------------------------------- 1 | package org.opencv.android; 2 | 3 | import java.text.DecimalFormat; 4 | 5 | import org.opencv.core.Core; 6 | 7 | import android.graphics.Canvas; 8 | import android.graphics.Color; 9 | import android.graphics.Paint; 10 | import android.util.Log; 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 mFramesCouner; 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 | mFramesCouner = 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 | mFramesCouner++; 43 | if (mFramesCouner % 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 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main2.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | 17 | 18 |