├── .editorconfig ├── .gitattributes ├── .gitignore ├── LICENSE.md ├── README.md ├── android ├── .classpath ├── .project ├── .settings │ └── org.eclipse.buildship.core.prefs ├── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── openCVLibrary455 │ ├── build.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── aidl │ │ └── org │ │ │ └── opencv │ │ │ └── engine │ │ │ └── OpenCVEngineInterface.aidl │ │ ├── java │ │ └── org │ │ │ └── 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 │ │ │ └── UsacParams.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 │ │ │ ├── KeypointsModel.java │ │ │ ├── Layer.java │ │ │ ├── Model.java │ │ │ ├── Net.java │ │ │ ├── SegmentationModel.java │ │ │ ├── TextDetectionModel.java │ │ │ ├── TextDetectionModel_DB.java │ │ │ ├── TextDetectionModel_EAST.java │ │ │ └── TextRecognitionModel.java │ │ │ ├── features2d │ │ │ ├── AKAZE.java │ │ │ ├── AffineFeature.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 │ │ │ ├── SIFT.java │ │ │ ├── SimpleBlobDetector.java │ │ │ └── SimpleBlobDetector_Params.java │ │ │ ├── imgcodecs │ │ │ └── Imgcodecs.java │ │ │ ├── imgproc │ │ │ ├── CLAHE.java │ │ │ ├── GeneralizedHough.java │ │ │ ├── GeneralizedHoughBallard.java │ │ │ ├── GeneralizedHoughGuil.java │ │ │ ├── Imgproc.java │ │ │ ├── IntelligentScissorsMB.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 │ │ │ ├── FaceDetectorYN.java │ │ │ ├── FaceRecognizerSF.java │ │ │ ├── HOGDescriptor.java │ │ │ ├── Objdetect.java │ │ │ ├── QRCodeDetector.java │ │ │ ├── QRCodeEncoder.java │ │ │ └── QRCodeEncoder_Params.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 │ │ │ ├── Tracker.java │ │ │ ├── TrackerDaSiamRPN.java │ │ │ ├── TrackerDaSiamRPN_Params.java │ │ │ ├── TrackerGOTURN.java │ │ │ ├── TrackerGOTURN_Params.java │ │ │ ├── TrackerMIL.java │ │ │ ├── TrackerMIL_Params.java │ │ │ ├── VariationalRefinement.java │ │ │ └── Video.java │ │ │ └── videoio │ │ │ ├── VideoCapture.java │ │ │ ├── VideoWriter.java │ │ │ └── Videoio.java │ │ ├── res │ │ └── values │ │ │ └── attrs.xml │ │ └── resources │ │ └── org │ │ └── opencv │ │ └── core │ │ ├── MatAt.kt │ │ └── MatMatMul.kt ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── fr │ │ └── michaelvilleneuve │ │ ├── customcrop │ │ ├── ImageProcessor.java │ │ ├── RNCustomCropModule.java │ │ └── RNCustomCropPackage.java │ │ └── helpers │ │ ├── AppConstant.java │ │ ├── Quadrilateral.java │ │ ├── ScannedDocument.java │ │ └── Utils.java │ └── jniLibs │ ├── arm64-v8a │ └── libopencv_java4.so │ ├── armeabi-v7a │ └── libopencv_java4.so │ ├── x86 │ └── libopencv_java4.so │ └── x86_64 │ └── libopencv_java4.so ├── ios ├── CustomCropManager.h ├── CustomCropManager.mm └── RNCustomCrop.xcodeproj │ └── project.pbxproj ├── package-lock.json ├── package.json ├── react-native-perspective-image-cropper.podspec ├── react-native.config.js ├── src ├── index.tsx └── types.ts └── tsconfig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | root = true 3 | charset = utf-8 4 | end_of_line = lf 5 | indent_style = tab 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # OSX 3 | # 4 | .DS_Store 5 | 6 | # node.js 7 | # 8 | node_modules/ 9 | npm-debug.log 10 | yarn-error.log 11 | opencv2.framework 12 | opencv2.framework/ 13 | # Xcode 14 | # 15 | build/ 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | xcuserdata 25 | *.xccheckout 26 | *.moved-aside 27 | DerivedData 28 | *.hmap 29 | *.ipa 30 | *.xcuserstate 31 | project.xcworkspace 32 | 33 | 34 | # Android/IntelliJ 35 | # 36 | build/ 37 | .idea 38 | .gradle 39 | local.properties 40 | *.iml 41 | 42 | # BUCK 43 | buck-out/ 44 | \.buckd/ 45 | *.keystore 46 | 47 | 48 | /dist 49 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2017 GitHub Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React Native perspective image cropper 📐🖼 2 | 3 | A component that allows you to perform custom image crop and perspective correction ! 4 | 5 | ![Demo image](https://s3-eu-west-1.amazonaws.com/michaelvilleneuve/demo-crop.gif) 6 | 7 | ##### Designed to work with React Native Document Scanner 8 | 9 | https://github.com/Michaelvilleneuve/react-native-document-scanner 10 | 11 | ![Demo gif](https://raw.githubusercontent.com/Michaelvilleneuve/react-native-document-scanner/master/images/demo.gif) 12 | 13 | ## Installation 🚀🚀 14 | 15 | `$ npm install react-native-perspective-image-cropper --save` 16 | 17 | `$ react-native link react-native-perspective-image-cropper` 18 | 19 | This library uses react-native-svg, you must install it too. See https://github.com/react-native-community/react-native-svg for more infos. 20 | 21 | #### Android Only 22 | 23 | If you do not already have openCV installed in your project, add this line to your `settings.gradle` 24 | 25 | ``` 26 | include ':openCVLibrary310' 27 | project(':openCVLibrary310').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-perspective-image-cropper/android/openCVLibrary310') 28 | ``` 29 | 30 | ## Crop image 31 | 32 | - First get component ref 33 | 34 | ```javascript 35 | (this.customCrop = ref)} /> 36 | ``` 37 | 38 | - Then call : 39 | 40 | ```javascript 41 | this.customCrop.crop(); 42 | ``` 43 | 44 | ## Props 45 | 46 | | Props | Type | Required | Description | 47 | | ---------------------- | ------------------ | -------- | --------------------------------------------------------------------------------------- | 48 | | `updateImage` | `Func` | Yes | Returns the cropped image and the coordinates of the cropped image in the initial photo | 49 | | `rectangleCoordinates` | `Object` see usage | No | Object to predefine an area to crop (an already detected image for example) | 50 | | `initialImage` | `String` | Yes | Base64 encoded image you want to be cropped | 51 | | `height` | `Number` | Yes | Height of the image (will probably disappear in the future | 52 | | `width` | `Number` | Yes | Width of the image (will probably disappear in the future | 53 | | `overlayColor` | `String` | No | Color of the cropping area overlay | 54 | | `overlayStrokeColor` | `String` | No | Color of the cropping area stroke | 55 | | `overlayStrokeWidth` | `Number` | No | Width of the cropping area stroke | 56 | | `handlerColor` | `String` | No | Color of the handlers | 57 | | `enablePanStrict` | `Bool` | No | Enable pan on X axis, and Y axis | 58 | 59 | ## Usage 60 | 61 | ```javascript 62 | import CustomCrop from "react-native-perspective-image-cropper"; 63 | 64 | class CropView extends Component { 65 | componentWillMount() { 66 | Image.getSize(image, (width, height) => { 67 | this.setState({ 68 | imageWidth: width, 69 | imageHeight: height, 70 | initialImage: image, 71 | rectangleCoordinates: { 72 | topLeft: { x: 10, y: 10 }, 73 | topRight: { x: 10, y: 10 }, 74 | bottomRight: { x: 10, y: 10 }, 75 | bottomLeft: { x: 10, y: 10 } 76 | } 77 | }); 78 | }); 79 | } 80 | 81 | updateImage(image, newCoordinates) { 82 | this.setState({ 83 | image, 84 | rectangleCoordinates: newCoordinates 85 | }); 86 | } 87 | 88 | crop() { 89 | this.customCrop.crop(); 90 | } 91 | 92 | render() { 93 | return ( 94 | 95 | (this.customCrop = ref)} 102 | overlayColor="rgba(18,190,210, 1)" 103 | overlayStrokeColor="rgba(20,190,210, 1)" 104 | handlerColor="rgba(20,150,160, 1)" 105 | enablePanStrict={false} 106 | /> 107 | 108 | CROP IMAGE 109 | 110 | 111 | ); 112 | } 113 | } 114 | ``` 115 | -------------------------------------------------------------------------------- /android/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | react-native-perspective-image-cropper 4 | Project react-native-perspective-image-cropper created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir=../../../android 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | 2 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 3 | def safeExtGet(prop, fallback) { 4 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 5 | } 6 | 7 | buildscript { 8 | repositories { 9 | google() 10 | mavenCentral() 11 | } 12 | dependencies { 13 | classpath("com.android.tools.build:gradle:4.2.1") 14 | 15 | // NOTE: Do not place your application dependencies here; they belong 16 | // in the individual module build.gradle files 17 | } 18 | } 19 | 20 | apply plugin: 'com.android.library' 21 | 22 | android { 23 | namespace 'fr.michaelvilleneuve.customcrop' 24 | compileSdkVersion safeExtGet('compileSdkVersion', 28) 25 | buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3') 26 | 27 | packagingOptions { 28 | pickFirst '**/*.so' 29 | } 30 | 31 | buildFeatures { 32 | aidl = true 33 | buildConfig = true 34 | } 35 | 36 | defaultConfig { 37 | minSdkVersion safeExtGet('minSdkVersion', 16) 38 | targetSdkVersion safeExtGet('targetSdkVersion', 28) 39 | } 40 | } 41 | 42 | repositories { 43 | mavenCentral() 44 | } 45 | 46 | dependencies { 47 | implementation project(':openCVLibrary455') 48 | implementation 'com.facebook.react:react-native:+' 49 | } 50 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /android/openCVLibrary455/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | namespace "org.opencv" 5 | compileSdkVersion 30 6 | buildToolsVersion "30.0.2" 7 | 8 | packagingOptions { 9 | pickFirst '**/*.so' 10 | } 11 | 12 | buildFeatures { 13 | aidl = true 14 | buildConfig = true 15 | } 16 | 17 | defaultConfig { 18 | applicationId "org.opencv" 19 | } 20 | 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 25 | } 26 | } 27 | } 28 | 29 | project.ext.react = [ 30 | enableHermes: false, 31 | ] 32 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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.Context; 6 | import android.content.pm.PackageManager; 7 | import android.os.Build; 8 | import android.util.AttributeSet; 9 | import android.view.View; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import static android.Manifest.permission.CAMERA; 15 | 16 | public class CameraActivity extends Activity { 17 | 18 | private static final int CAMERA_PERMISSION_REQUEST_CODE = 200; 19 | 20 | protected List getCameraViewList() { 21 | return new ArrayList(); 22 | } 23 | 24 | protected void onCameraPermissionGranted() { 25 | List cameraViews = getCameraViewList(); 26 | if (cameraViews == null) { 27 | return; 28 | } 29 | for (CameraBridgeViewBase cameraBridgeViewBase: cameraViews) { 30 | if (cameraBridgeViewBase != null) { 31 | cameraBridgeViewBase.setCameraPermissionGranted(); 32 | } 33 | } 34 | } 35 | 36 | @Override 37 | protected void onStart() { 38 | super.onStart(); 39 | boolean havePermission = true; 40 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 41 | if (checkSelfPermission(CAMERA) != PackageManager.PERMISSION_GRANTED) { 42 | requestPermissions(new String[]{CAMERA}, CAMERA_PERMISSION_REQUEST_CODE); 43 | havePermission = false; 44 | } 45 | } 46 | if (havePermission) { 47 | onCameraPermissionGranted(); 48 | } 49 | } 50 | 51 | @Override 52 | @TargetApi(Build.VERSION_CODES.M) 53 | public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { 54 | if (requestCode == CAMERA_PERMISSION_REQUEST_CODE && grantResults.length > 0 55 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) { 56 | onCameraPermissionGranted(); 57 | } 58 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/java/org/opencv/android/CameraGLSurfaceView.java: -------------------------------------------------------------------------------- 1 | package org.opencv.android; 2 | 3 | import org.opencv.R; 4 | 5 | import android.content.Context; 6 | import android.content.res.TypedArray; 7 | import android.opengl.GLSurfaceView; 8 | import android.util.AttributeSet; 9 | import android.util.Log; 10 | import android.view.SurfaceHolder; 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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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.5.5"; 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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/java/org/opencv/android/StaticHelper.java: -------------------------------------------------------------------------------- 1 | package org.opencv.android; 2 | 3 | import org.opencv.core.Core; 4 | 5 | import java.util.StringTokenizer; 6 | import android.util.Log; 7 | 8 | class StaticHelper { 9 | 10 | public static boolean initOpenCV(boolean InitCuda) 11 | { 12 | boolean result; 13 | String libs = ""; 14 | 15 | if(InitCuda) 16 | { 17 | loadLibrary("cudart"); 18 | loadLibrary("nppc"); 19 | loadLibrary("nppi"); 20 | loadLibrary("npps"); 21 | loadLibrary("cufft"); 22 | loadLibrary("cublas"); 23 | } 24 | 25 | Log.d(TAG, "Trying to get library list"); 26 | 27 | try 28 | { 29 | System.loadLibrary("opencv_info"); 30 | libs = getLibraryList(); 31 | } 32 | catch(UnsatisfiedLinkError e) 33 | { 34 | Log.e(TAG, "OpenCV error: Cannot load info library for OpenCV"); 35 | } 36 | 37 | Log.d(TAG, "Library list: \"" + libs + "\""); 38 | Log.d(TAG, "First attempt to load libs"); 39 | if (initOpenCVLibs(libs)) 40 | { 41 | Log.d(TAG, "First attempt to load libs is OK"); 42 | String eol = System.getProperty("line.separator"); 43 | for (String str : Core.getBuildInformation().split(eol)) 44 | Log.i(TAG, str); 45 | 46 | result = true; 47 | } 48 | else 49 | { 50 | Log.d(TAG, "First attempt to load libs fails"); 51 | result = false; 52 | } 53 | 54 | return result; 55 | } 56 | 57 | private static boolean loadLibrary(String Name) 58 | { 59 | boolean result = true; 60 | 61 | Log.d(TAG, "Trying to load library " + Name); 62 | try 63 | { 64 | System.loadLibrary(Name); 65 | Log.d(TAG, "Library " + Name + " loaded"); 66 | } 67 | catch(UnsatisfiedLinkError e) 68 | { 69 | Log.d(TAG, "Cannot load library \"" + Name + "\""); 70 | e.printStackTrace(); 71 | result = false; 72 | } 73 | 74 | return result; 75 | } 76 | 77 | private static boolean initOpenCVLibs(String Libs) 78 | { 79 | Log.d(TAG, "Trying to init OpenCV libs"); 80 | 81 | boolean result = true; 82 | 83 | if ((null != Libs) && (Libs.length() != 0)) 84 | { 85 | Log.d(TAG, "Trying to load libs by dependency list"); 86 | StringTokenizer splitter = new StringTokenizer(Libs, ";"); 87 | while(splitter.hasMoreTokens()) 88 | { 89 | result &= loadLibrary(splitter.nextToken()); 90 | } 91 | } 92 | else 93 | { 94 | // If dependencies list is not defined or empty. 95 | result = loadLibrary("opencv_java4"); 96 | } 97 | 98 | return result; 99 | } 100 | 101 | private static final String TAG = "OpenCV/StaticHelper"; 102 | 103 | private static native String getLibraryList(); 104 | } 105 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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++: void cv::Algorithm::clear() 33 | // 34 | 35 | /** 36 | * Clears the algorithm state 37 | */ 38 | public void clear() { 39 | clear_0(nativeObj); 40 | } 41 | 42 | 43 | // 44 | // C++: void cv::Algorithm::write(Ptr_FileStorage fs, String name = String()) 45 | // 46 | 47 | // Unknown type 'Ptr_FileStorage' (I), skipping the function 48 | 49 | 50 | // 51 | // C++: void cv::Algorithm::read(FileNode fn) 52 | // 53 | 54 | // Unknown type 'FileNode' (I), skipping the function 55 | 56 | 57 | // 58 | // C++: bool cv::Algorithm::empty() 59 | // 60 | 61 | /** 62 | * Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read 63 | * @return automatically generated 64 | */ 65 | public boolean empty() { 66 | return empty_0(nativeObj); 67 | } 68 | 69 | 70 | // 71 | // C++: void cv::Algorithm::save(String filename) 72 | // 73 | 74 | /** 75 | * Saves the algorithm to a file. 76 | * In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs). 77 | * @param filename automatically generated 78 | */ 79 | public void save(String filename) { 80 | save_0(nativeObj, filename); 81 | } 82 | 83 | 84 | // 85 | // C++: String cv::Algorithm::getDefaultName() 86 | // 87 | 88 | /** 89 | * Returns the algorithm string identifier. 90 | * This string is used as top level xml/yml node tag when the object is saved to a file or string. 91 | * @return automatically generated 92 | */ 93 | public String getDefaultName() { 94 | return getDefaultName_0(nativeObj); 95 | } 96 | 97 | 98 | @Override 99 | protected void finalize() throws Throwable { 100 | delete(nativeObj); 101 | } 102 | 103 | 104 | 105 | // C++: void cv::Algorithm::clear() 106 | private static native void clear_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::save(String filename) 112 | private static native void save_0(long nativeObj, String filename); 113 | 114 | // C++: String cv::Algorithm::getDefaultName() 115 | private static native String getDefaultName_0(long nativeObj); 116 | 117 | // native support for java finalize() 118 | private static native void delete(long nativeObj); 119 | 120 | } 121 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/java/org/opencv/core/KeyPoint.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import org.opencv.core.Point; 4 | 5 | //javadoc: KeyPoint 6 | public class KeyPoint { 7 | 8 | /** 9 | * Coordinates of the keypoint. 10 | */ 11 | public Point pt; 12 | /** 13 | * Diameter of the useful keypoint adjacent area. 14 | */ 15 | public float size; 16 | /** 17 | * Computed orientation of the keypoint (-1 if not applicable). 18 | */ 19 | public float angle; 20 | /** 21 | * The response, by which the strongest keypoints have been selected. Can 22 | * be used for further sorting or subsampling. 23 | */ 24 | public float response; 25 | /** 26 | * Octave (pyramid layer), from which the keypoint has been extracted. 27 | */ 28 | public int octave; 29 | /** 30 | * Object ID, that can be used to cluster keypoints by an object they 31 | * belong to. 32 | */ 33 | public int class_id; 34 | 35 | // javadoc:KeyPoint::KeyPoint(x,y,_size,_angle,_response,_octave,_class_id) 36 | public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id) { 37 | pt = new Point(x, y); 38 | size = _size; 39 | angle = _angle; 40 | response = _response; 41 | octave = _octave; 42 | class_id = _class_id; 43 | } 44 | 45 | // javadoc: KeyPoint::KeyPoint() 46 | public KeyPoint() { 47 | this(0, 0, 0, -1, 0, 0, -1); 48 | } 49 | 50 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response, _octave) 51 | public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave) { 52 | this(x, y, _size, _angle, _response, _octave, -1); 53 | } 54 | 55 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response) 56 | public KeyPoint(float x, float y, float _size, float _angle, float _response) { 57 | this(x, y, _size, _angle, _response, 0, -1); 58 | } 59 | 60 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle) 61 | public KeyPoint(float x, float y, float _size, float _angle) { 62 | this(x, y, _size, _angle, 0, 0, -1); 63 | } 64 | 65 | // javadoc: KeyPoint::KeyPoint(x, y, _size) 66 | public KeyPoint(float x, float y, float _size) { 67 | this(x, y, _size, -1, 0, 0, -1); 68 | } 69 | 70 | @Override 71 | public String toString() { 72 | return "KeyPoint [pt=" + pt + ", size=" + size + ", angle=" + angle 73 | + ", response=" + response + ", octave=" + octave 74 | + ", class_id=" + class_id + "]"; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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) 42 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 43 | } 44 | 45 | 46 | public void fromArray(DMatch...a) { 47 | if(a==null || a.length==0) 48 | return; 49 | int num = a.length; 50 | alloc(num); 51 | float buff[] = new float[num * _channels]; 52 | for(int i=0; i ldm) { 75 | DMatch adm[] = ldm.toArray(new DMatch[0]); 76 | fromArray(adm); 77 | } 78 | 79 | public List toList() { 80 | DMatch[] adm = toArray(); 81 | return Arrays.asList(adm); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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) 42 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 43 | } 44 | 45 | public void fromArray(KeyPoint...a) { 46 | if(a==null || a.length==0) 47 | return; 48 | int num = a.length; 49 | alloc(num); 50 | float buff[] = new float[num * _channels]; 51 | for(int i=0; i lkp) { 78 | KeyPoint akp[] = lkp.toArray(new KeyPoint[0]); 79 | fromArray(akp); 80 | } 81 | 82 | public List toList() { 83 | KeyPoint[] akp = toArray(); 84 | return Arrays.asList(akp); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.core.RotatedRect; 7 | 8 | 9 | 10 | public class MatOfRotatedRect extends Mat { 11 | // 32FC5 12 | private static final int _depth = CvType.CV_32F; 13 | private static final int _channels = 5; 14 | 15 | public MatOfRotatedRect() { 16 | super(); 17 | } 18 | 19 | protected MatOfRotatedRect(long addr) { 20 | super(addr); 21 | if( !empty() && checkVector(_channels, _depth) < 0 ) 22 | throw new IllegalArgumentException("Incompatible Mat"); 23 | //FIXME: do we need release() here? 24 | } 25 | 26 | public static MatOfRotatedRect fromNativeAddr(long addr) { 27 | return new MatOfRotatedRect(addr); 28 | } 29 | 30 | public MatOfRotatedRect(Mat m) { 31 | super(m, Range.all()); 32 | if( !empty() && checkVector(_channels, _depth) < 0 ) 33 | throw new IllegalArgumentException("Incompatible Mat"); 34 | //FIXME: do we need release() here? 35 | } 36 | 37 | public MatOfRotatedRect(RotatedRect...a) { 38 | super(); 39 | fromArray(a); 40 | } 41 | 42 | public void alloc(int elemNumber) { 43 | if(elemNumber>0) 44 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 45 | } 46 | 47 | public void fromArray(RotatedRect...a) { 48 | if(a==null || a.length==0) 49 | return; 50 | int num = a.length; 51 | alloc(num); 52 | float buff[] = new float[num * _channels]; 53 | for(int i=0; i lr) { 78 | RotatedRect ap[] = lr.toArray(new RotatedRect[0]); 79 | fromArray(ap); 80 | } 81 | 82 | public List toList() { 83 | RotatedRect[] ar = toArray(); 84 | return Arrays.asList(ar); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.dnn.Model; 8 | import org.opencv.dnn.Net; 9 | 10 | // C++: class ClassificationModel 11 | /** 12 | * This class represents high-level API for classification models. 13 | * 14 | * ClassificationModel allows to set params for preprocessing input image. 15 | * ClassificationModel creates net from file with trained weights and config, 16 | * sets preprocessing input, runs forward pass and return top-1 prediction. 17 | */ 18 | public class ClassificationModel extends Model { 19 | 20 | protected ClassificationModel(long addr) { super(addr); } 21 | 22 | // internal usage only 23 | public static ClassificationModel __fromPtr__(long addr) { return new ClassificationModel(addr); } 24 | 25 | // 26 | // C++: cv::dnn::ClassificationModel::ClassificationModel(String model, String config = "") 27 | // 28 | 29 | /** 30 | * Create classification model from network represented in one of the supported formats. 31 | * An order of {@code model} and {@code config} arguments does not matter. 32 | * @param model Binary file contains trained weights. 33 | * @param config Text file contains network configuration. 34 | */ 35 | public ClassificationModel(String model, String config) { 36 | super(ClassificationModel_0(model, config)); 37 | } 38 | 39 | /** 40 | * Create classification model from network represented in one of the supported formats. 41 | * An order of {@code model} and {@code config} arguments does not matter. 42 | * @param model Binary file contains trained weights. 43 | */ 44 | public ClassificationModel(String model) { 45 | super(ClassificationModel_1(model)); 46 | } 47 | 48 | 49 | // 50 | // C++: cv::dnn::ClassificationModel::ClassificationModel(Net network) 51 | // 52 | 53 | /** 54 | * Create model from deep learning network. 55 | * @param network Net object. 56 | */ 57 | public ClassificationModel(Net network) { 58 | super(ClassificationModel_2(network.nativeObj)); 59 | } 60 | 61 | 62 | // 63 | // C++: void cv::dnn::ClassificationModel::classify(Mat frame, int& classId, float& conf) 64 | // 65 | 66 | public void classify(Mat frame, int[] classId, float[] conf) { 67 | double[] classId_out = new double[1]; 68 | double[] conf_out = new double[1]; 69 | classify_0(nativeObj, frame.nativeObj, classId_out, conf_out); 70 | if(classId!=null) classId[0] = (int)classId_out[0]; 71 | if(conf!=null) conf[0] = (float)conf_out[0]; 72 | } 73 | 74 | 75 | @Override 76 | protected void finalize() throws Throwable { 77 | delete(nativeObj); 78 | } 79 | 80 | 81 | 82 | // C++: cv::dnn::ClassificationModel::ClassificationModel(String model, String config = "") 83 | private static native long ClassificationModel_0(String model, String config); 84 | private static native long ClassificationModel_1(String model); 85 | 86 | // C++: cv::dnn::ClassificationModel::ClassificationModel(Net network) 87 | private static native long ClassificationModel_2(long network_nativeObj); 88 | 89 | // C++: void cv::dnn::ClassificationModel::classify(Mat frame, int& classId, float& conf) 90 | private static native void classify_0(long nativeObj, long frame_nativeObj, double[] classId_out, double[] conf_out); 91 | 92 | // native support for java finalize() 93 | private static native void delete(long nativeObj); 94 | 95 | } 96 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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(int i) 25 | // 26 | 27 | public DictValue(int i) { 28 | nativeObj = DictValue_0(i); 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(String s) 43 | // 44 | 45 | public DictValue(String s) { 46 | nativeObj = DictValue_2(s); 47 | } 48 | 49 | 50 | // 51 | // C++: bool cv::dnn::DictValue::isInt() 52 | // 53 | 54 | public boolean isInt() { 55 | return isInt_0(nativeObj); 56 | } 57 | 58 | 59 | // 60 | // C++: bool cv::dnn::DictValue::isString() 61 | // 62 | 63 | public boolean isString() { 64 | return isString_0(nativeObj); 65 | } 66 | 67 | 68 | // 69 | // C++: bool cv::dnn::DictValue::isReal() 70 | // 71 | 72 | public boolean isReal() { 73 | return isReal_0(nativeObj); 74 | } 75 | 76 | 77 | // 78 | // C++: int cv::dnn::DictValue::getIntValue(int idx = -1) 79 | // 80 | 81 | public int getIntValue(int idx) { 82 | return getIntValue_0(nativeObj, idx); 83 | } 84 | 85 | public int getIntValue() { 86 | return getIntValue_1(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++: String cv::dnn::DictValue::getStringValue(int idx = -1) 105 | // 106 | 107 | public String getStringValue(int idx) { 108 | return getStringValue_0(nativeObj, idx); 109 | } 110 | 111 | public String getStringValue() { 112 | return getStringValue_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(int i) 124 | private static native long DictValue_0(int i); 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(String s) 130 | private static native long DictValue_2(String s); 131 | 132 | // C++: bool cv::dnn::DictValue::isInt() 133 | private static native boolean isInt_0(long nativeObj); 134 | 135 | // C++: bool cv::dnn::DictValue::isString() 136 | private static native boolean isString_0(long nativeObj); 137 | 138 | // C++: bool cv::dnn::DictValue::isReal() 139 | private static native boolean isReal_0(long nativeObj); 140 | 141 | // C++: int cv::dnn::DictValue::getIntValue(int idx = -1) 142 | private static native int getIntValue_0(long nativeObj, int idx); 143 | private static native int getIntValue_1(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++: String cv::dnn::DictValue::getStringValue(int idx = -1) 150 | private static native String getStringValue_0(long nativeObj, int idx); 151 | private static native String getStringValue_1(long nativeObj); 152 | 153 | // native support for java finalize() 154 | private static native void delete(long nativeObj); 155 | 156 | } 157 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/java/org/opencv/dnn/KeypointsModel.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file is auto-generated. Please don't modify it! 3 | // 4 | package org.opencv.dnn; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import org.opencv.core.Mat; 9 | import org.opencv.core.MatOfPoint2f; 10 | import org.opencv.dnn.Model; 11 | import org.opencv.dnn.Net; 12 | import org.opencv.utils.Converters; 13 | 14 | // C++: class KeypointsModel 15 | /** 16 | * This class represents high-level API for keypoints models 17 | * 18 | * KeypointsModel allows to set params for preprocessing input image. 19 | * KeypointsModel creates net from file with trained weights and config, 20 | * sets preprocessing input, runs forward pass and returns the x and y coordinates of each detected keypoint 21 | */ 22 | public class KeypointsModel extends Model { 23 | 24 | protected KeypointsModel(long addr) { super(addr); } 25 | 26 | // internal usage only 27 | public static KeypointsModel __fromPtr__(long addr) { return new KeypointsModel(addr); } 28 | 29 | // 30 | // C++: cv::dnn::KeypointsModel::KeypointsModel(String model, String config = "") 31 | // 32 | 33 | /** 34 | * Create keypoints model from network represented in one of the supported formats. 35 | * An order of {@code model} and {@code config} arguments does not matter. 36 | * @param model Binary file contains trained weights. 37 | * @param config Text file contains network configuration. 38 | */ 39 | public KeypointsModel(String model, String config) { 40 | super(KeypointsModel_0(model, config)); 41 | } 42 | 43 | /** 44 | * Create keypoints model from network represented in one of the supported formats. 45 | * An order of {@code model} and {@code config} arguments does not matter. 46 | * @param model Binary file contains trained weights. 47 | */ 48 | public KeypointsModel(String model) { 49 | super(KeypointsModel_1(model)); 50 | } 51 | 52 | 53 | // 54 | // C++: cv::dnn::KeypointsModel::KeypointsModel(Net network) 55 | // 56 | 57 | /** 58 | * Create model from deep learning network. 59 | * @param network Net object. 60 | */ 61 | public KeypointsModel(Net network) { 62 | super(KeypointsModel_2(network.nativeObj)); 63 | } 64 | 65 | 66 | // 67 | // C++: vector_Point2f cv::dnn::KeypointsModel::estimate(Mat frame, float thresh = 0.5) 68 | // 69 | 70 | /** 71 | * Given the {@code input} frame, create input blob, run net 72 | * @param thresh minimum confidence threshold to select a keypoint 73 | * @return a vector holding the x and y coordinates of each detected keypoint 74 | * 75 | * @param frame automatically generated 76 | */ 77 | public MatOfPoint2f estimate(Mat frame, float thresh) { 78 | return MatOfPoint2f.fromNativeAddr(estimate_0(nativeObj, frame.nativeObj, thresh)); 79 | } 80 | 81 | /** 82 | * Given the {@code input} frame, create input blob, run net 83 | * @return a vector holding the x and y coordinates of each detected keypoint 84 | * 85 | * @param frame automatically generated 86 | */ 87 | public MatOfPoint2f estimate(Mat frame) { 88 | return MatOfPoint2f.fromNativeAddr(estimate_1(nativeObj, frame.nativeObj)); 89 | } 90 | 91 | 92 | @Override 93 | protected void finalize() throws Throwable { 94 | delete(nativeObj); 95 | } 96 | 97 | 98 | 99 | // C++: cv::dnn::KeypointsModel::KeypointsModel(String model, String config = "") 100 | private static native long KeypointsModel_0(String model, String config); 101 | private static native long KeypointsModel_1(String model); 102 | 103 | // C++: cv::dnn::KeypointsModel::KeypointsModel(Net network) 104 | private static native long KeypointsModel_2(long network_nativeObj); 105 | 106 | // C++: vector_Point2f cv::dnn::KeypointsModel::estimate(Mat frame, float thresh = 0.5) 107 | private static native long estimate_0(long nativeObj, long frame_nativeObj, float thresh); 108 | private static native long estimate_1(long nativeObj, long frame_nativeObj); 109 | 110 | // native support for java finalize() 111 | private static native void delete(long nativeObj); 112 | 113 | } 114 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.dnn.Model; 8 | import org.opencv.dnn.Net; 9 | 10 | // C++: class SegmentationModel 11 | /** 12 | * This class represents high-level API for segmentation models 13 | * 14 | * SegmentationModel allows to set params for preprocessing input image. 15 | * SegmentationModel creates net from file with trained weights and config, 16 | * sets preprocessing input, runs forward pass and returns the class prediction for each pixel. 17 | */ 18 | public class SegmentationModel extends Model { 19 | 20 | protected SegmentationModel(long addr) { super(addr); } 21 | 22 | // internal usage only 23 | public static SegmentationModel __fromPtr__(long addr) { return new SegmentationModel(addr); } 24 | 25 | // 26 | // C++: cv::dnn::SegmentationModel::SegmentationModel(String model, String config = "") 27 | // 28 | 29 | /** 30 | * Create segmentation model from network represented in one of the supported formats. 31 | * An order of {@code model} and {@code config} arguments does not matter. 32 | * @param model Binary file contains trained weights. 33 | * @param config Text file contains network configuration. 34 | */ 35 | public SegmentationModel(String model, String config) { 36 | super(SegmentationModel_0(model, config)); 37 | } 38 | 39 | /** 40 | * Create segmentation model from network represented in one of the supported formats. 41 | * An order of {@code model} and {@code config} arguments does not matter. 42 | * @param model Binary file contains trained weights. 43 | */ 44 | public SegmentationModel(String model) { 45 | super(SegmentationModel_1(model)); 46 | } 47 | 48 | 49 | // 50 | // C++: cv::dnn::SegmentationModel::SegmentationModel(Net network) 51 | // 52 | 53 | /** 54 | * Create model from deep learning network. 55 | * @param network Net object. 56 | */ 57 | public SegmentationModel(Net network) { 58 | super(SegmentationModel_2(network.nativeObj)); 59 | } 60 | 61 | 62 | // 63 | // C++: void cv::dnn::SegmentationModel::segment(Mat frame, Mat& mask) 64 | // 65 | 66 | /** 67 | * Given the {@code input} frame, create input blob, run net 68 | * @param mask Allocated class prediction for each pixel 69 | * @param frame automatically generated 70 | */ 71 | public void segment(Mat frame, Mat mask) { 72 | segment_0(nativeObj, frame.nativeObj, mask.nativeObj); 73 | } 74 | 75 | 76 | @Override 77 | protected void finalize() throws Throwable { 78 | delete(nativeObj); 79 | } 80 | 81 | 82 | 83 | // C++: cv::dnn::SegmentationModel::SegmentationModel(String model, String config = "") 84 | private static native long SegmentationModel_0(String model, String config); 85 | private static native long SegmentationModel_1(String model); 86 | 87 | // C++: cv::dnn::SegmentationModel::SegmentationModel(Net network) 88 | private static native long SegmentationModel_2(long network_nativeObj); 89 | 90 | // C++: void cv::dnn::SegmentationModel::segment(Mat frame, Mat& mask) 91 | private static native void segment_0(long nativeObj, long frame_nativeObj, long mask_nativeObj); 92 | 93 | // native support for java finalize() 94 | private static native void delete(long nativeObj); 95 | 96 | } 97 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.features2d.BOWTrainer; 9 | 10 | // C++: class BOWKMeansTrainer 11 | /** 12 | * kmeans -based class to train visual vocabulary using the *bag of visual words* approach. : 13 | */ 14 | public class BOWKMeansTrainer extends BOWTrainer { 15 | 16 | protected BOWKMeansTrainer(long addr) { super(addr); } 17 | 18 | // internal usage only 19 | public static BOWKMeansTrainer __fromPtr__(long addr) { return new BOWKMeansTrainer(addr); } 20 | 21 | // 22 | // C++: cv::BOWKMeansTrainer::BOWKMeansTrainer(int clusterCount, TermCriteria termcrit = TermCriteria(), int attempts = 3, int flags = KMEANS_PP_CENTERS) 23 | // 24 | 25 | /** 26 | * The constructor. 27 | * 28 | * SEE: cv::kmeans 29 | * @param clusterCount automatically generated 30 | * @param termcrit automatically generated 31 | * @param attempts automatically generated 32 | * @param flags automatically generated 33 | */ 34 | public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit, int attempts, int flags) { 35 | super(BOWKMeansTrainer_0(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon, attempts, flags)); 36 | } 37 | 38 | /** 39 | * The constructor. 40 | * 41 | * SEE: cv::kmeans 42 | * @param clusterCount automatically generated 43 | * @param termcrit automatically generated 44 | * @param attempts automatically generated 45 | */ 46 | public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit, int attempts) { 47 | super(BOWKMeansTrainer_1(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon, attempts)); 48 | } 49 | 50 | /** 51 | * The constructor. 52 | * 53 | * SEE: cv::kmeans 54 | * @param clusterCount automatically generated 55 | * @param termcrit automatically generated 56 | */ 57 | public BOWKMeansTrainer(int clusterCount, TermCriteria termcrit) { 58 | super(BOWKMeansTrainer_2(clusterCount, termcrit.type, termcrit.maxCount, termcrit.epsilon)); 59 | } 60 | 61 | /** 62 | * The constructor. 63 | * 64 | * SEE: cv::kmeans 65 | * @param clusterCount automatically generated 66 | */ 67 | public BOWKMeansTrainer(int clusterCount) { 68 | super(BOWKMeansTrainer_3(clusterCount)); 69 | } 70 | 71 | 72 | // 73 | // C++: Mat cv::BOWKMeansTrainer::cluster() 74 | // 75 | 76 | public Mat cluster() { 77 | return new Mat(cluster_0(nativeObj)); 78 | } 79 | 80 | 81 | // 82 | // C++: Mat cv::BOWKMeansTrainer::cluster(Mat descriptors) 83 | // 84 | 85 | public Mat cluster(Mat descriptors) { 86 | return new Mat(cluster_1(nativeObj, descriptors.nativeObj)); 87 | } 88 | 89 | 90 | @Override 91 | protected void finalize() throws Throwable { 92 | delete(nativeObj); 93 | } 94 | 95 | 96 | 97 | // C++: cv::BOWKMeansTrainer::BOWKMeansTrainer(int clusterCount, TermCriteria termcrit = TermCriteria(), int attempts = 3, int flags = KMEANS_PP_CENTERS) 98 | private static native long BOWKMeansTrainer_0(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon, int attempts, int flags); 99 | private static native long BOWKMeansTrainer_1(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon, int attempts); 100 | private static native long BOWKMeansTrainer_2(int clusterCount, int termcrit_type, int termcrit_maxCount, double termcrit_epsilon); 101 | private static native long BOWKMeansTrainer_3(int clusterCount); 102 | 103 | // C++: Mat cv::BOWKMeansTrainer::cluster() 104 | private static native long cluster_0(long nativeObj); 105 | 106 | // C++: Mat cv::BOWKMeansTrainer::cluster(Mat descriptors) 107 | private static native long cluster_1(long nativeObj, long descriptors_nativeObj); 108 | 109 | // native support for java finalize() 110 | private static native void delete(long nativeObj); 111 | 112 | } 113 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 java.util.ArrayList; 7 | import java.util.List; 8 | import org.opencv.core.Mat; 9 | import org.opencv.utils.Converters; 10 | 11 | // C++: class BOWTrainer 12 | /** 13 | * Abstract base class for training the *bag of visual words* vocabulary from a set of descriptors. 14 | * 15 | * For details, see, for example, *Visual Categorization with Bags of Keypoints* by Gabriella Csurka, 16 | * Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. : 17 | */ 18 | public class BOWTrainer { 19 | 20 | protected final long nativeObj; 21 | protected BOWTrainer(long addr) { nativeObj = addr; } 22 | 23 | public long getNativeObjAddr() { return nativeObj; } 24 | 25 | // internal usage only 26 | public static BOWTrainer __fromPtr__(long addr) { return new BOWTrainer(addr); } 27 | 28 | // 29 | // C++: void cv::BOWTrainer::add(Mat descriptors) 30 | // 31 | 32 | /** 33 | * Adds descriptors to a training set. 34 | * 35 | * @param descriptors Descriptors to add to a training set. Each row of the descriptors matrix is a 36 | * descriptor. 37 | * 38 | * The training set is clustered using clustermethod to construct the vocabulary. 39 | */ 40 | public void add(Mat descriptors) { 41 | add_0(nativeObj, descriptors.nativeObj); 42 | } 43 | 44 | 45 | // 46 | // C++: vector_Mat cv::BOWTrainer::getDescriptors() 47 | // 48 | 49 | /** 50 | * Returns a training set of descriptors. 51 | * @return automatically generated 52 | */ 53 | public List getDescriptors() { 54 | List retVal = new ArrayList(); 55 | Mat retValMat = new Mat(getDescriptors_0(nativeObj)); 56 | Converters.Mat_to_vector_Mat(retValMat, retVal); 57 | return retVal; 58 | } 59 | 60 | 61 | // 62 | // C++: int cv::BOWTrainer::descriptorsCount() 63 | // 64 | 65 | /** 66 | * Returns the count of all descriptors stored in the training set. 67 | * @return automatically generated 68 | */ 69 | public int descriptorsCount() { 70 | return descriptorsCount_0(nativeObj); 71 | } 72 | 73 | 74 | // 75 | // C++: void cv::BOWTrainer::clear() 76 | // 77 | 78 | public void clear() { 79 | clear_0(nativeObj); 80 | } 81 | 82 | 83 | // 84 | // C++: Mat cv::BOWTrainer::cluster() 85 | // 86 | 87 | public Mat cluster() { 88 | return new Mat(cluster_0(nativeObj)); 89 | } 90 | 91 | 92 | // 93 | // C++: Mat cv::BOWTrainer::cluster(Mat descriptors) 94 | // 95 | 96 | /** 97 | * Clusters train descriptors. 98 | * 99 | * @param descriptors Descriptors to cluster. Each row of the descriptors matrix is a descriptor. 100 | * Descriptors are not added to the inner train descriptor set. 101 | * 102 | * The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first 103 | * variant of the method, train descriptors stored in the object are clustered. In the second variant, 104 | * input descriptors are clustered. 105 | * @return automatically generated 106 | */ 107 | public Mat cluster(Mat descriptors) { 108 | return new Mat(cluster_1(nativeObj, descriptors.nativeObj)); 109 | } 110 | 111 | 112 | @Override 113 | protected void finalize() throws Throwable { 114 | delete(nativeObj); 115 | } 116 | 117 | 118 | 119 | // C++: void cv::BOWTrainer::add(Mat descriptors) 120 | private static native void add_0(long nativeObj, long descriptors_nativeObj); 121 | 122 | // C++: vector_Mat cv::BOWTrainer::getDescriptors() 123 | private static native long getDescriptors_0(long nativeObj); 124 | 125 | // C++: int cv::BOWTrainer::descriptorsCount() 126 | private static native int descriptorsCount_0(long nativeObj); 127 | 128 | // C++: void cv::BOWTrainer::clear() 129 | private static native void clear_0(long nativeObj); 130 | 131 | // C++: Mat cv::BOWTrainer::cluster() 132 | private static native long cluster_0(long nativeObj); 133 | 134 | // C++: Mat cv::BOWTrainer::cluster(Mat descriptors) 135 | private static native long cluster_1(long nativeObj, long descriptors_nativeObj); 136 | 137 | // native support for java finalize() 138 | private static native void delete(long nativeObj); 139 | 140 | } 141 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.features2d.DescriptorMatcher; 7 | import org.opencv.features2d.FlannBasedMatcher; 8 | 9 | // C++: class FlannBasedMatcher 10 | /** 11 | * Flann-based descriptor matcher. 12 | * 13 | * This matcher trains cv::flann::Index on a train descriptor collection and calls its nearest search 14 | * methods to find the best matches. So, this matcher may be faster when matching a large train 15 | * collection than the brute force matcher. FlannBasedMatcher does not support masking permissible 16 | * matches of descriptor sets because flann::Index does not support this. : 17 | */ 18 | public class FlannBasedMatcher extends DescriptorMatcher { 19 | 20 | protected FlannBasedMatcher(long addr) { super(addr); } 21 | 22 | // internal usage only 23 | public static FlannBasedMatcher __fromPtr__(long addr) { return new FlannBasedMatcher(addr); } 24 | 25 | // 26 | // C++: cv::FlannBasedMatcher::FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr(), Ptr_flann_SearchParams searchParams = makePtr()) 27 | // 28 | 29 | public FlannBasedMatcher() { 30 | super(FlannBasedMatcher_0()); 31 | } 32 | 33 | 34 | // 35 | // C++: static Ptr_FlannBasedMatcher cv::FlannBasedMatcher::create() 36 | // 37 | 38 | public static FlannBasedMatcher create() { 39 | return FlannBasedMatcher.__fromPtr__(create_0()); 40 | } 41 | 42 | 43 | @Override 44 | protected void finalize() throws Throwable { 45 | delete(nativeObj); 46 | } 47 | 48 | 49 | 50 | // C++: cv::FlannBasedMatcher::FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr(), Ptr_flann_SearchParams searchParams = makePtr()) 51 | private static native long FlannBasedMatcher_0(); 52 | 53 | // C++: static Ptr_FlannBasedMatcher cv::FlannBasedMatcher::create() 54 | private static native long create_0(); 55 | 56 | // native support for java finalize() 57 | private static native void delete(long nativeObj); 58 | 59 | } 60 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.features2d.Feature2D; 7 | import org.opencv.features2d.SimpleBlobDetector; 8 | import org.opencv.features2d.SimpleBlobDetector_Params; 9 | 10 | // C++: class SimpleBlobDetector 11 | /** 12 | * Class for extracting blobs from an image. : 13 | * 14 | * The class implements a simple algorithm for extracting blobs from an image: 15 | * 16 | * 1. Convert the source image to binary images by applying thresholding with several thresholds from 17 | * minThreshold (inclusive) to maxThreshold (exclusive) with distance thresholdStep between 18 | * neighboring thresholds. 19 | * 2. Extract connected components from every binary image by findContours and calculate their 20 | * centers. 21 | * 3. Group centers from several binary images by their coordinates. Close centers form one group that 22 | * corresponds to one blob, which is controlled by the minDistBetweenBlobs parameter. 23 | * 4. From the groups, estimate final centers of blobs and their radiuses and return as locations and 24 | * sizes of keypoints. 25 | * 26 | * This class performs several filtrations of returned blobs. You should set filterBy\* to true/false 27 | * to turn on/off corresponding filtration. Available filtrations: 28 | * 29 | *
    30 | *
  • 31 | * By color. This filter compares the intensity of a binary image at the center of a blob to 32 | * blobColor. If they differ, the blob is filtered out. Use blobColor = 0 to extract dark blobs 33 | * and blobColor = 255 to extract light blobs. 34 | *
  • 35 | *
  • 36 | * By area. Extracted blobs have an area between minArea (inclusive) and maxArea (exclusive). 37 | *
  • 38 | *
  • 39 | * By circularity. Extracted blobs have circularity 40 | * (\(\frac{4*\pi*Area}{perimeter * perimeter}\)) between minCircularity (inclusive) and 41 | * maxCircularity (exclusive). 42 | *
  • 43 | *
  • 44 | * By ratio of the minimum inertia to maximum inertia. Extracted blobs have this ratio 45 | * between minInertiaRatio (inclusive) and maxInertiaRatio (exclusive). 46 | *
  • 47 | *
  • 48 | * By convexity. Extracted blobs have convexity (area / area of blob convex hull) between 49 | * minConvexity (inclusive) and maxConvexity (exclusive). 50 | *
  • 51 | *
52 | * 53 | * Default values of parameters are tuned to extract dark circular blobs. 54 | */ 55 | public class SimpleBlobDetector extends Feature2D { 56 | 57 | protected SimpleBlobDetector(long addr) { super(addr); } 58 | 59 | // internal usage only 60 | public static SimpleBlobDetector __fromPtr__(long addr) { return new SimpleBlobDetector(addr); } 61 | 62 | // 63 | // C++: static Ptr_SimpleBlobDetector cv::SimpleBlobDetector::create(SimpleBlobDetector_Params parameters = SimpleBlobDetector::Params()) 64 | // 65 | 66 | public static SimpleBlobDetector create(SimpleBlobDetector_Params parameters) { 67 | return SimpleBlobDetector.__fromPtr__(create_0(parameters.nativeObj)); 68 | } 69 | 70 | public static SimpleBlobDetector create() { 71 | return SimpleBlobDetector.__fromPtr__(create_1()); 72 | } 73 | 74 | 75 | // 76 | // C++: String cv::SimpleBlobDetector::getDefaultName() 77 | // 78 | 79 | public String getDefaultName() { 80 | return getDefaultName_0(nativeObj); 81 | } 82 | 83 | 84 | @Override 85 | protected void finalize() throws Throwable { 86 | delete(nativeObj); 87 | } 88 | 89 | 90 | 91 | // C++: static Ptr_SimpleBlobDetector cv::SimpleBlobDetector::create(SimpleBlobDetector_Params parameters = SimpleBlobDetector::Params()) 92 | private static native long create_0(long parameters_nativeObj); 93 | private static native long create_1(); 94 | 95 | // C++: String cv::SimpleBlobDetector::getDefaultName() 96 | private static native String getDefaultName_0(long nativeObj); 97 | 98 | // native support for java finalize() 99 | private static native void delete(long nativeObj); 100 | 101 | } 102 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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++: void cv::CLAHE::apply(Mat src, Mat& dst) 23 | // 24 | 25 | /** 26 | * Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization. 27 | * 28 | * @param src Source image of type CV_8UC1 or CV_16UC1. 29 | * @param dst Destination image. 30 | */ 31 | public void apply(Mat src, Mat dst) { 32 | apply_0(nativeObj, src.nativeObj, dst.nativeObj); 33 | } 34 | 35 | 36 | // 37 | // C++: void cv::CLAHE::setClipLimit(double clipLimit) 38 | // 39 | 40 | /** 41 | * Sets threshold for contrast limiting. 42 | * 43 | * @param clipLimit threshold value. 44 | */ 45 | public void setClipLimit(double clipLimit) { 46 | setClipLimit_0(nativeObj, clipLimit); 47 | } 48 | 49 | 50 | // 51 | // C++: double cv::CLAHE::getClipLimit() 52 | // 53 | 54 | public double getClipLimit() { 55 | return getClipLimit_0(nativeObj); 56 | } 57 | 58 | 59 | // 60 | // C++: void cv::CLAHE::setTilesGridSize(Size tileGridSize) 61 | // 62 | 63 | /** 64 | * Sets size of grid for histogram equalization. Input image will be divided into 65 | * equally sized rectangular tiles. 66 | * 67 | * @param tileGridSize defines the number of tiles in row and column. 68 | */ 69 | public void setTilesGridSize(Size tileGridSize) { 70 | setTilesGridSize_0(nativeObj, tileGridSize.width, tileGridSize.height); 71 | } 72 | 73 | 74 | // 75 | // C++: Size cv::CLAHE::getTilesGridSize() 76 | // 77 | 78 | public Size getTilesGridSize() { 79 | return new Size(getTilesGridSize_0(nativeObj)); 80 | } 81 | 82 | 83 | // 84 | // C++: void cv::CLAHE::collectGarbage() 85 | // 86 | 87 | public void collectGarbage() { 88 | collectGarbage_0(nativeObj); 89 | } 90 | 91 | 92 | @Override 93 | protected void finalize() throws Throwable { 94 | delete(nativeObj); 95 | } 96 | 97 | 98 | 99 | // C++: void cv::CLAHE::apply(Mat src, Mat& dst) 100 | private static native void apply_0(long nativeObj, long src_nativeObj, long dst_nativeObj); 101 | 102 | // C++: void cv::CLAHE::setClipLimit(double clipLimit) 103 | private static native void setClipLimit_0(long nativeObj, double clipLimit); 104 | 105 | // C++: double cv::CLAHE::getClipLimit() 106 | private static native double getClipLimit_0(long nativeObj); 107 | 108 | // C++: void cv::CLAHE::setTilesGridSize(Size tileGridSize) 109 | private static native void setTilesGridSize_0(long nativeObj, double tileGridSize_width, double tileGridSize_height); 110 | 111 | // C++: Size cv::CLAHE::getTilesGridSize() 112 | private static native double[] getTilesGridSize_0(long nativeObj); 113 | 114 | // C++: void cv::CLAHE::collectGarbage() 115 | private static native void collectGarbage_0(long nativeObj); 116 | 117 | // native support for java finalize() 118 | private static native void delete(long nativeObj); 119 | 120 | } 121 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.imgproc.GeneralizedHough; 7 | 8 | // C++: class GeneralizedHoughBallard 9 | /** 10 | * finds arbitrary template in the grayscale image using Generalized Hough Transform 11 | * 12 | * Detects position only without translation and rotation CITE: Ballard1981 . 13 | */ 14 | public class GeneralizedHoughBallard extends GeneralizedHough { 15 | 16 | protected GeneralizedHoughBallard(long addr) { super(addr); } 17 | 18 | // internal usage only 19 | public static GeneralizedHoughBallard __fromPtr__(long addr) { return new GeneralizedHoughBallard(addr); } 20 | 21 | // 22 | // C++: void cv::GeneralizedHoughBallard::setLevels(int levels) 23 | // 24 | 25 | public void setLevels(int levels) { 26 | setLevels_0(nativeObj, levels); 27 | } 28 | 29 | 30 | // 31 | // C++: int cv::GeneralizedHoughBallard::getLevels() 32 | // 33 | 34 | public int getLevels() { 35 | return getLevels_0(nativeObj); 36 | } 37 | 38 | 39 | // 40 | // C++: void cv::GeneralizedHoughBallard::setVotesThreshold(int votesThreshold) 41 | // 42 | 43 | public void setVotesThreshold(int votesThreshold) { 44 | setVotesThreshold_0(nativeObj, votesThreshold); 45 | } 46 | 47 | 48 | // 49 | // C++: int cv::GeneralizedHoughBallard::getVotesThreshold() 50 | // 51 | 52 | public int getVotesThreshold() { 53 | return getVotesThreshold_0(nativeObj); 54 | } 55 | 56 | 57 | @Override 58 | protected void finalize() throws Throwable { 59 | delete(nativeObj); 60 | } 61 | 62 | 63 | 64 | // C++: void cv::GeneralizedHoughBallard::setLevels(int levels) 65 | private static native void setLevels_0(long nativeObj, int levels); 66 | 67 | // C++: int cv::GeneralizedHoughBallard::getLevels() 68 | private static native int getLevels_0(long nativeObj); 69 | 70 | // C++: void cv::GeneralizedHoughBallard::setVotesThreshold(int votesThreshold) 71 | private static native void setVotesThreshold_0(long nativeObj, int votesThreshold); 72 | 73 | // C++: int cv::GeneralizedHoughBallard::getVotesThreshold() 74 | private static native int getVotesThreshold_0(long nativeObj); 75 | 76 | // native support for java finalize() 77 | private static native void delete(long nativeObj); 78 | 79 | } 80 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 ErrorTypes (cv.ml.ErrorTypes) 13 | public static final int 14 | TEST_ERROR = 0, 15 | TRAIN_ERROR = 1; 16 | 17 | 18 | // C++: enum SampleTypes (cv.ml.SampleTypes) 19 | public static final int 20 | ROW_SAMPLE = 0, 21 | COL_SAMPLE = 1; 22 | 23 | 24 | // C++: enum VariableTypes (cv.ml.VariableTypes) 25 | public static final int 26 | VAR_NUMERICAL = 0, 27 | VAR_ORDERED = 0, 28 | VAR_CATEGORICAL = 1; 29 | 30 | 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 java.util.ArrayList; 7 | import java.util.List; 8 | import org.opencv.core.Mat; 9 | import org.opencv.core.MatOfInt; 10 | import org.opencv.core.MatOfRect; 11 | import org.opencv.utils.Converters; 12 | 13 | // C++: class Objdetect 14 | 15 | public class Objdetect { 16 | 17 | // C++: enum 18 | public static final int 19 | CASCADE_DO_CANNY_PRUNING = 1, 20 | CASCADE_SCALE_IMAGE = 2, 21 | CASCADE_FIND_BIGGEST_OBJECT = 4, 22 | CASCADE_DO_ROUGH_SEARCH = 8; 23 | 24 | 25 | // C++: enum ObjectStatus (cv.DetectionBasedTracker.ObjectStatus) 26 | public static final int 27 | DetectionBasedTracker_DETECTED_NOT_SHOWN_YET = 0, 28 | DetectionBasedTracker_DETECTED = 1, 29 | DetectionBasedTracker_DETECTED_TEMPORARY_LOST = 2, 30 | DetectionBasedTracker_WRONG_OBJECT = 3; 31 | 32 | 33 | // 34 | // C++: void cv::groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2) 35 | // 36 | 37 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps) { 38 | Mat rectList_mat = rectList; 39 | Mat weights_mat = weights; 40 | groupRectangles_0(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold, eps); 41 | } 42 | 43 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold) { 44 | Mat rectList_mat = rectList; 45 | Mat weights_mat = weights; 46 | groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold); 47 | } 48 | 49 | 50 | 51 | 52 | // C++: void cv::groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2) 53 | private static native void groupRectangles_0(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold, double eps); 54 | private static native void groupRectangles_1(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold); 55 | 56 | } 57 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/java/org/opencv/objdetect/QRCodeEncoder_Params.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file is auto-generated. Please don't modify it! 3 | // 4 | package org.opencv.objdetect; 5 | 6 | 7 | 8 | // C++: class Params 9 | /** 10 | * QR code encoder parameters. 11 | * version The optional version of QR code (by default - maximum possible depending on 12 | * the length of the string). 13 | * correction_level The optional level of error correction (by default - the lowest). 14 | * mode The optional encoding mode - Numeric, Alphanumeric, Byte, Kanji, ECI or Structured Append. 15 | * structure_number The optional number of QR codes to generate in Structured Append mode. 16 | */ 17 | public class QRCodeEncoder_Params { 18 | 19 | protected final long nativeObj; 20 | protected QRCodeEncoder_Params(long addr) { nativeObj = addr; } 21 | 22 | public long getNativeObjAddr() { return nativeObj; } 23 | 24 | // internal usage only 25 | public static QRCodeEncoder_Params __fromPtr__(long addr) { return new QRCodeEncoder_Params(addr); } 26 | 27 | // 28 | // C++: cv::QRCodeEncoder::Params::Params() 29 | // 30 | 31 | public QRCodeEncoder_Params() { 32 | nativeObj = QRCodeEncoder_Params_0(); 33 | } 34 | 35 | 36 | // 37 | // C++: int QRCodeEncoder_Params::version 38 | // 39 | 40 | public int get_version() { 41 | return get_version_0(nativeObj); 42 | } 43 | 44 | 45 | // 46 | // C++: void QRCodeEncoder_Params::version 47 | // 48 | 49 | public void set_version(int version) { 50 | set_version_0(nativeObj, version); 51 | } 52 | 53 | 54 | // 55 | // C++: CorrectionLevel QRCodeEncoder_Params::correction_level 56 | // 57 | 58 | // Return type 'CorrectionLevel' is not supported, skipping the function 59 | 60 | 61 | // 62 | // C++: void QRCodeEncoder_Params::correction_level 63 | // 64 | 65 | // Unknown type 'CorrectionLevel' (I), skipping the function 66 | 67 | 68 | // 69 | // C++: EncodeMode QRCodeEncoder_Params::mode 70 | // 71 | 72 | // Return type 'EncodeMode' is not supported, skipping the function 73 | 74 | 75 | // 76 | // C++: void QRCodeEncoder_Params::mode 77 | // 78 | 79 | // Unknown type 'EncodeMode' (I), skipping the function 80 | 81 | 82 | // 83 | // C++: int QRCodeEncoder_Params::structure_number 84 | // 85 | 86 | public int get_structure_number() { 87 | return get_structure_number_0(nativeObj); 88 | } 89 | 90 | 91 | // 92 | // C++: void QRCodeEncoder_Params::structure_number 93 | // 94 | 95 | public void set_structure_number(int structure_number) { 96 | set_structure_number_0(nativeObj, structure_number); 97 | } 98 | 99 | 100 | @Override 101 | protected void finalize() throws Throwable { 102 | delete(nativeObj); 103 | } 104 | 105 | 106 | 107 | // C++: cv::QRCodeEncoder::Params::Params() 108 | private static native long QRCodeEncoder_Params_0(); 109 | 110 | // C++: int QRCodeEncoder_Params::version 111 | private static native int get_version_0(long nativeObj); 112 | 113 | // C++: void QRCodeEncoder_Params::version 114 | private static native void set_version_0(long nativeObj, int version); 115 | 116 | // C++: int QRCodeEncoder_Params::structure_number 117 | private static native int get_structure_number_0(long nativeObj); 118 | 119 | // C++: void QRCodeEncoder_Params::structure_number 120 | private static native void set_structure_number_0(long nativeObj, int structure_number); 121 | 122 | // native support for java finalize() 123 | private static native void delete(long nativeObj); 124 | 125 | } 126 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 java.util.ArrayList; 7 | import java.util.List; 8 | import org.opencv.core.Algorithm; 9 | import org.opencv.core.Mat; 10 | import org.opencv.utils.Converters; 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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 java.util.ArrayList; 7 | import java.util.List; 8 | import org.opencv.core.Algorithm; 9 | import org.opencv.core.Mat; 10 | import org.opencv.utils.Converters; 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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.photo.CalibrateCRF; 7 | 8 | // C++: class CalibrateDebevec 9 | /** 10 | * Inverse camera response function is extracted for each brightness value by minimizing an objective 11 | * function as linear system. Objective function is constructed using pixel values on the same position 12 | * in all images, extra term is added to make the result smoother. 13 | * 14 | * For more information see CITE: DM97 . 15 | */ 16 | public class CalibrateDebevec extends CalibrateCRF { 17 | 18 | protected CalibrateDebevec(long addr) { super(addr); } 19 | 20 | // internal usage only 21 | public static CalibrateDebevec __fromPtr__(long addr) { return new CalibrateDebevec(addr); } 22 | 23 | // 24 | // C++: float cv::CalibrateDebevec::getLambda() 25 | // 26 | 27 | public float getLambda() { 28 | return getLambda_0(nativeObj); 29 | } 30 | 31 | 32 | // 33 | // C++: void cv::CalibrateDebevec::setLambda(float lambda) 34 | // 35 | 36 | public void setLambda(float lambda) { 37 | setLambda_0(nativeObj, lambda); 38 | } 39 | 40 | 41 | // 42 | // C++: int cv::CalibrateDebevec::getSamples() 43 | // 44 | 45 | public int getSamples() { 46 | return getSamples_0(nativeObj); 47 | } 48 | 49 | 50 | // 51 | // C++: void cv::CalibrateDebevec::setSamples(int samples) 52 | // 53 | 54 | public void setSamples(int samples) { 55 | setSamples_0(nativeObj, samples); 56 | } 57 | 58 | 59 | // 60 | // C++: bool cv::CalibrateDebevec::getRandom() 61 | // 62 | 63 | public boolean getRandom() { 64 | return getRandom_0(nativeObj); 65 | } 66 | 67 | 68 | // 69 | // C++: void cv::CalibrateDebevec::setRandom(bool random) 70 | // 71 | 72 | public void setRandom(boolean random) { 73 | setRandom_0(nativeObj, random); 74 | } 75 | 76 | 77 | @Override 78 | protected void finalize() throws Throwable { 79 | delete(nativeObj); 80 | } 81 | 82 | 83 | 84 | // C++: float cv::CalibrateDebevec::getLambda() 85 | private static native float getLambda_0(long nativeObj); 86 | 87 | // C++: void cv::CalibrateDebevec::setLambda(float lambda) 88 | private static native void setLambda_0(long nativeObj, float lambda); 89 | 90 | // C++: int cv::CalibrateDebevec::getSamples() 91 | private static native int getSamples_0(long nativeObj); 92 | 93 | // C++: void cv::CalibrateDebevec::setSamples(int samples) 94 | private static native void setSamples_0(long nativeObj, int samples); 95 | 96 | // C++: bool cv::CalibrateDebevec::getRandom() 97 | private static native boolean getRandom_0(long nativeObj); 98 | 99 | // C++: void cv::CalibrateDebevec::setRandom(bool random) 100 | private static native void setRandom_0(long nativeObj, boolean random); 101 | 102 | // native support for java finalize() 103 | private static native void delete(long nativeObj); 104 | 105 | } 106 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.photo.CalibrateCRF; 8 | 9 | // C++: class CalibrateRobertson 10 | /** 11 | * Inverse camera response function is extracted for each brightness value by minimizing an objective 12 | * function as linear system. This algorithm uses all image pixels. 13 | * 14 | * For more information see CITE: RB99 . 15 | */ 16 | public class CalibrateRobertson extends CalibrateCRF { 17 | 18 | protected CalibrateRobertson(long addr) { super(addr); } 19 | 20 | // internal usage only 21 | public static CalibrateRobertson __fromPtr__(long addr) { return new CalibrateRobertson(addr); } 22 | 23 | // 24 | // C++: int cv::CalibrateRobertson::getMaxIter() 25 | // 26 | 27 | public int getMaxIter() { 28 | return getMaxIter_0(nativeObj); 29 | } 30 | 31 | 32 | // 33 | // C++: void cv::CalibrateRobertson::setMaxIter(int max_iter) 34 | // 35 | 36 | public void setMaxIter(int max_iter) { 37 | setMaxIter_0(nativeObj, max_iter); 38 | } 39 | 40 | 41 | // 42 | // C++: float cv::CalibrateRobertson::getThreshold() 43 | // 44 | 45 | public float getThreshold() { 46 | return getThreshold_0(nativeObj); 47 | } 48 | 49 | 50 | // 51 | // C++: void cv::CalibrateRobertson::setThreshold(float threshold) 52 | // 53 | 54 | public void setThreshold(float threshold) { 55 | setThreshold_0(nativeObj, threshold); 56 | } 57 | 58 | 59 | // 60 | // C++: Mat cv::CalibrateRobertson::getRadiance() 61 | // 62 | 63 | public Mat getRadiance() { 64 | return new Mat(getRadiance_0(nativeObj)); 65 | } 66 | 67 | 68 | @Override 69 | protected void finalize() throws Throwable { 70 | delete(nativeObj); 71 | } 72 | 73 | 74 | 75 | // C++: int cv::CalibrateRobertson::getMaxIter() 76 | private static native int getMaxIter_0(long nativeObj); 77 | 78 | // C++: void cv::CalibrateRobertson::setMaxIter(int max_iter) 79 | private static native void setMaxIter_0(long nativeObj, int max_iter); 80 | 81 | // C++: float cv::CalibrateRobertson::getThreshold() 82 | private static native float getThreshold_0(long nativeObj); 83 | 84 | // C++: void cv::CalibrateRobertson::setThreshold(float threshold) 85 | private static native void setThreshold_0(long nativeObj, float threshold); 86 | 87 | // C++: Mat cv::CalibrateRobertson::getRadiance() 88 | private static native long getRadiance_0(long nativeObj); 89 | 90 | // native support for java finalize() 91 | private static native void delete(long nativeObj); 92 | 93 | } 94 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 java.util.ArrayList; 7 | import java.util.List; 8 | import org.opencv.core.Mat; 9 | import org.opencv.photo.MergeExposures; 10 | import org.opencv.utils.Converters; 11 | 12 | // C++: class MergeDebevec 13 | /** 14 | * The resulting HDR image is calculated as weighted average of the exposures considering exposure 15 | * values and camera response. 16 | * 17 | * For more information see CITE: DM97 . 18 | */ 19 | public class MergeDebevec extends MergeExposures { 20 | 21 | protected MergeDebevec(long addr) { super(addr); } 22 | 23 | // internal usage only 24 | public static MergeDebevec __fromPtr__(long addr) { return new MergeDebevec(addr); } 25 | 26 | // 27 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times, Mat response) 28 | // 29 | 30 | public void process(List src, Mat dst, Mat times, Mat response) { 31 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 32 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 33 | } 34 | 35 | 36 | // 37 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times) 38 | // 39 | 40 | public void process(List src, Mat dst, Mat times) { 41 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 42 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 43 | } 44 | 45 | 46 | @Override 47 | protected void finalize() throws Throwable { 48 | delete(nativeObj); 49 | } 50 | 51 | 52 | 53 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times, Mat response) 54 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj); 55 | 56 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times) 57 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj); 58 | 59 | // native support for java finalize() 60 | private static native void delete(long nativeObj); 61 | 62 | } 63 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 java.util.ArrayList; 7 | import java.util.List; 8 | import org.opencv.core.Algorithm; 9 | import org.opencv.core.Mat; 10 | import org.opencv.utils.Converters; 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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 java.util.ArrayList; 7 | import java.util.List; 8 | import org.opencv.core.Mat; 9 | import org.opencv.photo.MergeExposures; 10 | import org.opencv.utils.Converters; 11 | 12 | // C++: class MergeRobertson 13 | /** 14 | * The resulting HDR image is calculated as weighted average of the exposures considering exposure 15 | * values and camera response. 16 | * 17 | * For more information see CITE: RB99 . 18 | */ 19 | public class MergeRobertson extends MergeExposures { 20 | 21 | protected MergeRobertson(long addr) { super(addr); } 22 | 23 | // internal usage only 24 | public static MergeRobertson __fromPtr__(long addr) { return new MergeRobertson(addr); } 25 | 26 | // 27 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times, Mat response) 28 | // 29 | 30 | public void process(List src, Mat dst, Mat times, Mat response) { 31 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 32 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 33 | } 34 | 35 | 36 | // 37 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times) 38 | // 39 | 40 | public void process(List src, Mat dst, Mat times) { 41 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 42 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 43 | } 44 | 45 | 46 | @Override 47 | protected void finalize() throws Throwable { 48 | delete(nativeObj); 49 | } 50 | 51 | 52 | 53 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times, Mat response) 54 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj); 55 | 56 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times) 57 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj); 58 | 59 | // native support for java finalize() 60 | private static native void delete(long nativeObj); 61 | 62 | } 63 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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++: void cv::Tonemap::process(Mat src, Mat& dst) 22 | // 23 | 24 | /** 25 | * Tonemaps image 26 | * 27 | * @param src source image - CV_32FC3 Mat (float 32 bits 3 channels) 28 | * @param dst destination image - CV_32FC3 Mat with values in [0, 1] range 29 | */ 30 | public void process(Mat src, Mat dst) { 31 | process_0(nativeObj, src.nativeObj, dst.nativeObj); 32 | } 33 | 34 | 35 | // 36 | // C++: float cv::Tonemap::getGamma() 37 | // 38 | 39 | public float getGamma() { 40 | return getGamma_0(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++: void cv::Tonemap::process(Mat src, Mat& dst) 61 | private static native void process_0(long nativeObj, long src_nativeObj, long dst_nativeObj); 62 | 63 | // C++: float cv::Tonemap::getGamma() 64 | private static native float getGamma_0(long 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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.photo.Tonemap; 7 | 8 | // C++: class TonemapDrago 9 | /** 10 | * Adaptive logarithmic mapping is a fast global tonemapping algorithm that scales the image in 11 | * logarithmic domain. 12 | * 13 | * Since it's a global operator the same function is applied to all the pixels, it is controlled by the 14 | * bias parameter. 15 | * 16 | * Optional saturation enhancement is possible as described in CITE: FL02 . 17 | * 18 | * For more information see CITE: DM03 . 19 | */ 20 | public class TonemapDrago extends Tonemap { 21 | 22 | protected TonemapDrago(long addr) { super(addr); } 23 | 24 | // internal usage only 25 | public static TonemapDrago __fromPtr__(long addr) { return new TonemapDrago(addr); } 26 | 27 | // 28 | // C++: float cv::TonemapDrago::getSaturation() 29 | // 30 | 31 | public float getSaturation() { 32 | return getSaturation_0(nativeObj); 33 | } 34 | 35 | 36 | // 37 | // C++: void cv::TonemapDrago::setSaturation(float saturation) 38 | // 39 | 40 | public void setSaturation(float saturation) { 41 | setSaturation_0(nativeObj, saturation); 42 | } 43 | 44 | 45 | // 46 | // C++: float cv::TonemapDrago::getBias() 47 | // 48 | 49 | public float getBias() { 50 | return getBias_0(nativeObj); 51 | } 52 | 53 | 54 | // 55 | // C++: void cv::TonemapDrago::setBias(float bias) 56 | // 57 | 58 | public void setBias(float bias) { 59 | setBias_0(nativeObj, bias); 60 | } 61 | 62 | 63 | @Override 64 | protected void finalize() throws Throwable { 65 | delete(nativeObj); 66 | } 67 | 68 | 69 | 70 | // C++: float cv::TonemapDrago::getSaturation() 71 | private static native float getSaturation_0(long nativeObj); 72 | 73 | // C++: void cv::TonemapDrago::setSaturation(float saturation) 74 | private static native void setSaturation_0(long nativeObj, float saturation); 75 | 76 | // C++: float cv::TonemapDrago::getBias() 77 | private static native float getBias_0(long nativeObj); 78 | 79 | // C++: void cv::TonemapDrago::setBias(float bias) 80 | private static native void setBias_0(long nativeObj, float bias); 81 | 82 | // native support for java finalize() 83 | private static native void delete(long nativeObj); 84 | 85 | } 86 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.photo.Tonemap; 7 | 8 | // C++: class TonemapMantiuk 9 | /** 10 | * This algorithm transforms image to contrast using gradients on all levels of gaussian pyramid, 11 | * transforms contrast values to HVS response and scales the response. After this the image is 12 | * reconstructed from new contrast values. 13 | * 14 | * For more information see CITE: MM06 . 15 | */ 16 | public class TonemapMantiuk extends Tonemap { 17 | 18 | protected TonemapMantiuk(long addr) { super(addr); } 19 | 20 | // internal usage only 21 | public static TonemapMantiuk __fromPtr__(long addr) { return new TonemapMantiuk(addr); } 22 | 23 | // 24 | // C++: float cv::TonemapMantiuk::getScale() 25 | // 26 | 27 | public float getScale() { 28 | return getScale_0(nativeObj); 29 | } 30 | 31 | 32 | // 33 | // C++: void cv::TonemapMantiuk::setScale(float scale) 34 | // 35 | 36 | public void setScale(float scale) { 37 | setScale_0(nativeObj, scale); 38 | } 39 | 40 | 41 | // 42 | // C++: float cv::TonemapMantiuk::getSaturation() 43 | // 44 | 45 | public float getSaturation() { 46 | return getSaturation_0(nativeObj); 47 | } 48 | 49 | 50 | // 51 | // C++: void cv::TonemapMantiuk::setSaturation(float saturation) 52 | // 53 | 54 | public void setSaturation(float saturation) { 55 | setSaturation_0(nativeObj, saturation); 56 | } 57 | 58 | 59 | @Override 60 | protected void finalize() throws Throwable { 61 | delete(nativeObj); 62 | } 63 | 64 | 65 | 66 | // C++: float cv::TonemapMantiuk::getScale() 67 | private static native float getScale_0(long nativeObj); 68 | 69 | // C++: void cv::TonemapMantiuk::setScale(float scale) 70 | private static native void setScale_0(long nativeObj, float scale); 71 | 72 | // C++: float cv::TonemapMantiuk::getSaturation() 73 | private static native float getSaturation_0(long nativeObj); 74 | 75 | // C++: void cv::TonemapMantiuk::setSaturation(float saturation) 76 | private static native void setSaturation_0(long nativeObj, float saturation); 77 | 78 | // native support for java finalize() 79 | private static native void delete(long nativeObj); 80 | 81 | } 82 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | import org.opencv.photo.Tonemap; 7 | 8 | // C++: class TonemapReinhard 9 | /** 10 | * This is a global tonemapping operator that models human visual system. 11 | * 12 | * Mapping function is controlled by adaptation parameter, that is computed using light adaptation and 13 | * color adaptation. 14 | * 15 | * For more information see CITE: RD05 . 16 | */ 17 | public class TonemapReinhard extends Tonemap { 18 | 19 | protected TonemapReinhard(long addr) { super(addr); } 20 | 21 | // internal usage only 22 | public static TonemapReinhard __fromPtr__(long addr) { return new TonemapReinhard(addr); } 23 | 24 | // 25 | // C++: float cv::TonemapReinhard::getIntensity() 26 | // 27 | 28 | public float getIntensity() { 29 | return getIntensity_0(nativeObj); 30 | } 31 | 32 | 33 | // 34 | // C++: void cv::TonemapReinhard::setIntensity(float intensity) 35 | // 36 | 37 | public void setIntensity(float intensity) { 38 | setIntensity_0(nativeObj, intensity); 39 | } 40 | 41 | 42 | // 43 | // C++: float cv::TonemapReinhard::getLightAdaptation() 44 | // 45 | 46 | public float getLightAdaptation() { 47 | return getLightAdaptation_0(nativeObj); 48 | } 49 | 50 | 51 | // 52 | // C++: void cv::TonemapReinhard::setLightAdaptation(float light_adapt) 53 | // 54 | 55 | public void setLightAdaptation(float light_adapt) { 56 | setLightAdaptation_0(nativeObj, light_adapt); 57 | } 58 | 59 | 60 | // 61 | // C++: float cv::TonemapReinhard::getColorAdaptation() 62 | // 63 | 64 | public float getColorAdaptation() { 65 | return getColorAdaptation_0(nativeObj); 66 | } 67 | 68 | 69 | // 70 | // C++: void cv::TonemapReinhard::setColorAdaptation(float color_adapt) 71 | // 72 | 73 | public void setColorAdaptation(float color_adapt) { 74 | setColorAdaptation_0(nativeObj, color_adapt); 75 | } 76 | 77 | 78 | @Override 79 | protected void finalize() throws Throwable { 80 | delete(nativeObj); 81 | } 82 | 83 | 84 | 85 | // C++: float cv::TonemapReinhard::getIntensity() 86 | private static native float getIntensity_0(long nativeObj); 87 | 88 | // C++: void cv::TonemapReinhard::setIntensity(float intensity) 89 | private static native void setIntensity_0(long nativeObj, float intensity); 90 | 91 | // C++: float cv::TonemapReinhard::getLightAdaptation() 92 | private static native float getLightAdaptation_0(long nativeObj); 93 | 94 | // C++: void cv::TonemapReinhard::setLightAdaptation(float light_adapt) 95 | private static native void setLightAdaptation_0(long nativeObj, float light_adapt); 96 | 97 | // C++: float cv::TonemapReinhard::getColorAdaptation() 98 | private static native float getColorAdaptation_0(long nativeObj); 99 | 100 | // C++: void cv::TonemapReinhard::setColorAdaptation(float color_adapt) 101 | private static native void setColorAdaptation_0(long nativeObj, float color_adapt); 102 | 103 | // native support for java finalize() 104 | private static native void delete(long nativeObj); 105 | 106 | } 107 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/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 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/java/org/opencv/video/Tracker.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.Mat; 7 | import org.opencv.core.Rect; 8 | 9 | // C++: class Tracker 10 | /** 11 | * Base abstract class for the long-term tracker 12 | */ 13 | public class Tracker { 14 | 15 | protected final long nativeObj; 16 | protected Tracker(long addr) { nativeObj = addr; } 17 | 18 | public long getNativeObjAddr() { return nativeObj; } 19 | 20 | // internal usage only 21 | public static Tracker __fromPtr__(long addr) { return new Tracker(addr); } 22 | 23 | // 24 | // C++: void cv::Tracker::init(Mat image, Rect boundingBox) 25 | // 26 | 27 | /** 28 | * Initialize the tracker with a known bounding box that surrounded the target 29 | * @param image The initial frame 30 | * @param boundingBox The initial bounding box 31 | */ 32 | public void init(Mat image, Rect boundingBox) { 33 | init_0(nativeObj, image.nativeObj, boundingBox.x, boundingBox.y, boundingBox.width, boundingBox.height); 34 | } 35 | 36 | 37 | // 38 | // C++: bool cv::Tracker::update(Mat image, Rect& boundingBox) 39 | // 40 | 41 | /** 42 | * Update the tracker, find the new most likely bounding box for the target 43 | * @param image The current frame 44 | * @param boundingBox The bounding box that represent the new target location, if true was returned, not 45 | * modified otherwise 46 | * 47 | * @return True means that target was located and false means that tracker cannot locate target in 48 | * current frame. Note, that latter *does not* imply that tracker has failed, maybe target is indeed 49 | * missing from the frame (say, out of sight) 50 | */ 51 | public boolean update(Mat image, Rect boundingBox) { 52 | double[] boundingBox_out = new double[4]; 53 | boolean retVal = update_0(nativeObj, image.nativeObj, boundingBox_out); 54 | if(boundingBox!=null){ boundingBox.x = (int)boundingBox_out[0]; boundingBox.y = (int)boundingBox_out[1]; boundingBox.width = (int)boundingBox_out[2]; boundingBox.height = (int)boundingBox_out[3]; } 55 | return retVal; 56 | } 57 | 58 | 59 | @Override 60 | protected void finalize() throws Throwable { 61 | delete(nativeObj); 62 | } 63 | 64 | 65 | 66 | // C++: void cv::Tracker::init(Mat image, Rect boundingBox) 67 | private static native void init_0(long nativeObj, long image_nativeObj, int boundingBox_x, int boundingBox_y, int boundingBox_width, int boundingBox_height); 68 | 69 | // C++: bool cv::Tracker::update(Mat image, Rect& boundingBox) 70 | private static native boolean update_0(long nativeObj, long image_nativeObj, double[] boundingBox_out); 71 | 72 | // native support for java finalize() 73 | private static native void delete(long nativeObj); 74 | 75 | } 76 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/java/org/opencv/video/TrackerDaSiamRPN.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file is auto-generated. Please don't modify it! 3 | // 4 | package org.opencv.video; 5 | 6 | import org.opencv.video.Tracker; 7 | import org.opencv.video.TrackerDaSiamRPN; 8 | import org.opencv.video.TrackerDaSiamRPN_Params; 9 | 10 | // C++: class TrackerDaSiamRPN 11 | 12 | public class TrackerDaSiamRPN extends Tracker { 13 | 14 | protected TrackerDaSiamRPN(long addr) { super(addr); } 15 | 16 | // internal usage only 17 | public static TrackerDaSiamRPN __fromPtr__(long addr) { return new TrackerDaSiamRPN(addr); } 18 | 19 | // 20 | // C++: static Ptr_TrackerDaSiamRPN cv::TrackerDaSiamRPN::create(TrackerDaSiamRPN_Params parameters = TrackerDaSiamRPN::Params()) 21 | // 22 | 23 | /** 24 | * Constructor 25 | * @param parameters DaSiamRPN parameters TrackerDaSiamRPN::Params 26 | * @return automatically generated 27 | */ 28 | public static TrackerDaSiamRPN create(TrackerDaSiamRPN_Params parameters) { 29 | return TrackerDaSiamRPN.__fromPtr__(create_0(parameters.nativeObj)); 30 | } 31 | 32 | /** 33 | * Constructor 34 | * @return automatically generated 35 | */ 36 | public static TrackerDaSiamRPN create() { 37 | return TrackerDaSiamRPN.__fromPtr__(create_1()); 38 | } 39 | 40 | 41 | // 42 | // C++: float cv::TrackerDaSiamRPN::getTrackingScore() 43 | // 44 | 45 | /** 46 | * Return tracking score 47 | * @return automatically generated 48 | */ 49 | public float getTrackingScore() { 50 | return getTrackingScore_0(nativeObj); 51 | } 52 | 53 | 54 | @Override 55 | protected void finalize() throws Throwable { 56 | delete(nativeObj); 57 | } 58 | 59 | 60 | 61 | // C++: static Ptr_TrackerDaSiamRPN cv::TrackerDaSiamRPN::create(TrackerDaSiamRPN_Params parameters = TrackerDaSiamRPN::Params()) 62 | private static native long create_0(long parameters_nativeObj); 63 | private static native long create_1(); 64 | 65 | // C++: float cv::TrackerDaSiamRPN::getTrackingScore() 66 | private static native float getTrackingScore_0(long nativeObj); 67 | 68 | // native support for java finalize() 69 | private static native void delete(long nativeObj); 70 | 71 | } 72 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/java/org/opencv/video/TrackerDaSiamRPN_Params.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file is auto-generated. Please don't modify it! 3 | // 4 | package org.opencv.video; 5 | 6 | 7 | 8 | // C++: class Params 9 | 10 | public class TrackerDaSiamRPN_Params { 11 | 12 | protected final long nativeObj; 13 | protected TrackerDaSiamRPN_Params(long addr) { nativeObj = addr; } 14 | 15 | public long getNativeObjAddr() { return nativeObj; } 16 | 17 | // internal usage only 18 | public static TrackerDaSiamRPN_Params __fromPtr__(long addr) { return new TrackerDaSiamRPN_Params(addr); } 19 | 20 | // 21 | // C++: cv::TrackerDaSiamRPN::Params::Params() 22 | // 23 | 24 | public TrackerDaSiamRPN_Params() { 25 | nativeObj = TrackerDaSiamRPN_Params_0(); 26 | } 27 | 28 | 29 | // 30 | // C++: string TrackerDaSiamRPN_Params::model 31 | // 32 | 33 | public String get_model() { 34 | return get_model_0(nativeObj); 35 | } 36 | 37 | 38 | // 39 | // C++: void TrackerDaSiamRPN_Params::model 40 | // 41 | 42 | public void set_model(String model) { 43 | set_model_0(nativeObj, model); 44 | } 45 | 46 | 47 | // 48 | // C++: string TrackerDaSiamRPN_Params::kernel_cls1 49 | // 50 | 51 | public String get_kernel_cls1() { 52 | return get_kernel_cls1_0(nativeObj); 53 | } 54 | 55 | 56 | // 57 | // C++: void TrackerDaSiamRPN_Params::kernel_cls1 58 | // 59 | 60 | public void set_kernel_cls1(String kernel_cls1) { 61 | set_kernel_cls1_0(nativeObj, kernel_cls1); 62 | } 63 | 64 | 65 | // 66 | // C++: string TrackerDaSiamRPN_Params::kernel_r1 67 | // 68 | 69 | public String get_kernel_r1() { 70 | return get_kernel_r1_0(nativeObj); 71 | } 72 | 73 | 74 | // 75 | // C++: void TrackerDaSiamRPN_Params::kernel_r1 76 | // 77 | 78 | public void set_kernel_r1(String kernel_r1) { 79 | set_kernel_r1_0(nativeObj, kernel_r1); 80 | } 81 | 82 | 83 | // 84 | // C++: int TrackerDaSiamRPN_Params::backend 85 | // 86 | 87 | public int get_backend() { 88 | return get_backend_0(nativeObj); 89 | } 90 | 91 | 92 | // 93 | // C++: void TrackerDaSiamRPN_Params::backend 94 | // 95 | 96 | public void set_backend(int backend) { 97 | set_backend_0(nativeObj, backend); 98 | } 99 | 100 | 101 | // 102 | // C++: int TrackerDaSiamRPN_Params::target 103 | // 104 | 105 | public int get_target() { 106 | return get_target_0(nativeObj); 107 | } 108 | 109 | 110 | // 111 | // C++: void TrackerDaSiamRPN_Params::target 112 | // 113 | 114 | public void set_target(int target) { 115 | set_target_0(nativeObj, target); 116 | } 117 | 118 | 119 | @Override 120 | protected void finalize() throws Throwable { 121 | delete(nativeObj); 122 | } 123 | 124 | 125 | 126 | // C++: cv::TrackerDaSiamRPN::Params::Params() 127 | private static native long TrackerDaSiamRPN_Params_0(); 128 | 129 | // C++: string TrackerDaSiamRPN_Params::model 130 | private static native String get_model_0(long nativeObj); 131 | 132 | // C++: void TrackerDaSiamRPN_Params::model 133 | private static native void set_model_0(long nativeObj, String model); 134 | 135 | // C++: string TrackerDaSiamRPN_Params::kernel_cls1 136 | private static native String get_kernel_cls1_0(long nativeObj); 137 | 138 | // C++: void TrackerDaSiamRPN_Params::kernel_cls1 139 | private static native void set_kernel_cls1_0(long nativeObj, String kernel_cls1); 140 | 141 | // C++: string TrackerDaSiamRPN_Params::kernel_r1 142 | private static native String get_kernel_r1_0(long nativeObj); 143 | 144 | // C++: void TrackerDaSiamRPN_Params::kernel_r1 145 | private static native void set_kernel_r1_0(long nativeObj, String kernel_r1); 146 | 147 | // C++: int TrackerDaSiamRPN_Params::backend 148 | private static native int get_backend_0(long nativeObj); 149 | 150 | // C++: void TrackerDaSiamRPN_Params::backend 151 | private static native void set_backend_0(long nativeObj, int backend); 152 | 153 | // C++: int TrackerDaSiamRPN_Params::target 154 | private static native int get_target_0(long nativeObj); 155 | 156 | // C++: void TrackerDaSiamRPN_Params::target 157 | private static native void set_target_0(long nativeObj, int target); 158 | 159 | // native support for java finalize() 160 | private static native void delete(long nativeObj); 161 | 162 | } 163 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/java/org/opencv/video/TrackerGOTURN.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file is auto-generated. Please don't modify it! 3 | // 4 | package org.opencv.video; 5 | 6 | import org.opencv.video.Tracker; 7 | import org.opencv.video.TrackerGOTURN; 8 | import org.opencv.video.TrackerGOTURN_Params; 9 | 10 | // C++: class TrackerGOTURN 11 | /** 12 | * the GOTURN (Generic Object Tracking Using Regression Networks) tracker 13 | * 14 | * GOTURN (CITE: GOTURN) is kind of trackers based on Convolutional Neural Networks (CNN). While taking all advantages of CNN trackers, 15 | * GOTURN is much faster due to offline training without online fine-tuning nature. 16 | * GOTURN tracker addresses the problem of single target tracking: given a bounding box label of an object in the first frame of the video, 17 | * we track that object through the rest of the video. NOTE: Current method of GOTURN does not handle occlusions; however, it is fairly 18 | * robust to viewpoint changes, lighting changes, and deformations. 19 | * Inputs of GOTURN are two RGB patches representing Target and Search patches resized to 227x227. 20 | * Outputs of GOTURN are predicted bounding box coordinates, relative to Search patch coordinate system, in format X1,Y1,X2,Y2. 21 | * Original paper is here: <http://davheld.github.io/GOTURN/GOTURN.pdf> 22 | * As long as original authors implementation: <https://github.com/davheld/GOTURN#train-the-tracker> 23 | * Implementation of training algorithm is placed in separately here due to 3d-party dependencies: 24 | * <https://github.com/Auron-X/GOTURN_Training_Toolkit> 25 | * GOTURN architecture goturn.prototxt and trained model goturn.caffemodel are accessible on opencv_extra GitHub repository. 26 | */ 27 | public class TrackerGOTURN extends Tracker { 28 | 29 | protected TrackerGOTURN(long addr) { super(addr); } 30 | 31 | // internal usage only 32 | public static TrackerGOTURN __fromPtr__(long addr) { return new TrackerGOTURN(addr); } 33 | 34 | // 35 | // C++: static Ptr_TrackerGOTURN cv::TrackerGOTURN::create(TrackerGOTURN_Params parameters = TrackerGOTURN::Params()) 36 | // 37 | 38 | /** 39 | * Constructor 40 | * @param parameters GOTURN parameters TrackerGOTURN::Params 41 | * @return automatically generated 42 | */ 43 | public static TrackerGOTURN create(TrackerGOTURN_Params parameters) { 44 | return TrackerGOTURN.__fromPtr__(create_0(parameters.nativeObj)); 45 | } 46 | 47 | /** 48 | * Constructor 49 | * @return automatically generated 50 | */ 51 | public static TrackerGOTURN create() { 52 | return TrackerGOTURN.__fromPtr__(create_1()); 53 | } 54 | 55 | 56 | @Override 57 | protected void finalize() throws Throwable { 58 | delete(nativeObj); 59 | } 60 | 61 | 62 | 63 | // C++: static Ptr_TrackerGOTURN cv::TrackerGOTURN::create(TrackerGOTURN_Params parameters = TrackerGOTURN::Params()) 64 | private static native long create_0(long parameters_nativeObj); 65 | private static native long create_1(); 66 | 67 | // native support for java finalize() 68 | private static native void delete(long nativeObj); 69 | 70 | } 71 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/java/org/opencv/video/TrackerGOTURN_Params.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file is auto-generated. Please don't modify it! 3 | // 4 | package org.opencv.video; 5 | 6 | 7 | 8 | // C++: class Params 9 | 10 | public class TrackerGOTURN_Params { 11 | 12 | protected final long nativeObj; 13 | protected TrackerGOTURN_Params(long addr) { nativeObj = addr; } 14 | 15 | public long getNativeObjAddr() { return nativeObj; } 16 | 17 | // internal usage only 18 | public static TrackerGOTURN_Params __fromPtr__(long addr) { return new TrackerGOTURN_Params(addr); } 19 | 20 | // 21 | // C++: cv::TrackerGOTURN::Params::Params() 22 | // 23 | 24 | public TrackerGOTURN_Params() { 25 | nativeObj = TrackerGOTURN_Params_0(); 26 | } 27 | 28 | 29 | // 30 | // C++: string TrackerGOTURN_Params::modelTxt 31 | // 32 | 33 | public String get_modelTxt() { 34 | return get_modelTxt_0(nativeObj); 35 | } 36 | 37 | 38 | // 39 | // C++: void TrackerGOTURN_Params::modelTxt 40 | // 41 | 42 | public void set_modelTxt(String modelTxt) { 43 | set_modelTxt_0(nativeObj, modelTxt); 44 | } 45 | 46 | 47 | // 48 | // C++: string TrackerGOTURN_Params::modelBin 49 | // 50 | 51 | public String get_modelBin() { 52 | return get_modelBin_0(nativeObj); 53 | } 54 | 55 | 56 | // 57 | // C++: void TrackerGOTURN_Params::modelBin 58 | // 59 | 60 | public void set_modelBin(String modelBin) { 61 | set_modelBin_0(nativeObj, modelBin); 62 | } 63 | 64 | 65 | @Override 66 | protected void finalize() throws Throwable { 67 | delete(nativeObj); 68 | } 69 | 70 | 71 | 72 | // C++: cv::TrackerGOTURN::Params::Params() 73 | private static native long TrackerGOTURN_Params_0(); 74 | 75 | // C++: string TrackerGOTURN_Params::modelTxt 76 | private static native String get_modelTxt_0(long nativeObj); 77 | 78 | // C++: void TrackerGOTURN_Params::modelTxt 79 | private static native void set_modelTxt_0(long nativeObj, String modelTxt); 80 | 81 | // C++: string TrackerGOTURN_Params::modelBin 82 | private static native String get_modelBin_0(long nativeObj); 83 | 84 | // C++: void TrackerGOTURN_Params::modelBin 85 | private static native void set_modelBin_0(long nativeObj, String modelBin); 86 | 87 | // native support for java finalize() 88 | private static native void delete(long nativeObj); 89 | 90 | } 91 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/java/org/opencv/video/TrackerMIL.java: -------------------------------------------------------------------------------- 1 | // 2 | // This file is auto-generated. Please don't modify it! 3 | // 4 | package org.opencv.video; 5 | 6 | import org.opencv.video.Tracker; 7 | import org.opencv.video.TrackerMIL; 8 | import org.opencv.video.TrackerMIL_Params; 9 | 10 | // C++: class TrackerMIL 11 | /** 12 | * The MIL algorithm trains a classifier in an online manner to separate the object from the 13 | * background. 14 | * 15 | * Multiple Instance Learning avoids the drift problem for a robust tracking. The implementation is 16 | * based on CITE: MIL . 17 | * 18 | * Original code can be found here <http://vision.ucsd.edu/~bbabenko/project_miltrack.shtml> 19 | */ 20 | public class TrackerMIL extends Tracker { 21 | 22 | protected TrackerMIL(long addr) { super(addr); } 23 | 24 | // internal usage only 25 | public static TrackerMIL __fromPtr__(long addr) { return new TrackerMIL(addr); } 26 | 27 | // 28 | // C++: static Ptr_TrackerMIL cv::TrackerMIL::create(TrackerMIL_Params parameters = TrackerMIL::Params()) 29 | // 30 | 31 | /** 32 | * Create MIL tracker instance 33 | * @param parameters MIL parameters TrackerMIL::Params 34 | * @return automatically generated 35 | */ 36 | public static TrackerMIL create(TrackerMIL_Params parameters) { 37 | return TrackerMIL.__fromPtr__(create_0(parameters.nativeObj)); 38 | } 39 | 40 | /** 41 | * Create MIL tracker instance 42 | * @return automatically generated 43 | */ 44 | public static TrackerMIL create() { 45 | return TrackerMIL.__fromPtr__(create_1()); 46 | } 47 | 48 | 49 | @Override 50 | protected void finalize() throws Throwable { 51 | delete(nativeObj); 52 | } 53 | 54 | 55 | 56 | // C++: static Ptr_TrackerMIL cv::TrackerMIL::create(TrackerMIL_Params parameters = TrackerMIL::Params()) 57 | private static native long create_0(long parameters_nativeObj); 58 | private static native long create_1(); 59 | 60 | // native support for java finalize() 61 | private static native void delete(long nativeObj); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /android/openCVLibrary455/src/main/resources/org/opencv/core/MatMatMul.kt: -------------------------------------------------------------------------------- 1 | package org.opencv.core 2 | 3 | operator fun Mat.times(other: Mat): Mat = this.matMul(other) 4 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':openCVLibrary455' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /android/src/main/java/fr/michaelvilleneuve/customcrop/RNCustomCropPackage.java: -------------------------------------------------------------------------------- 1 | 2 | package fr.michaelvilleneuve.customcrop; 3 | 4 | import java.util.Arrays; 5 | import java.util.Collections; 6 | 7 | import java.util.List; 8 | 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.react.bridge.NativeModule; 11 | import com.facebook.react.bridge.ReactApplicationContext; 12 | import com.facebook.react.uimanager.ViewManager; 13 | import com.facebook.react.bridge.JavaScriptModule; 14 | public class RNCustomCropPackage implements ReactPackage { 15 | public List createNativeModules(ReactApplicationContext reactContext) { 16 | return Arrays.asList(new RNCustomCropModule(reactContext)); 17 | } 18 | 19 | public List> createJSModules() { 20 | return Collections.emptyList(); 21 | } 22 | 23 | public List createViewManagers(ReactApplicationContext reactContext) { 24 | return Collections.emptyList(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /android/src/main/java/fr/michaelvilleneuve/helpers/AppConstant.java: -------------------------------------------------------------------------------- 1 | package fr.michaelvilleneuve.helpers; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class AppConstant { 7 | 8 | // supported file formats 9 | public static final List FILE_EXTN = Arrays.asList("jpg", "jpeg", "png"); 10 | } 11 | -------------------------------------------------------------------------------- /android/src/main/java/fr/michaelvilleneuve/helpers/Quadrilateral.java: -------------------------------------------------------------------------------- 1 | package fr.michaelvilleneuve.helpers; 2 | 3 | import org.opencv.core.MatOfPoint; 4 | import org.opencv.core.Point; 5 | 6 | /** 7 | * Created by allgood on 05/03/16. 8 | */ 9 | public class Quadrilateral { 10 | public MatOfPoint contour; 11 | public Point[] points; 12 | 13 | public Quadrilateral(MatOfPoint contour, Point[] points) { 14 | this.contour = contour; 15 | this.points = points; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /android/src/main/java/fr/michaelvilleneuve/helpers/ScannedDocument.java: -------------------------------------------------------------------------------- 1 | package fr.michaelvilleneuve.helpers; 2 | 3 | import com.facebook.react.bridge.WritableMap; 4 | import com.facebook.react.bridge.WritableNativeMap; 5 | 6 | import org.opencv.core.Mat; 7 | import org.opencv.core.Point; 8 | import org.opencv.core.Size; 9 | 10 | /** 11 | * Created by allgood on 05/03/16. 12 | */ 13 | public class ScannedDocument { 14 | 15 | public Mat original; 16 | public Mat processed; 17 | public Quadrilateral quadrilateral; 18 | public Point[] previewPoints; 19 | public Size previewSize; 20 | public Size originalSize; 21 | 22 | public Point[] originalPoints; 23 | 24 | public int heightWithRatio; 25 | public int widthWithRatio; 26 | 27 | public ScannedDocument(Mat original) { 28 | this.original = original; 29 | } 30 | 31 | public Mat getProcessed() { 32 | return processed; 33 | } 34 | 35 | public ScannedDocument setProcessed(Mat processed) { 36 | this.processed = processed; 37 | return this; 38 | } 39 | 40 | public WritableMap pointsAsHash() { 41 | if (this.originalPoints == null) { 42 | return null; 43 | } 44 | 45 | WritableMap rectangleCoordinates = new WritableNativeMap(); 46 | 47 | WritableMap topLeft = new WritableNativeMap(); 48 | topLeft.putDouble("x", this.originalPoints[0].x); 49 | topLeft.putDouble("y", this.originalPoints[0].y); 50 | 51 | WritableMap topRight = new WritableNativeMap(); 52 | topRight.putDouble("x", this.originalPoints[1].x); 53 | topRight.putDouble("y", this.originalPoints[1].y); 54 | 55 | WritableMap bottomRight = new WritableNativeMap(); 56 | bottomRight.putDouble("x", this.originalPoints[2].x); 57 | bottomRight.putDouble("y", this.originalPoints[2].y); 58 | 59 | WritableMap bottomLeft = new WritableNativeMap(); 60 | bottomLeft.putDouble("x", this.originalPoints[3].x); 61 | bottomLeft.putDouble("y", this.originalPoints[3].y); 62 | 63 | rectangleCoordinates.putMap("topLeft", topLeft); 64 | rectangleCoordinates.putMap("topRight", topRight); 65 | rectangleCoordinates.putMap("bottomRight", bottomRight); 66 | rectangleCoordinates.putMap("bottomLeft", bottomLeft); 67 | 68 | return rectangleCoordinates; 69 | } 70 | 71 | public void release() { 72 | if (processed != null) { 73 | processed.release(); 74 | } 75 | if (original != null) { 76 | original.release(); 77 | } 78 | 79 | if (quadrilateral != null && quadrilateral.contour != null) { 80 | quadrilateral.contour.release(); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /android/src/main/jniLibs/arm64-v8a/libopencv_java4.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datobs/react-native-perspective-image-cropper/8319eac9e42fdb0781f30862a303ddc882899bfb/android/src/main/jniLibs/arm64-v8a/libopencv_java4.so -------------------------------------------------------------------------------- /android/src/main/jniLibs/armeabi-v7a/libopencv_java4.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datobs/react-native-perspective-image-cropper/8319eac9e42fdb0781f30862a303ddc882899bfb/android/src/main/jniLibs/armeabi-v7a/libopencv_java4.so -------------------------------------------------------------------------------- /android/src/main/jniLibs/x86/libopencv_java4.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datobs/react-native-perspective-image-cropper/8319eac9e42fdb0781f30862a303ddc882899bfb/android/src/main/jniLibs/x86/libopencv_java4.so -------------------------------------------------------------------------------- /android/src/main/jniLibs/x86_64/libopencv_java4.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/datobs/react-native-perspective-image-cropper/8319eac9e42fdb0781f30862a303ddc882899bfb/android/src/main/jniLibs/x86_64/libopencv_java4.so -------------------------------------------------------------------------------- /ios/CustomCropManager.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface CustomCropManager : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /ios/CustomCropManager.mm: -------------------------------------------------------------------------------- 1 | #import "CustomCropManager.h" 2 | #import 3 | 4 | @implementation CustomCropManager 5 | 6 | RCT_EXPORT_MODULE(); 7 | 8 | RCT_EXPORT_METHOD(crop:(NSDictionary *)points imageUri:(NSString *)imageUri callback:(RCTResponseSenderBlock)callback) 9 | { 10 | NSString *parsedImageUri = [imageUri stringByReplacingOccurrencesOfString:@"file://" withString:@""]; 11 | NSURL *fileURL = [NSURL fileURLWithPath:parsedImageUri]; 12 | CIImage *ciImage = [CIImage imageWithContentsOfURL:fileURL]; 13 | 14 | CGPoint newLeft = CGPointMake([points[@"topLeft"][@"x"] floatValue], [points[@"topLeft"][@"y"] floatValue]); 15 | CGPoint newRight = CGPointMake([points[@"topRight"][@"x"] floatValue], [points[@"topRight"][@"y"] floatValue]); 16 | CGPoint newBottomLeft = CGPointMake([points[@"bottomLeft"][@"x"] floatValue], [points[@"bottomLeft"][@"y"] floatValue]); 17 | CGPoint newBottomRight = CGPointMake([points[@"bottomRight"][@"x"] floatValue], [points[@"bottomRight"][@"y"] floatValue]); 18 | 19 | newLeft = [self cartesianForPoint:newLeft height:[points[@"height"] floatValue] ]; 20 | newRight = [self cartesianForPoint:newRight height:[points[@"height"] floatValue] ]; 21 | newBottomLeft = [self cartesianForPoint:newBottomLeft height:[points[@"height"] floatValue] ]; 22 | newBottomRight = [self cartesianForPoint:newBottomRight height:[points[@"height"] floatValue] ]; 23 | 24 | 25 | 26 | NSMutableDictionary *rectangleCoordinates = [[NSMutableDictionary alloc] init]; 27 | 28 | rectangleCoordinates[@"inputTopLeft"] = [CIVector vectorWithCGPoint:newLeft]; 29 | rectangleCoordinates[@"inputTopRight"] = [CIVector vectorWithCGPoint:newRight]; 30 | rectangleCoordinates[@"inputBottomLeft"] = [CIVector vectorWithCGPoint:newBottomLeft]; 31 | rectangleCoordinates[@"inputBottomRight"] = [CIVector vectorWithCGPoint:newBottomRight]; 32 | 33 | ciImage = [ciImage imageByApplyingFilter:@"CIPerspectiveCorrection" withInputParameters:rectangleCoordinates]; 34 | 35 | CIContext *context = [CIContext contextWithOptions:nil]; 36 | CGImageRef cgimage = [context createCGImage:ciImage fromRect:[ciImage extent]]; 37 | UIImage *image = [UIImage imageWithCGImage:cgimage]; 38 | 39 | NSData *imageToEncode = UIImageJPEGRepresentation(image, 0.8); 40 | callback(@[[NSNull null], @{@"image": [imageToEncode base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]}]); 41 | } 42 | 43 | - (CGPoint)cartesianForPoint:(CGPoint)point height:(float)height { 44 | return CGPointMake(point.x, height - point.y); 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@datobs/react-native-perspective-image-cropper", 3 | "version": "0.4.13", 4 | "description": "React native library allowing you to make custom crop and perspective corrections on photos", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "scripts": { 8 | "build": "tsc --project tsconfig.json", 9 | "prepublishOnly": "npm run build" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/datobs/react-native-perspective-image-cropper" 14 | }, 15 | "keywords": [ 16 | "react-native", 17 | "scanner", 18 | "crop" 19 | ], 20 | "author": "Michaël Villeneuve", 21 | "license": "MIT", 22 | "peerDependencies": { 23 | "react": "^17.0.2 || ^18.0.0 || ^19.0.0", 24 | "react-native": ">=0.70", 25 | "react-native-svg": "^15.3.0" 26 | }, 27 | "devDependencies": { 28 | "@types/react": "^18.2.33", 29 | "@types/react-native": "^0.72.5", 30 | "react": "^18.2.0", 31 | "react-native": "^0.72.6", 32 | "react-native-svg": "^15.3.0", 33 | "typescript": "^5.2.2" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /react-native-perspective-image-cropper.podspec: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = package["name"] 7 | s.version = package["version"] 8 | s.summary = package["description"] 9 | s.homepage = "https://github.com/Michaelvilleneuve/react-native-perspective-image-cropper" 10 | s.license = package["license"] 11 | s.authors = package["author"] 12 | s.platform = :ios, "9.0" 13 | s.source = { :git => "#{s.homepage}", :tag => "v#{s.version}" } 14 | s.source_files = "ios/**/*.{h,m,mm}" 15 | s.requires_arc = true 16 | s.dependency 'React' 17 | end -------------------------------------------------------------------------------- /react-native.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | dependency: { 3 | platforms: { 4 | android: { 5 | packageImportPath: 'import fr.michaelvilleneuve.customcrop.RNCustomCropPackage;', 6 | packageInstance: 'new RNCustomCropPackage()', 7 | }, 8 | }, 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /src/types.ts: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Animated } from 'react-native'; 3 | import { Polygon } from 'react-native-svg'; 4 | import type { PanResponderInstance } from 'react-native'; 5 | 6 | export interface CropResult { 7 | path: string; 8 | } 9 | 10 | export interface AnimatedCoordinates { 11 | bottomLeft: Animated.ValueXY; 12 | bottomRight: Animated.ValueXY; 13 | topLeft: Animated.ValueXY; 14 | topRight: Animated.ValueXY; 15 | } 16 | 17 | export interface Coordinates { 18 | bottomLeft: ValueXY; 19 | bottomRight: ValueXY; 20 | topLeft: ValueXY; 21 | topRight: ValueXY; 22 | } 23 | 24 | export interface CreatePanResponserArgs { 25 | corner: Animated.ValueXY; 26 | state: State; 27 | } 28 | 29 | export interface CropArgs { 30 | props: Props; 31 | state: State; 32 | } 33 | 34 | export interface GetInitialCoordinateValueArgs { 35 | corner: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight'; 36 | props: Props; 37 | state: State; 38 | } 39 | 40 | export interface GetOverlayPositionsArgs extends AnimatedCoordinates { 41 | 42 | } 43 | 44 | export interface ImageCoordinatesToViewCoordinatesArgs { 45 | corner: ValueXY; 46 | state: State; 47 | } 48 | 49 | export interface Props { 50 | handlerColor?: string; 51 | height: number; 52 | overlayColor?: string; 53 | overlayOpacity?: number; 54 | overlayStrokeColor?: string; 55 | overlayStrokeWidth?: number; 56 | path: string; 57 | rectangleCoordinates?: Coordinates; 58 | updateImage: (path: string, coordinates: Coordinates) => void; 59 | width: number; 60 | } 61 | 62 | export type Ref = { crop: any }; 63 | 64 | export interface State { 65 | corners: AnimatedCoordinates; 66 | height: number; 67 | moving: boolean; 68 | overlayPositions: number[]; 69 | setCorners: StateSetter; 70 | setHeight: StateSetter; 71 | setMoving: StateSetter; 72 | setOverlayPositions: StateSetter; 73 | setViewHeight: StateSetter; 74 | setWidth: StateSetter; 75 | viewHeight: number; 76 | width: number; 77 | } 78 | 79 | export type StateSetter = React.Dispatch>; 80 | 81 | export interface UpdateOverlayStringArgs { 82 | state: State; 83 | } 84 | 85 | export interface ValueXY { 86 | x: number; 87 | y: number; 88 | } 89 | 90 | export interface Vars { 91 | panResponderBottomLeft: React.MutableRefObject; 92 | panResponderBottomRight: React.MutableRefObject; 93 | panResponderTopLeft: React.MutableRefObject; 94 | panResponderTopRight: React.MutableRefObject; 95 | polygonRef: React.MutableRefObject; 96 | } 97 | 98 | export interface ViewCoordinatesToImageCoordinatesArgs { 99 | corner: ValueXY; 100 | state: State; 101 | } 102 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "declaration": true, 5 | "skipLibCheck": true, 6 | "esModuleInterop": true, 7 | "strict": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "jsx": "react", 10 | "outDir": "./dist", 11 | }, 12 | "include": ["src/index.tsx"] 13 | } 14 | --------------------------------------------------------------------------------