├── ftc-visionlib ├── .gitignore ├── libs │ ├── README.txt │ ├── RobotCore-release.aar │ └── NOTICE_RobotCore.txt ├── src │ └── main │ │ ├── res │ │ └── values │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── org │ │ └── lasarobotics │ │ └── vision │ │ ├── opmode │ │ ├── extensions │ │ │ ├── VisionExtension.java │ │ │ └── package-info.java │ │ ├── ManualVisionOpMode.java │ │ ├── TestableVisionOpMode.java │ │ └── package-info.java │ │ ├── util │ │ ├── Vector3.java │ │ ├── package-info.java │ │ ├── color │ │ │ ├── package-info.java │ │ │ ├── ColorGRAY.java │ │ │ ├── ColorHSV.java │ │ │ └── ColorSpace.java │ │ ├── FPS.java │ │ ├── IO.java │ │ ├── RollingAverage.java │ │ └── ScreenOrientation.java │ │ ├── android │ │ ├── package-info.java │ │ └── Cameras.java │ │ ├── image │ │ ├── package-info.java │ │ └── Filter.java │ │ ├── detection │ │ ├── objects │ │ │ └── package-info.java │ │ └── package-info.java │ │ ├── ftc │ │ └── resq │ │ │ ├── package-info.java │ │ │ └── Constants.java │ │ └── package-info.java ├── build.gradle └── proguard-rules.pro ├── ftc-cameratest ├── libs │ ├── README.txt │ ├── d2xx.jar │ ├── Hardware-release.aar │ ├── Analytics-release.aar │ ├── FtcCommon-release.aar │ ├── RobotCore-release.aar │ ├── WirelessP2p-release.aar │ ├── ModernRobotics-release.aar │ ├── NOTICE_Analytics.txt │ ├── NOTICE_WirelessP2p.txt │ ├── NOTICE_ModernRobotics.txt │ ├── NOTICE_FtcCommon.txt │ └── NOTICE_RobotCore.txt ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ └── strings.xml │ │ └── layout │ │ │ └── activity_cameratest.xml │ │ ├── java │ │ └── com │ │ │ └── lasarobotics │ │ │ └── tests │ │ │ └── camera │ │ │ └── CameraTestActivity.java │ │ └── AndroidManifest.xml └── build.gradle ├── ftc-robotcontroller ├── libs │ ├── README.txt │ ├── Hardware-release.aar │ ├── Analytics-release.aar │ ├── FtcCommon-release.aar │ ├── RobotCore-release.aar │ ├── WirelessP2p-release.aar │ └── ModernRobotics-release.aar ├── src │ └── main │ │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ ├── icon_menu.png │ │ │ ├── ic_launcher.png │ │ │ └── icon_robotcontroller.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── xml │ │ │ └── device_filter.xml │ │ ├── values │ │ │ ├── dimens.xml │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ ├── values-sw600dp │ │ │ └── dimens.xml │ │ ├── values-sw720dp-land │ │ │ └── dimens.xml │ │ ├── values-v11 │ │ │ └── styles.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ ├── values-v14 │ │ │ └── styles.xml │ │ ├── menu │ │ │ └── ftc_robot_controller.xml │ │ └── layout │ │ │ └── header.xml │ │ └── java │ │ └── com │ │ └── qualcomm │ │ └── ftcrobotcontroller │ │ ├── opmodes │ │ ├── package-info.java │ │ ├── FtcOpModeRegister.java │ │ └── NullOp.java │ │ └── package-info.java └── build.gradle ├── settings.gradle ├── opencv-java ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── org │ │ │ └── opencv │ │ │ ├── core │ │ │ ├── CvException.java │ │ │ ├── DMatch.java │ │ │ ├── Point.java │ │ │ ├── Algorithm.java │ │ │ ├── Size.java │ │ │ ├── Point3.java │ │ │ ├── Range.java │ │ │ ├── MatOfPoint.java │ │ │ ├── MatOfPoint2f.java │ │ │ ├── MatOfByte.java │ │ │ ├── MatOfInt.java │ │ │ ├── MatOfInt4.java │ │ │ ├── MatOfFloat.java │ │ │ ├── MatOfFloat4.java │ │ │ ├── MatOfFloat6.java │ │ │ ├── MatOfDouble.java │ │ │ ├── MatOfPoint3.java │ │ │ ├── MatOfRect.java │ │ │ ├── MatOfPoint3f.java │ │ │ ├── Scalar.java │ │ │ ├── KeyPoint.java │ │ │ ├── MatOfDMatch.java │ │ │ ├── MatOfKeyPoint.java │ │ │ ├── TermCriteria.java │ │ │ └── Rect.java │ │ │ ├── ml │ │ │ ├── Ml.java │ │ │ └── NormalBayesClassifier.java │ │ │ ├── video │ │ │ ├── DualTVL1OpticalFlow.java │ │ │ ├── DenseOpticalFlow.java │ │ │ └── BackgroundSubtractor.java │ │ │ ├── objdetect │ │ │ ├── BaseCascadeClassifier.java │ │ │ └── Objdetect.java │ │ │ ├── android │ │ │ ├── InstallCallbackInterface.java │ │ │ ├── LoaderCallbackInterface.java │ │ │ ├── FpsMeter.java │ │ │ ├── StaticHelper.java │ │ │ └── OpenCVLoader.java │ │ │ ├── photo │ │ │ ├── CalibrateCRF.java │ │ │ ├── MergeExposures.java │ │ │ ├── AlignExposures.java │ │ │ ├── Tonemap.java │ │ │ ├── MergeDebevec.java │ │ │ ├── MergeRobertson.java │ │ │ ├── TonemapDrago.java │ │ │ ├── TonemapMantiuk.java │ │ │ ├── CalibrateRobertson.java │ │ │ ├── CalibrateDebevec.java │ │ │ └── TonemapReinhard.java │ │ │ └── imgproc │ │ │ └── CLAHE.java │ │ ├── res │ │ └── values │ │ │ └── attrs.xml │ │ └── aidl │ │ └── org │ │ └── opencv │ │ └── engine │ │ └── OpenCVEngineInterface.aidl ├── lint.xml └── build.gradle ├── .travis.yml ├── .gitignore ├── gradle.properties └── LICENSE /ftc-visionlib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /ftc-cameratest/libs/README.txt: -------------------------------------------------------------------------------- 1 | Location of external libs 2 | -------------------------------------------------------------------------------- /ftc-visionlib/libs/README.txt: -------------------------------------------------------------------------------- 1 | Location of external libs 2 | -------------------------------------------------------------------------------- /ftc-robotcontroller/libs/README.txt: -------------------------------------------------------------------------------- 1 | Location of external libs 2 | -------------------------------------------------------------------------------- /ftc-cameratest/libs/d2xx.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/libs/d2xx.jar -------------------------------------------------------------------------------- /ftc-cameratest/libs/Hardware-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/libs/Hardware-release.aar -------------------------------------------------------------------------------- /ftc-visionlib/libs/RobotCore-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-visionlib/libs/RobotCore-release.aar -------------------------------------------------------------------------------- /ftc-visionlib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FTCVision Library 3 | 4 | -------------------------------------------------------------------------------- /ftc-cameratest/libs/Analytics-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/libs/Analytics-release.aar -------------------------------------------------------------------------------- /ftc-cameratest/libs/FtcCommon-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/libs/FtcCommon-release.aar -------------------------------------------------------------------------------- /ftc-cameratest/libs/RobotCore-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/libs/RobotCore-release.aar -------------------------------------------------------------------------------- /ftc-cameratest/libs/WirelessP2p-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/libs/WirelessP2p-release.aar -------------------------------------------------------------------------------- /ftc-robotcontroller/libs/Hardware-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/libs/Hardware-release.aar -------------------------------------------------------------------------------- /ftc-cameratest/libs/ModernRobotics-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/libs/ModernRobotics-release.aar -------------------------------------------------------------------------------- /ftc-robotcontroller/libs/Analytics-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/libs/Analytics-release.aar -------------------------------------------------------------------------------- /ftc-robotcontroller/libs/FtcCommon-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/libs/FtcCommon-release.aar -------------------------------------------------------------------------------- /ftc-robotcontroller/libs/RobotCore-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/libs/RobotCore-release.aar -------------------------------------------------------------------------------- /ftc-robotcontroller/libs/WirelessP2p-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/libs/WirelessP2p-release.aar -------------------------------------------------------------------------------- /ftc-robotcontroller/libs/ModernRobotics-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/libs/ModernRobotics-release.aar -------------------------------------------------------------------------------- /ftc-cameratest/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ftc-cameratest/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ftc-cameratest/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ftc-cameratest/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ftc-cameratest/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-cameratest/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ftc-cameratest/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FTCVision Camera 4 | 5 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/drawable-xhdpi/icon_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/src/main/res/drawable-xhdpi/icon_menu.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | //Libraries 2 | include ':opencv-java' 3 | include ':ftc-visionlib' 4 | 5 | //Demos and Tests 6 | include ':ftc-cameratest' 7 | include ':ftc-robotcontroller' 8 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/drawable-xhdpi/icon_robotcontroller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lasarobotics/FTCVision/HEAD/ftc-robotcontroller/src/main/res/drawable-xhdpi/icon_robotcontroller.png -------------------------------------------------------------------------------- /opencv-java/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /opencv-java/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | android: 3 | components: 4 | - platform-tools 5 | - tools 6 | - build-tools-23.0.3 7 | - android-23 8 | before_script: 9 | - wget http://services.gradle.org/distributions/gradle-2.14.1-bin.zip 10 | - unzip gradle-2.14.1-bin.zip 11 | - export GRADLE_HOME=$PWD/gradle-2.14.1 12 | - export PATH=$GRADLE_HOME/bin:$PATH 13 | -------------------------------------------------------------------------------- /opencv-java/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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Java class files 6 | *.class 7 | 8 | # generated files 9 | bin/ 10 | gen/ 11 | jniLibs/ 12 | doxygen/ 13 | docs/ 14 | 15 | # Local configuration file (sdk path, etc) 16 | local.properties 17 | 18 | # Windows thumbnail db 19 | Thumbs.db 20 | 21 | # OSX files 22 | .DS_Store 23 | 24 | # Android Studio 25 | *.iml 26 | .idea 27 | .gradle 28 | build/ 29 | gradle* 30 | -------------------------------------------------------------------------------- /ftc-cameratest/src/main/res/layout/activity_cameratest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /opencv-java/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/ml/Ml.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | 8 | 9 | public class Ml { 10 | 11 | public static final int 12 | VAR_NUMERICAL = 0, 13 | VAR_ORDERED = 0, 14 | VAR_CATEGORICAL = 1, 15 | TEST_ERROR = 0, 16 | TRAIN_ERROR = 1, 17 | ROW_SAMPLE = 0, 18 | COL_SAMPLE = 1; 19 | 20 | 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /opencv-java/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 21 5 | buildToolsVersion "21.1.2" 6 | 7 | defaultConfig { 8 | minSdkVersion 16 9 | targetSdkVersion 16 10 | versionCode 3 11 | versionName "3.0.0" 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 18 | } 19 | } 20 | 21 | lintOptions { 22 | abortOnError false 23 | } 24 | } -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/video/DualTVL1OpticalFlow.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | 8 | 9 | // C++: class DualTVL1OpticalFlow 10 | //javadoc: DualTVL1OpticalFlow 11 | public class DualTVL1OpticalFlow extends DenseOpticalFlow { 12 | 13 | protected DualTVL1OpticalFlow(long addr) { super(addr); } 14 | 15 | 16 | @Override 17 | protected void finalize() throws Throwable { 18 | delete(nativeObj); 19 | } 20 | 21 | 22 | 23 | // native support for java finalize() 24 | private static native void delete(long nativeObj); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/opmode/extensions/VisionExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | */ 5 | package org.lasarobotics.vision.opmode.extensions; 6 | 7 | import org.lasarobotics.vision.opmode.VisionOpMode; 8 | import org.opencv.core.Mat; 9 | 10 | /** 11 | * Interface for vision extensions for VisionOpMode 12 | */ 13 | public interface VisionExtension { 14 | void init(VisionOpMode opmode); 15 | 16 | void loop(VisionOpMode opmode); 17 | 18 | Mat frame(VisionOpMode opmode, Mat rgba, Mat gray); 19 | 20 | void stop(VisionOpMode opmode); 21 | } 22 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/objdetect/BaseCascadeClassifier.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.objdetect; 6 | 7 | import org.opencv.core.Algorithm; 8 | 9 | // C++: class BaseCascadeClassifier 10 | //javadoc: BaseCascadeClassifier 11 | public class BaseCascadeClassifier extends Algorithm { 12 | 13 | protected BaseCascadeClassifier(long addr) { super(addr); } 14 | 15 | 16 | @Override 17 | protected void finalize() throws Throwable { 18 | delete(nativeObj); 19 | } 20 | 21 | 22 | 23 | // native support for java finalize() 24 | private static native void delete(long nativeObj); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ftc-cameratest/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion '23.0.3' 6 | 7 | defaultConfig { 8 | applicationId "org.lasarobotics.tests.camera" 9 | minSdkVersion 16 10 | targetSdkVersion 16 11 | } 12 | 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 | } 18 | } 19 | } 20 | 21 | repositories { 22 | flatDir { 23 | dirs 'libs' 24 | } 25 | } 26 | 27 | dependencies { 28 | compile project(':opencv-java') 29 | compile project(':ftc-visionlib') 30 | } -------------------------------------------------------------------------------- /ftc-visionlib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion '23.0.3' 6 | 7 | defaultConfig { 8 | minSdkVersion 16 9 | targetSdkVersion 16 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | repositories { 22 | flatDir { 23 | dirs 'libs' 24 | } 25 | } 26 | 27 | dependencies { 28 | compile(name: 'RobotCore-release', ext: 'aar') 29 | compile project(':opencv-java') 30 | } 31 | 32 | -------------------------------------------------------------------------------- /ftc-visionlib/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/arthur/Android/Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /opencv-java/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 | int NEW_INSTALLATION = 0; 12 | /** 13 | * Current package installation is in progress. 14 | */ 15 | int INSTALLATION_PROGRESS = 1; 16 | 17 | /** 18 | * Target package name. 19 | * @return Return target package name. 20 | */ 21 | String getPackageName(); 22 | /** 23 | * Installation is approved. 24 | */ 25 | void install(); 26 | /** 27 | * Installation is canceled. 28 | */ 29 | void cancel(); 30 | /** 31 | * Wait for package installation. 32 | */ 33 | void wait_install(); 34 | } 35 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/opmode/ManualVisionOpMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | */ 5 | package org.lasarobotics.vision.opmode; 6 | 7 | import org.opencv.core.Mat; 8 | 9 | public abstract class ManualVisionOpMode extends VisionOpModeCore { 10 | public final Mat frame(Mat rgba, Mat gray, boolean ready) { 11 | return frame(rgba, gray); 12 | } 13 | 14 | /** 15 | * Returns every frame an image received from the camera. 16 | * If your method runs for too long, frames will be skipped (this is normal behaviour, reducing 17 | * FPS). 18 | * 19 | * @param rgba RGBA image 20 | * @param gray Grayscale image 21 | * @return Return an image to draw onto the screen 22 | */ 23 | public abstract Mat frame(Mat rgba, Mat gray); 24 | } 25 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/opmode/TestableVisionOpMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | */ 5 | 6 | package org.lasarobotics.vision.opmode; 7 | 8 | /** 9 | * Vision Op Mode designed ONLY for testing applications, such as the Camera Test Activity 10 | * This OpMode essentially unifies testing applications and the robot controller 11 | */ 12 | public abstract class TestableVisionOpMode extends VisionOpMode { 13 | 14 | /** 15 | * Creates the Testable OpMode. 16 | */ 17 | public TestableVisionOpMode() { 18 | super(false); //disable OpenCV core functions 19 | } 20 | 21 | @Override 22 | public void init() { 23 | super.init(); 24 | } 25 | 26 | @Override 27 | public void loop() { 28 | super.loop(); 29 | } 30 | 31 | @Override 32 | public void stop() { 33 | super.stop(); 34 | } 35 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | #android.useDeprecatedNdk = true -------------------------------------------------------------------------------- /ftc-cameratest/libs/NOTICE_Analytics.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, 2015 Qualcomm Technologies, Inc. All rights reserved. 2 | Confidential & Proprietary - Qualcomm Technologies, Inc. ("QTI") 3 | 4 | The party receiving this software directly from QTI (the "Recipient") may use this software as 5 | reasonably necessary solely for the purposes set forth in the agreement between the Recipient and 6 | QTI (the "Agreement"). The software may be used in source code form solely by the Recipient's 7 | employees (if any) authorized by the Agreement. Unless expressly authorized in the Agreement, the 8 | Recipient may not sublicense, assign, transfer or otherwise provide the source code to any third 9 | party. Qualcomm Technologies, Inc. retains all ownership rights in and to the software 10 | 11 | This notice supersedes any other QTI notices contained within the software except copyright 12 | notices indicating different years of publication for different portions of the software. This 13 | notice does not supersede the application of any third party copyright notice to that third 14 | party's code. 15 | 16 | -------------------------------------------------------------------------------- /ftc-cameratest/libs/NOTICE_WirelessP2p.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, 2015 Qualcomm Technologies, Inc. All rights reserved. 2 | Confidential & Proprietary - Qualcomm Technologies, Inc. ("QTI") 3 | 4 | The party receiving this software directly from QTI (the "Recipient") may use this software as 5 | reasonably necessary solely for the purposes set forth in the agreement between the Recipient and 6 | QTI (the "Agreement"). The software may be used in source code form solely by the Recipient's 7 | employees (if any) authorized by the Agreement. Unless expressly authorized in the Agreement, the 8 | Recipient may not sublicense, assign, transfer or otherwise provide the source code to any third 9 | party. Qualcomm Technologies, Inc. retains all ownership rights in and to the software 10 | 11 | This notice supersedes any other QTI notices contained within the software except copyright 12 | notices indicating different years of publication for different portions of the software. This 13 | notice does not supersede the application of any third party copyright notice to that third 14 | party's code. 15 | 16 | -------------------------------------------------------------------------------- /ftc-cameratest/libs/NOTICE_ModernRobotics.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, 2015 Qualcomm Technologies, Inc. All rights reserved. 2 | Confidential & Proprietary - Qualcomm Technologies, Inc. ("QTI") 3 | 4 | The party receiving this software directly from QTI (the "Recipient") may use this software as 5 | reasonably necessary solely for the purposes set forth in the agreement between the Recipient and 6 | QTI (the "Agreement"). The software may be used in source code form solely by the Recipient's 7 | employees (if any) authorized by the Agreement. Unless expressly authorized in the Agreement, the 8 | Recipient may not sublicense, assign, transfer or otherwise provide the source code to any third 9 | party. Qualcomm Technologies, Inc. retains all ownership rights in and to the software 10 | 11 | This notice supersedes any other QTI notices contained within the software except copyright 12 | notices indicating different years of publication for different portions of the software. This 13 | notice does not supersede the application of any third party copyright notice to that third 14 | party's code. 15 | 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 LASA Robotics 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /opencv-java/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 | -------------------------------------------------------------------------------- /ftc-cameratest/src/main/java/com/lasarobotics/tests/camera/CameraTestActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 LASA Robotics and Contributors 3 | * MIT licensed 4 | */ 5 | 6 | package com.lasarobotics.tests.camera; 7 | 8 | import android.os.Bundle; 9 | import android.view.WindowManager; 10 | 11 | import org.lasarobotics.vision.opmode.TestableVisionOpMode; 12 | import org.lasarobotics.vision.opmode.VisionEnabledActivity; 13 | 14 | public class CameraTestActivity extends VisionEnabledActivity { 15 | 16 | private TestableVisionOpMode opmode; 17 | 18 | public CameraTestActivity() { 19 | super(); 20 | } 21 | 22 | /** 23 | * Called when the activity is first created. 24 | */ 25 | @Override 26 | public void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 29 | 30 | setContentView(R.layout.activity_cameratest); 31 | 32 | opmode = new CameraTestVisionOpMode(); 33 | initializeVision(R.id.surfaceView, opmode); 34 | } 35 | 36 | @Override 37 | public void onPause() { 38 | super.onPause(); 39 | opmode.stop(); 40 | } 41 | } -------------------------------------------------------------------------------- /ftc-robotcontroller/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | defaultConfig { 5 | minSdkVersion 16 6 | targetSdkVersion 21 7 | } 8 | compileSdkVersion 23 9 | buildToolsVersion '23.0.3' 10 | } 11 | 12 | buildscript { 13 | repositories { 14 | jcenter() 15 | } 16 | dependencies { 17 | classpath 'com.android.tools.build:gradle:1.3.0' 18 | 19 | // NOTE: Do not place your application dependencies here; they belong 20 | // in the individual module build.gradle files 21 | } 22 | } 23 | 24 | repositories { 25 | flatDir { 26 | dirs 'libs' 27 | } 28 | } 29 | 30 | allprojects { 31 | repositories { 32 | jcenter() 33 | flatDir { 34 | dirs 'out' 35 | } 36 | } 37 | } 38 | 39 | dependencies { 40 | compile(name: 'RobotCore-release', ext: 'aar') 41 | compile(name: 'Hardware-release', ext: 'aar') 42 | compile(name: 'FtcCommon-release', ext: 'aar') 43 | compile(name: 'ModernRobotics-release', ext: 'aar') 44 | compile(name: 'Analytics-release', ext: 'aar') 45 | compile(name: 'WirelessP2p-release', ext: 'aar') 46 | 47 | compile project(':ftc-visionlib') 48 | compile project(':opencv-java') 49 | } 50 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/util/Vector3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | * 5 | * Thank you to FTCLib contributors. 6 | */ 7 | package org.lasarobotics.vision.util; 8 | 9 | /** 10 | * 3D Vector 11 | */ 12 | public class Vector3 { 13 | public final T x; 14 | public final T y; 15 | public final T z; 16 | 17 | public Vector3(T x, T y, T z) { 18 | this.x = x; 19 | this.y = y; 20 | this.z = z; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return "(" + x + ", " + y + ", " + z + ")"; 26 | } 27 | 28 | public static class Builder { 29 | private T x, y, z; 30 | 31 | public Builder x(T n) { 32 | this.x = n; 33 | return this; 34 | } 35 | 36 | public Builder y(T n) { 37 | this.y = n; 38 | return this; 39 | } 40 | 41 | public Builder z(T n) { 42 | this.z = n; 43 | return this; 44 | } 45 | 46 | // Illegal State Exception errors can be thrown if x, y, or z is null 47 | public Vector3 build() { 48 | return new Vector3<>(x, y, z); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package com.qualcomm.ftcrobotcontroller.opmodes; -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/util/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * General utility classes 27 | */ 28 | package org.lasarobotics.vision.util; -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/android/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * Android sensors and utilities 27 | */ 28 | package org.lasarobotics.vision.android; -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/photo/CalibrateCRF.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Algorithm; 10 | import org.opencv.core.Mat; 11 | import org.opencv.utils.Converters; 12 | 13 | // C++: class CalibrateCRF 14 | //javadoc: CalibrateCRF 15 | public class CalibrateCRF extends Algorithm { 16 | 17 | protected CalibrateCRF(long addr) { super(addr); } 18 | 19 | 20 | // 21 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 22 | // 23 | 24 | //javadoc: CalibrateCRF::process(src, dst, times) 25 | public void process(List src, Mat dst, Mat times) 26 | { 27 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 28 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 29 | 30 | return; 31 | } 32 | 33 | 34 | @Override 35 | protected void finalize() throws Throwable { 36 | delete(nativeObj); 37 | } 38 | 39 | 40 | 41 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 42 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj); 43 | 44 | // native support for java finalize() 45 | private static native void delete(long nativeObj); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/image/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * Matrix transformation, filtering, and drawing 27 | */ 28 | package org.lasarobotics.vision.image; -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/opmode/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * High-level vision opmodes overloading FIRST versions 27 | */ 28 | package org.lasarobotics.vision.opmode; -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/detection/objects/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * Detectable and analyzable primitives 27 | */ 28 | package org.lasarobotics.vision.detection.objects; -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/ftc/resq/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * FIRST Tech Challenge Res-Q game-specific vision code 27 | */ 28 | package org.lasarobotics.vision.ftc.resq; -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/detection/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * Low-level object detection and analysis powered by OpenCV 27 | */ 28 | package org.lasarobotics.vision.detection; -------------------------------------------------------------------------------- /opencv-java/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 | int SUCCESS = 0; 12 | /** 13 | * Google Play Market cannot be invoked. 14 | */ 15 | int MARKET_ERROR = 2; 16 | /** 17 | * OpenCV library installation has been canceled by the user. 18 | */ 19 | 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 | int INCOMPATIBLE_MANAGER_VERSION = 4; 24 | /** 25 | * OpenCV library initialization has failed. 26 | */ 27 | 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 | 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 | void onPackageInstall(final int operation, InstallCallbackInterface callback); 40 | } 41 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/util/color/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * Colorspace transformations, allowing use and conversion of colors within multiple spaces 27 | */ 28 | package org.lasarobotics.vision.util.color; -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/opmode/extensions/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * Vision extensions supporting VisionOpMode, LinearVisionOpMode, and TestableVisionOpMode 27 | */ 28 | package org.lasarobotics.vision.opmode.extensions; -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * LASA Robotics FIRST Tech Challenge Vision Library 27 | *

28 | * Based on OpenCV and written by FIRST teams for FIRST teams 29 | */ 30 | package org.lasarobotics.vision; -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/android/Cameras.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | */ 5 | package org.lasarobotics.vision.android; 6 | 7 | import android.content.Context; 8 | import android.content.pm.PackageManager; 9 | 10 | /** 11 | * List of available Android cameras 12 | */ 13 | public enum Cameras { 14 | //Primary (front-facing) camera 15 | PRIMARY(0), 16 | //Secondary (screen-facing) camera 17 | SECONDARY(1), 18 | //Other camera - ID 2 19 | OTHER_1(2), 20 | //Other camera - ID 3 21 | OTHER_2(3); 22 | 23 | final int id; 24 | 25 | Cameras(int id) { 26 | this.id = id; 27 | } 28 | 29 | /** 30 | * Checks whether the device supports cameras 31 | * 32 | * @param context Current context 33 | * @return True if supported, false otherwise 34 | */ 35 | public static boolean isHardwareAvailable(Context context) { 36 | return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA); 37 | } 38 | 39 | /** 40 | * Get the camera ID 41 | * 42 | * @return Camera ID 43 | */ 44 | public int getID() { 45 | return id; 46 | } 47 | 48 | /** 49 | * Returns a Camera instance from this Camera ID 50 | * 51 | * @return The camera instance 52 | */ 53 | public Camera createCamera() { 54 | return new Camera(this); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/photo/MergeExposures.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Algorithm; 10 | import org.opencv.core.Mat; 11 | import org.opencv.utils.Converters; 12 | 13 | // C++: class MergeExposures 14 | //javadoc: MergeExposures 15 | public class MergeExposures extends Algorithm { 16 | 17 | protected MergeExposures(long addr) { super(addr); } 18 | 19 | 20 | // 21 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 22 | // 23 | 24 | //javadoc: MergeExposures::process(src, dst, times, response) 25 | public void process(List src, Mat dst, Mat times, Mat response) 26 | { 27 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 28 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 29 | 30 | return; 31 | } 32 | 33 | 34 | @Override 35 | protected void finalize() throws Throwable { 36 | delete(nativeObj); 37 | } 38 | 39 | 40 | 41 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 42 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj); 43 | 44 | // native support for java finalize() 45 | private static native void delete(long nativeObj); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/java/com/qualcomm/ftcrobotcontroller/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 LASA Robotics 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | /** 26 | * FTC Robot Controller. Used to control an FTC Robot. 27 | *

28 | * The quickest way to get started is to look at {@link com.qualcomm.ftcrobotcontroller.opmodes} 29 | */ 30 | package com.qualcomm.ftcrobotcontroller; -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/photo/AlignExposures.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Algorithm; 10 | import org.opencv.core.Mat; 11 | import org.opencv.utils.Converters; 12 | 13 | // C++: class AlignExposures 14 | //javadoc: AlignExposures 15 | public class AlignExposures extends Algorithm { 16 | 17 | protected AlignExposures(long addr) { super(addr); } 18 | 19 | 20 | // 21 | // C++: void process(vector_Mat src, vector_Mat dst, Mat times, Mat response) 22 | // 23 | 24 | //javadoc: AlignExposures::process(src, dst, times, response) 25 | public void process(List src, List dst, Mat times, Mat response) 26 | { 27 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 28 | Mat dst_mat = Converters.vector_Mat_to_Mat(dst); 29 | process_0(nativeObj, src_mat.nativeObj, dst_mat.nativeObj, times.nativeObj, response.nativeObj); 30 | 31 | return; 32 | } 33 | 34 | 35 | @Override 36 | protected void finalize() throws Throwable { 37 | delete(nativeObj); 38 | } 39 | 40 | 41 | 42 | // C++: void process(vector_Mat src, vector_Mat dst, Mat times, Mat response) 43 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_mat_nativeObj, long times_nativeObj, long response_nativeObj); 44 | 45 | // native support for java finalize() 46 | private static native void delete(long nativeObj); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/video/DenseOpticalFlow.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | 10 | // C++: class DenseOpticalFlow 11 | //javadoc: DenseOpticalFlow 12 | public class DenseOpticalFlow extends Algorithm { 13 | 14 | protected DenseOpticalFlow(long addr) { super(addr); } 15 | 16 | 17 | // 18 | // C++: void calc(Mat I0, Mat I1, Mat& flow) 19 | // 20 | 21 | //javadoc: DenseOpticalFlow::calc(I0, I1, flow) 22 | public void calc(Mat I0, Mat I1, Mat flow) 23 | { 24 | 25 | calc_0(nativeObj, I0.nativeObj, I1.nativeObj, flow.nativeObj); 26 | 27 | return; 28 | } 29 | 30 | 31 | // 32 | // C++: void collectGarbage() 33 | // 34 | 35 | //javadoc: DenseOpticalFlow::collectGarbage() 36 | public void collectGarbage() 37 | { 38 | 39 | collectGarbage_0(nativeObj); 40 | 41 | return; 42 | } 43 | 44 | 45 | @Override 46 | protected void finalize() throws Throwable { 47 | delete(nativeObj); 48 | } 49 | 50 | 51 | 52 | // C++: void calc(Mat I0, Mat I1, Mat& flow) 53 | private static native void calc_0(long nativeObj, long I0_nativeObj, long I1_nativeObj, long flow_nativeObj); 54 | 55 | // C++: void collectGarbage() 56 | private static native void collectGarbage_0(long nativeObj); 57 | 58 | // native support for java finalize() 59 | private static native void delete(long nativeObj); 60 | 61 | } 62 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/util/color/ColorGRAY.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | */ 5 | package org.lasarobotics.vision.util.color; 6 | 7 | import org.opencv.core.Scalar; 8 | 9 | /** 10 | * Implements a grayscale color 11 | */ 12 | public class ColorGRAY extends Color { 13 | 14 | /** 15 | * Instantiate a Grayscale (8-bit) color from a Scalar 16 | * 17 | * @param s Scalar value containing one number (0-255) 18 | */ 19 | public ColorGRAY(Scalar s) { 20 | super(s); 21 | } 22 | 23 | /** 24 | * Instantiate a Grayscale (8-bit) color from an integer 25 | * 26 | * @param v Value (0-255) 27 | */ 28 | public ColorGRAY(int v) { 29 | super(new Scalar(v)); 30 | } 31 | 32 | /** 33 | * Get the GRAY colorspace 34 | * 35 | * @return Colorspace.GRAY 36 | */ 37 | public ColorSpace getColorSpace() { 38 | return ColorSpace.GRAY; 39 | } 40 | 41 | /** 42 | * Parse a scalar value into the colorspace 43 | * 44 | * @param s Scalar value 45 | * @return Colorspace scalar value 46 | */ 47 | @Override 48 | protected Scalar parseScalar(Scalar s) { 49 | if (s.val.length < 1) 50 | throw new IllegalArgumentException("Scalar must have 1 dimension."); 51 | return new Scalar(s.val[0]); 52 | } 53 | 54 | /** 55 | * Get brightness value 56 | * 57 | * @return Value (0-255) 58 | */ 59 | public int value() { 60 | return (int) scalar.val[0]; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/core/DMatch.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //C++: class DMatch 4 | 5 | /** 6 | * Structure for matching: query descriptor index, train descriptor index, train 7 | * image index and distance between descriptors. 8 | */ 9 | public class DMatch { 10 | 11 | /** 12 | * Query descriptor index. 13 | */ 14 | public int queryIdx; 15 | /** 16 | * Train descriptor index. 17 | */ 18 | public int trainIdx; 19 | /** 20 | * Train image index. 21 | */ 22 | public int imgIdx; 23 | 24 | // javadoc: DMatch::distance 25 | public float distance; 26 | 27 | // javadoc: DMatch::DMatch() 28 | public DMatch() { 29 | this(-1, -1, Float.MAX_VALUE); 30 | } 31 | 32 | // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _distance) 33 | public DMatch(int _queryIdx, int _trainIdx, float _distance) { 34 | queryIdx = _queryIdx; 35 | trainIdx = _trainIdx; 36 | imgIdx = -1; 37 | distance = _distance; 38 | } 39 | 40 | // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _imgIdx, _distance) 41 | public DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance) { 42 | queryIdx = _queryIdx; 43 | trainIdx = _trainIdx; 44 | imgIdx = _imgIdx; 45 | distance = _distance; 46 | } 47 | 48 | /** 49 | * Less is better. 50 | */ 51 | public boolean lessThan(DMatch it) { 52 | return distance < it.distance; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return "DMatch [queryIdx=" + queryIdx + ", trainIdx=" + trainIdx 58 | + ", imgIdx=" + imgIdx + ", distance=" + distance + "]"; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /opencv-java/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 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/core/Algorithm.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.core; 6 | 7 | import java.lang.String; 8 | 9 | // C++: class Algorithm 10 | //javadoc: Algorithm 11 | public class Algorithm { 12 | 13 | protected final long nativeObj; 14 | protected Algorithm(long addr) { nativeObj = addr; } 15 | 16 | 17 | // 18 | // C++: void clear() 19 | // 20 | 21 | //javadoc: Algorithm::clear() 22 | public void clear() 23 | { 24 | 25 | clear_0(nativeObj); 26 | 27 | return; 28 | } 29 | 30 | 31 | // 32 | // C++: void save(String filename) 33 | // 34 | 35 | //javadoc: Algorithm::save(filename) 36 | public void save(String filename) 37 | { 38 | 39 | save_0(nativeObj, filename); 40 | 41 | return; 42 | } 43 | 44 | 45 | // 46 | // C++: String getDefaultName() 47 | // 48 | 49 | //javadoc: Algorithm::getDefaultName() 50 | public String getDefaultName() 51 | { 52 | 53 | String retVal = getDefaultName_0(nativeObj); 54 | 55 | return retVal; 56 | } 57 | 58 | 59 | @Override 60 | protected void finalize() throws Throwable { 61 | delete(nativeObj); 62 | } 63 | 64 | 65 | 66 | // C++: void clear() 67 | private static native void clear_0(long nativeObj); 68 | 69 | // C++: void save(String filename) 70 | private static native void save_0(long nativeObj, String filename); 71 | 72 | // C++: String getDefaultName() 73 | private static native String getDefaultName_0(long nativeObj); 74 | 75 | // native support for java finalize() 76 | private static native void delete(long nativeObj); 77 | 78 | } 79 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/core/Size.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //javadoc:Size_ 4 | public class Size { 5 | 6 | public double width, height; 7 | 8 | public Size(double width, double height) { 9 | this.width = width; 10 | this.height = height; 11 | } 12 | 13 | public Size() { 14 | this(0, 0); 15 | } 16 | 17 | public Size(Point p) { 18 | width = p.x; 19 | height = p.y; 20 | } 21 | 22 | public Size(double[] vals) { 23 | set(vals); 24 | } 25 | 26 | public void set(double[] vals) { 27 | if (vals != null) { 28 | width = vals.length > 0 ? vals[0] : 0; 29 | height = vals.length > 1 ? vals[1] : 0; 30 | } else { 31 | width = 0; 32 | height = 0; 33 | } 34 | } 35 | 36 | public double area() { 37 | return width * height; 38 | } 39 | 40 | public Size clone() { 41 | return new Size(width, height); 42 | } 43 | 44 | @Override 45 | public int hashCode() { 46 | final int prime = 31; 47 | int result = 1; 48 | long temp; 49 | temp = Double.doubleToLongBits(height); 50 | result = prime * result + (int) (temp ^ (temp >>> 32)); 51 | temp = Double.doubleToLongBits(width); 52 | result = prime * result + (int) (temp ^ (temp >>> 32)); 53 | return result; 54 | } 55 | 56 | @Override 57 | public boolean equals(Object obj) { 58 | if (this == obj) return true; 59 | if (!(obj instanceof Size)) return false; 60 | Size it = (Size) obj; 61 | return width == it.width && height == it.height; 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return (int)width + "x" + (int)height; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/photo/Tonemap.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | 10 | // C++: class Tonemap 11 | //javadoc: Tonemap 12 | public class Tonemap extends Algorithm { 13 | 14 | protected Tonemap(long addr) { super(addr); } 15 | 16 | 17 | // 18 | // C++: void process(Mat src, Mat& dst) 19 | // 20 | 21 | //javadoc: Tonemap::process(src, dst) 22 | public void process(Mat src, Mat dst) 23 | { 24 | 25 | process_0(nativeObj, src.nativeObj, dst.nativeObj); 26 | 27 | return; 28 | } 29 | 30 | 31 | // 32 | // C++: float getGamma() 33 | // 34 | 35 | //javadoc: Tonemap::getGamma() 36 | public float getGamma() 37 | { 38 | 39 | float retVal = getGamma_0(nativeObj); 40 | 41 | return retVal; 42 | } 43 | 44 | 45 | // 46 | // C++: void setGamma(float gamma) 47 | // 48 | 49 | //javadoc: Tonemap::setGamma(gamma) 50 | public void setGamma(float gamma) 51 | { 52 | 53 | setGamma_0(nativeObj, gamma); 54 | 55 | return; 56 | } 57 | 58 | 59 | @Override 60 | protected void finalize() throws Throwable { 61 | delete(nativeObj); 62 | } 63 | 64 | 65 | 66 | // C++: void process(Mat src, Mat& dst) 67 | private static native void process_0(long nativeObj, long src_nativeObj, long dst_nativeObj); 68 | 69 | // C++: float getGamma() 70 | private static native float getGamma_0(long nativeObj); 71 | 72 | // C++: void setGamma(float gamma) 73 | private static native void setGamma_0(long nativeObj, float gamma); 74 | 75 | // native support for java finalize() 76 | private static native void delete(long nativeObj); 77 | 78 | } 79 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/xml/device_filter.xml: -------------------------------------------------------------------------------- 1 | 33 | 34 | 35 | 38 | 39 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/objdetect/Objdetect.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.objdetect; 6 | 7 | import java.util.ArrayList; 8 | import org.opencv.core.Mat; 9 | import org.opencv.core.MatOfInt; 10 | import org.opencv.core.MatOfRect; 11 | 12 | public class Objdetect { 13 | 14 | public static final int 15 | CASCADE_DO_CANNY_PRUNING = 1, 16 | CASCADE_SCALE_IMAGE = 2, 17 | CASCADE_FIND_BIGGEST_OBJECT = 4, 18 | CASCADE_DO_ROUGH_SEARCH = 8; 19 | 20 | 21 | // 22 | // C++: void groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2) 23 | // 24 | 25 | //javadoc: groupRectangles(rectList, weights, groupThreshold, eps) 26 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps) 27 | { 28 | Mat rectList_mat = rectList; 29 | Mat weights_mat = weights; 30 | groupRectangles_0(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold, eps); 31 | 32 | return; 33 | } 34 | 35 | //javadoc: groupRectangles(rectList, weights, groupThreshold) 36 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold) 37 | { 38 | Mat rectList_mat = rectList; 39 | Mat weights_mat = weights; 40 | groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold); 41 | 42 | return; 43 | } 44 | 45 | 46 | 47 | 48 | // C++: void groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2) 49 | private static native void groupRectangles_0(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold, double eps); 50 | private static native void groupRectangles_1(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /ftc-cameratest/libs/NOTICE_FtcCommon.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, 2015 Qualcomm Technologies Inc 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted 6 | (subject to the limitations in the disclaimer below) provided that the following conditions are 7 | met: 8 | 9 | Redistributions of source code must retain the above copyright notice, this list of conditions 10 | and the following disclaimer. 11 | 12 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions 13 | and the following disclaimer in the documentation and/or other materials provided with the 14 | distribution. 15 | 16 | Neither the name of Qualcomm Technologies Inc nor the names of its contributors may be used to 17 | endorse or promote products derived from this software without specific prior written permission. 18 | 19 | Qualcomm Technologies Inc., will periodically collect anonymous information about the device this 20 | software is installed on such as the make, model, and software versions, but no information that 21 | identifies you. 22 | 23 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS 24 | SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 25 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 29 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 31 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | -------------------------------------------------------------------------------- /ftc-cameratest/libs/NOTICE_RobotCore.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, 2015 Qualcomm Technologies Inc 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted 6 | (subject to the limitations in the disclaimer below) provided that the following conditions are 7 | met: 8 | 9 | Redistributions of source code must retain the above copyright notice, this list of conditions 10 | and the following disclaimer. 11 | 12 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions 13 | and the following disclaimer in the documentation and/or other materials provided with the 14 | distribution. 15 | 16 | Neither the name of Qualcomm Technologies Inc nor the names of its contributors may be used to 17 | endorse or promote products derived from this software without specific prior written permission. 18 | 19 | Qualcomm Technologies Inc., will periodically collect anonymous information about the device this 20 | software is installed on such as the make, model, and software versions, but no information that 21 | identifies you. 22 | 23 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS 24 | SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 25 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 29 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 31 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | -------------------------------------------------------------------------------- /ftc-visionlib/libs/NOTICE_RobotCore.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014, 2015 Qualcomm Technologies Inc 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, are permitted 6 | (subject to the limitations in the disclaimer below) provided that the following conditions are 7 | met: 8 | 9 | Redistributions of source code must retain the above copyright notice, this list of conditions 10 | and the following disclaimer. 11 | 12 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions 13 | and the following disclaimer in the documentation and/or other materials provided with the 14 | distribution. 15 | 16 | Neither the name of Qualcomm Technologies Inc nor the names of its contributors may be used to 17 | endorse or promote products derived from this software without specific prior written permission. 18 | 19 | Qualcomm Technologies Inc., will periodically collect anonymous information about the device this 20 | software is installed on such as the make, model, and software versions, but no information that 21 | identifies you. 22 | 23 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS 24 | SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 25 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 29 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 31 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 33 | 34 | 35 | 36 | 37 | 16dp 38 | 5dp 39 | 40 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/util/color/ColorHSV.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | */ 5 | package org.lasarobotics.vision.util.color; 6 | 7 | import org.opencv.core.Scalar; 8 | 9 | /** 10 | * Implements a color in the HSV color space 11 | */ 12 | public class ColorHSV extends Color { 13 | 14 | public ColorHSV(Scalar s) { 15 | super(s); 16 | } 17 | 18 | /** 19 | * An HSV (hue, saturation, value) color 20 | * This is NOT an HSL color - they live in different spaces. 21 | * 22 | * @param h Hue, from 0 to 255 23 | * @param s Saturation, from 0 to 255 24 | * @param v Value, from 0 to 255 25 | */ 26 | public ColorHSV(int h, int s, int v) { 27 | super(new Scalar(h, s, v)); 28 | } 29 | 30 | /** 31 | * Get the HSV colorspace 32 | * 33 | * @return ColorSpace.HSV 34 | */ 35 | public ColorSpace getColorSpace() { 36 | return ColorSpace.HSV; 37 | } 38 | 39 | /** 40 | * Parse a scalar value into the colorspace 41 | * 42 | * @param s Scalar value 43 | * @return Colorspace scalar value 44 | */ 45 | @Override 46 | protected Scalar parseScalar(Scalar s) { 47 | if (s.val.length < 3) 48 | throw new IllegalArgumentException("Scalar must have 3 dimensions."); 49 | return new Scalar(s.val[0], s.val[1], s.val[2]); 50 | } 51 | 52 | /** 53 | * Get the color hue 54 | * 55 | * @return Hue (0-255) 56 | */ 57 | public int hue() { 58 | return (int) scalar.val[0]; 59 | } 60 | 61 | /** 62 | * Get the color saturation 63 | * 64 | * @return Saturation (0-255) 65 | */ 66 | public int saturation() { 67 | return (int) scalar.val[1]; 68 | } 69 | 70 | /** 71 | * Get the color value 72 | * 73 | * @return Value (0-255) 74 | */ 75 | public int value() { 76 | return (int) scalar.val[2]; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 33 | 34 | 35 | 36 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ftc-cameratest/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 32 | 33 | 36 | 39 | 40 | 43 | 46 | 49 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/photo/MergeDebevec.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Mat; 10 | import org.opencv.utils.Converters; 11 | 12 | // C++: class MergeDebevec 13 | //javadoc: MergeDebevec 14 | public class MergeDebevec extends MergeExposures { 15 | 16 | protected MergeDebevec(long addr) { super(addr); } 17 | 18 | 19 | // 20 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 21 | // 22 | 23 | //javadoc: MergeDebevec::process(src, dst, times, response) 24 | public void process(List src, Mat dst, Mat times, Mat response) 25 | { 26 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 27 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 28 | 29 | return; 30 | } 31 | 32 | 33 | // 34 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 35 | // 36 | 37 | //javadoc: MergeDebevec::process(src, dst, times) 38 | public void process(List src, Mat dst, Mat times) 39 | { 40 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 41 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 42 | 43 | return; 44 | } 45 | 46 | 47 | @Override 48 | protected void finalize() throws Throwable { 49 | delete(nativeObj); 50 | } 51 | 52 | 53 | 54 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 55 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj); 56 | 57 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 58 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj); 59 | 60 | // native support for java finalize() 61 | private static native void delete(long nativeObj); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/photo/MergeRobertson.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import org.opencv.core.Mat; 10 | import org.opencv.utils.Converters; 11 | 12 | // C++: class MergeRobertson 13 | //javadoc: MergeRobertson 14 | public class MergeRobertson extends MergeExposures { 15 | 16 | protected MergeRobertson(long addr) { super(addr); } 17 | 18 | 19 | // 20 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 21 | // 22 | 23 | //javadoc: MergeRobertson::process(src, dst, times, response) 24 | public void process(List src, Mat dst, Mat times, Mat response) 25 | { 26 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 27 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 28 | 29 | return; 30 | } 31 | 32 | 33 | // 34 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 35 | // 36 | 37 | //javadoc: MergeRobertson::process(src, dst, times) 38 | public void process(List src, Mat dst, Mat times) 39 | { 40 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 41 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 42 | 43 | return; 44 | } 45 | 46 | 47 | @Override 48 | protected void finalize() throws Throwable { 49 | delete(nativeObj); 50 | } 51 | 52 | 53 | 54 | // C++: void process(vector_Mat src, Mat& dst, Mat times, Mat response) 55 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj); 56 | 57 | // C++: void process(vector_Mat src, Mat& dst, Mat times) 58 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj); 59 | 60 | // native support for java finalize() 61 | private static native void delete(long nativeObj); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 33 | 34 | 35 | 36 | 40 | 128dp 41 | 42 | 43 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 33 | 34 | 35 | 36 | 40 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 33 | 34 | 35 | 38 | 64dp 39 | 40 | -------------------------------------------------------------------------------- /opencv-java/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 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 33 | 34 | 35 | 36 | 41 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/util/FPS.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | */ 5 | package org.lasarobotics.vision.util; 6 | 7 | import java.text.DecimalFormat; 8 | 9 | /** 10 | * Allows counting and retrieving a frames per second count. 11 | */ 12 | public class FPS { 13 | private static final int FRAME_BUFFER_LENGTH = 5; 14 | private static final DecimalFormat FPS_FORMAT = new DecimalFormat("0.00"); 15 | 16 | private final RollingAverage rollingAverage; 17 | private long lastTime; 18 | 19 | /** 20 | * Instantiate a new fps counter 21 | */ 22 | public FPS() { 23 | rollingAverage = new RollingAverage<>(FRAME_BUFFER_LENGTH); 24 | lastTime = -1L; 25 | } 26 | 27 | /** 28 | * Update the FPS counter. 29 | *

30 | * Call this method EVERY FRAME! 31 | */ 32 | public void update() { 33 | if (lastTime != -1L) { 34 | long delta = System.nanoTime() - lastTime; 35 | rollingAverage.addValue(delta); 36 | } 37 | lastTime = System.nanoTime(); 38 | } 39 | 40 | /** 41 | * Get the frames per second count, as a double (prefer using getFPSString() instead). 42 | * 43 | * @return The FPS, as a double in frames/second. 44 | */ 45 | private double getFPS() { 46 | double period = rollingAverage.getAverage() / 1000000000.0; //period: s 47 | return 1.0 / period; //frequency = 1/s 48 | } 49 | 50 | /** 51 | * Get a string coercing the length of the FPS decimal 52 | * 53 | * @return 0.00 decimal form of getFPS() 54 | */ 55 | public String getFPSString() { 56 | return FPS_FORMAT.format(getFPS()); 57 | } 58 | 59 | /** 60 | * Pause the FPS counter. 61 | *

62 | * Call this when you're not going to use it for a while 63 | */ 64 | public void pause() { 65 | //make sure we resample the FPS on next update() 66 | lastTime = -1L; 67 | } 68 | 69 | /** 70 | * Resets the FPS counter. 71 | */ 72 | public void reset() { 73 | rollingAverage.clear(); 74 | lastTime = -1L; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /opencv-java/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 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/video/BackgroundSubtractor.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.video; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | 10 | // C++: class BackgroundSubtractor 11 | //javadoc: BackgroundSubtractor 12 | public class BackgroundSubtractor extends Algorithm { 13 | 14 | protected BackgroundSubtractor(long addr) { super(addr); } 15 | 16 | 17 | // 18 | // C++: void apply(Mat image, Mat& fgmask, double learningRate = -1) 19 | // 20 | 21 | //javadoc: BackgroundSubtractor::apply(image, fgmask, learningRate) 22 | public void apply(Mat image, Mat fgmask, double learningRate) 23 | { 24 | 25 | apply_0(nativeObj, image.nativeObj, fgmask.nativeObj, learningRate); 26 | 27 | return; 28 | } 29 | 30 | //javadoc: BackgroundSubtractor::apply(image, fgmask) 31 | public void apply(Mat image, Mat fgmask) 32 | { 33 | 34 | apply_1(nativeObj, image.nativeObj, fgmask.nativeObj); 35 | 36 | return; 37 | } 38 | 39 | 40 | // 41 | // C++: void getBackgroundImage(Mat& backgroundImage) 42 | // 43 | 44 | //javadoc: BackgroundSubtractor::getBackgroundImage(backgroundImage) 45 | public void getBackgroundImage(Mat backgroundImage) 46 | { 47 | 48 | getBackgroundImage_0(nativeObj, backgroundImage.nativeObj); 49 | 50 | return; 51 | } 52 | 53 | 54 | @Override 55 | protected void finalize() throws Throwable { 56 | delete(nativeObj); 57 | } 58 | 59 | 60 | 61 | // C++: void apply(Mat image, Mat& fgmask, double learningRate = -1) 62 | private static native void apply_0(long nativeObj, long image_nativeObj, long fgmask_nativeObj, double learningRate); 63 | private static native void apply_1(long nativeObj, long image_nativeObj, long fgmask_nativeObj); 64 | 65 | // C++: void getBackgroundImage(Mat& backgroundImage) 66 | private static native void getBackgroundImage_0(long nativeObj, long backgroundImage_nativeObj); 67 | 68 | // native support for java finalize() 69 | private static native void delete(long nativeObj); 70 | 71 | } 72 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/photo/TonemapDrago.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | 8 | 9 | // C++: class TonemapDrago 10 | //javadoc: TonemapDrago 11 | public class TonemapDrago extends Tonemap { 12 | 13 | protected TonemapDrago(long addr) { super(addr); } 14 | 15 | 16 | // 17 | // C++: float getSaturation() 18 | // 19 | 20 | //javadoc: TonemapDrago::getSaturation() 21 | public float getSaturation() 22 | { 23 | 24 | float retVal = getSaturation_0(nativeObj); 25 | 26 | return retVal; 27 | } 28 | 29 | 30 | // 31 | // C++: void setSaturation(float saturation) 32 | // 33 | 34 | //javadoc: TonemapDrago::setSaturation(saturation) 35 | public void setSaturation(float saturation) 36 | { 37 | 38 | setSaturation_0(nativeObj, saturation); 39 | 40 | return; 41 | } 42 | 43 | 44 | // 45 | // C++: float getBias() 46 | // 47 | 48 | //javadoc: TonemapDrago::getBias() 49 | public float getBias() 50 | { 51 | 52 | float retVal = getBias_0(nativeObj); 53 | 54 | return retVal; 55 | } 56 | 57 | 58 | // 59 | // C++: void setBias(float bias) 60 | // 61 | 62 | //javadoc: TonemapDrago::setBias(bias) 63 | public void setBias(float bias) 64 | { 65 | 66 | setBias_0(nativeObj, bias); 67 | 68 | return; 69 | } 70 | 71 | 72 | @Override 73 | protected void finalize() throws Throwable { 74 | delete(nativeObj); 75 | } 76 | 77 | 78 | 79 | // C++: float getSaturation() 80 | private static native float getSaturation_0(long nativeObj); 81 | 82 | // C++: void setSaturation(float saturation) 83 | private static native void setSaturation_0(long nativeObj, float saturation); 84 | 85 | // C++: float getBias() 86 | private static native float getBias_0(long nativeObj); 87 | 88 | // C++: void setBias(float bias) 89 | private static native void setBias_0(long nativeObj, float bias); 90 | 91 | // native support for java finalize() 92 | private static native void delete(long nativeObj); 93 | 94 | } 95 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/photo/TonemapMantiuk.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | 8 | 9 | // C++: class TonemapMantiuk 10 | //javadoc: TonemapMantiuk 11 | public class TonemapMantiuk extends Tonemap { 12 | 13 | protected TonemapMantiuk(long addr) { super(addr); } 14 | 15 | 16 | // 17 | // C++: float getScale() 18 | // 19 | 20 | //javadoc: TonemapMantiuk::getScale() 21 | public float getScale() 22 | { 23 | 24 | float retVal = getScale_0(nativeObj); 25 | 26 | return retVal; 27 | } 28 | 29 | 30 | // 31 | // C++: void setScale(float scale) 32 | // 33 | 34 | //javadoc: TonemapMantiuk::setScale(scale) 35 | public void setScale(float scale) 36 | { 37 | 38 | setScale_0(nativeObj, scale); 39 | 40 | return; 41 | } 42 | 43 | 44 | // 45 | // C++: float getSaturation() 46 | // 47 | 48 | //javadoc: TonemapMantiuk::getSaturation() 49 | public float getSaturation() 50 | { 51 | 52 | float retVal = getSaturation_0(nativeObj); 53 | 54 | return retVal; 55 | } 56 | 57 | 58 | // 59 | // C++: void setSaturation(float saturation) 60 | // 61 | 62 | //javadoc: TonemapMantiuk::setSaturation(saturation) 63 | public void setSaturation(float saturation) 64 | { 65 | 66 | setSaturation_0(nativeObj, saturation); 67 | 68 | return; 69 | } 70 | 71 | 72 | @Override 73 | protected void finalize() throws Throwable { 74 | delete(nativeObj); 75 | } 76 | 77 | 78 | 79 | // C++: float getScale() 80 | private static native float getScale_0(long nativeObj); 81 | 82 | // C++: void setScale(float scale) 83 | private static native void setScale_0(long nativeObj, float scale); 84 | 85 | // C++: float getSaturation() 86 | private static native float getSaturation_0(long nativeObj); 87 | 88 | // C++: void setSaturation(float saturation) 89 | private static native void setSaturation_0(long nativeObj, float saturation); 90 | 91 | // native support for java finalize() 92 | private static native void delete(long nativeObj); 93 | 94 | } 95 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/android/FpsMeter.java: -------------------------------------------------------------------------------- 1 | package org.opencv.android; 2 | 3 | import java.text.DecimalFormat; 4 | 5 | import org.opencv.core.Core; 6 | 7 | import android.graphics.Canvas; 8 | import android.graphics.Color; 9 | import android.graphics.Paint; 10 | import android.util.Log; 11 | 12 | public class FpsMeter { 13 | private static final String TAG = "FpsMeter"; 14 | private static final int STEP = 20; 15 | private static final DecimalFormat FPS_FORMAT = new DecimalFormat("0.00"); 16 | 17 | private int mFramesCouner; 18 | private double mFrequency; 19 | private long mprevFrameTime; 20 | private String mStrfps; 21 | Paint mPaint; 22 | boolean mIsInitialized = false; 23 | int mWidth = 0; 24 | int mHeight = 0; 25 | 26 | public void init() { 27 | mFramesCouner = 0; 28 | mFrequency = Core.getTickFrequency(); 29 | mprevFrameTime = Core.getTickCount(); 30 | mStrfps = ""; 31 | 32 | mPaint = new Paint(); 33 | mPaint.setColor(Color.BLUE); 34 | mPaint.setTextSize(20); 35 | } 36 | 37 | public void measure() { 38 | if (!mIsInitialized) { 39 | init(); 40 | mIsInitialized = true; 41 | } else { 42 | mFramesCouner++; 43 | if (mFramesCouner % STEP == 0) { 44 | long time = Core.getTickCount(); 45 | double fps = STEP * mFrequency / (time - mprevFrameTime); 46 | mprevFrameTime = time; 47 | if (mWidth != 0 && mHeight != 0) 48 | mStrfps = FPS_FORMAT.format(fps) + " FPS@" + Integer.valueOf(mWidth) + "x" + Integer.valueOf(mHeight); 49 | else 50 | mStrfps = FPS_FORMAT.format(fps) + " FPS"; 51 | Log.i(TAG, mStrfps); 52 | } 53 | } 54 | } 55 | 56 | public void setResolution(int width, int height) { 57 | mWidth = width; 58 | mHeight = height; 59 | } 60 | 61 | public void draw(Canvas canvas, float offsetx, float offsety) { 62 | Log.d(TAG, mStrfps); 63 | canvas.drawText(mStrfps, offsetx, offsety, mPaint); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 35 | 36 | 37 | #790E15 38 | #3F0206 39 | #4e0106 40 | #bf0510 41 | #A6040E 42 | #ff0a19 43 | #FFFFFF 44 | #000000 45 | #00000000 46 | 47 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/ml/NormalBayesClassifier.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.ml; 6 | 7 | import org.opencv.core.Mat; 8 | 9 | // C++: class NormalBayesClassifier 10 | //javadoc: NormalBayesClassifier 11 | public class NormalBayesClassifier extends StatModel { 12 | 13 | protected NormalBayesClassifier(long addr) { super(addr); } 14 | 15 | 16 | // 17 | // C++: float predictProb(Mat inputs, Mat& outputs, Mat& outputProbs, int flags = 0) 18 | // 19 | 20 | //javadoc: NormalBayesClassifier::predictProb(inputs, outputs, outputProbs, flags) 21 | public float predictProb(Mat inputs, Mat outputs, Mat outputProbs, int flags) 22 | { 23 | 24 | float retVal = predictProb_0(nativeObj, inputs.nativeObj, outputs.nativeObj, outputProbs.nativeObj, flags); 25 | 26 | return retVal; 27 | } 28 | 29 | //javadoc: NormalBayesClassifier::predictProb(inputs, outputs, outputProbs) 30 | public float predictProb(Mat inputs, Mat outputs, Mat outputProbs) 31 | { 32 | 33 | float retVal = predictProb_1(nativeObj, inputs.nativeObj, outputs.nativeObj, outputProbs.nativeObj); 34 | 35 | return retVal; 36 | } 37 | 38 | 39 | // 40 | // C++: static Ptr_NormalBayesClassifier create() 41 | // 42 | 43 | //javadoc: NormalBayesClassifier::create() 44 | public static NormalBayesClassifier create() 45 | { 46 | 47 | NormalBayesClassifier retVal = new NormalBayesClassifier(create_0()); 48 | 49 | return retVal; 50 | } 51 | 52 | 53 | @Override 54 | protected void finalize() throws Throwable { 55 | delete(nativeObj); 56 | } 57 | 58 | 59 | 60 | // C++: float predictProb(Mat inputs, Mat& outputs, Mat& outputProbs, int flags = 0) 61 | private static native float predictProb_0(long nativeObj, long inputs_nativeObj, long outputs_nativeObj, long outputProbs_nativeObj, int flags); 62 | private static native float predictProb_1(long nativeObj, long inputs_nativeObj, long outputs_nativeObj, long outputProbs_nativeObj); 63 | 64 | // C++: static Ptr_NormalBayesClassifier create() 65 | private static native long create_0(); 66 | 67 | // native support for java finalize() 68 | private static native void delete(long nativeObj); 69 | 70 | } 71 | -------------------------------------------------------------------------------- /opencv-java/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 | -------------------------------------------------------------------------------- /opencv-java/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 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/core/MatOfByte.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfByte extends Mat { 7 | // 8UC(x) 8 | private static final int _depth = CvType.CV_8U; 9 | private static final int _channels = 1; 10 | 11 | public MatOfByte() { 12 | super(); 13 | } 14 | 15 | protected MatOfByte(long addr) { 16 | super(addr); 17 | if( !empty() && checkVector(_channels, _depth) < 0 ) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | //FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfByte fromNativeAddr(long addr) { 23 | return new MatOfByte(addr); 24 | } 25 | 26 | public MatOfByte(Mat m) { 27 | super(m, Range.all()); 28 | if( !empty() && checkVector(_channels, _depth) < 0 ) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | //FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfByte(byte...a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if(elemNumber>0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(byte...a) { 44 | if(a==null || a.length==0) 45 | return; 46 | int num = a.length / _channels; 47 | alloc(num); 48 | put(0, 0, a); //TODO: check ret val! 49 | } 50 | 51 | public byte[] toArray() { 52 | int num = checkVector(_channels, _depth); 53 | if(num < 0) 54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString()); 55 | byte[] a = new byte[num * _channels]; 56 | if(num == 0) 57 | return a; 58 | get(0, 0, a); //TODO: check ret val! 59 | return a; 60 | } 61 | 62 | public void fromList(List lb) { 63 | if(lb==null || lb.size()==0) 64 | return; 65 | Byte ab[] = lb.toArray(new Byte[0]); 66 | byte a[] = new byte[ab.length]; 67 | for(int i=0; i toList() { 73 | byte[] a = toArray(); 74 | Byte ab[] = new Byte[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; i= 0 21 | */ 22 | public static void blur(Mat img, int amount) { 23 | Imgproc.GaussianBlur(img, img, new Size(2 * amount + 1, 2 * amount + 1), 0, 0); 24 | } 25 | 26 | /** 27 | * Erode the image using morphological transformations 28 | * 29 | * @param img Image matrix 30 | * @param amount Amount to erode = 0 31 | */ 32 | public static void erode(Mat img, int amount) { 33 | Mat kernel = Imgproc.getStructuringElement(Imgproc.CV_SHAPE_RECT, 34 | new Size(2 * amount + 1, 2 * amount + 1), 35 | new Point(amount, amount)); 36 | Imgproc.erode(img, img, kernel); 37 | } 38 | 39 | /** 40 | * Dilate the image using morphological transformations 41 | * 42 | * @param img Image matrix 43 | * @param amount Amount to dilate = 0 44 | */ 45 | public static void dilate(Mat img, int amount) { 46 | Mat kernel = Imgproc.getStructuringElement(Imgproc.CV_SHAPE_RECT, 47 | new Size(2 * amount + 1, 2 * amount + 1), 48 | new Point(amount, amount)); 49 | Imgproc.dilate(img, img, kernel); 50 | } 51 | 52 | /** 53 | * Downsample and blur an image (using a Gaussian pyramid kernel) 54 | * 55 | * @param img The image 56 | * @param scale The scale, a number greater than 1 57 | */ 58 | public static void downsample(Mat img, double scale) { 59 | Imgproc.pyrDown(img, img, new Size((double) img.width() / scale, (double) img.height() / scale)); 60 | } 61 | 62 | /** 63 | * Upsample and blur an image (using a Gaussian pyramid kernel) 64 | * 65 | * @param img The image 66 | * @param scale The scale, a number greater than 1 67 | */ 68 | public static void upsample(Mat img, double scale) { 69 | Imgproc.pyrUp(img, img, new Size((double) img.width() * scale, (double) img.height() * scale)); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/core/MatOfFloat.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class MatOfFloat extends Mat { 7 | // 32FC1 8 | private static final int _depth = CvType.CV_32F; 9 | private static final int _channels = 1; 10 | 11 | public MatOfFloat() { 12 | super(); 13 | } 14 | 15 | protected MatOfFloat(long addr) { 16 | super(addr); 17 | if( !empty() && checkVector(_channels, _depth) < 0 ) 18 | throw new IllegalArgumentException("Incompatible Mat"); 19 | //FIXME: do we need release() here? 20 | } 21 | 22 | public static MatOfFloat fromNativeAddr(long addr) { 23 | return new MatOfFloat(addr); 24 | } 25 | 26 | public MatOfFloat(Mat m) { 27 | super(m, Range.all()); 28 | if( !empty() && checkVector(_channels, _depth) < 0 ) 29 | throw new IllegalArgumentException("Incompatible Mat"); 30 | //FIXME: do we need release() here? 31 | } 32 | 33 | public MatOfFloat(float...a) { 34 | super(); 35 | fromArray(a); 36 | } 37 | 38 | public void alloc(int elemNumber) { 39 | if(elemNumber>0) 40 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 41 | } 42 | 43 | public void fromArray(float...a) { 44 | if(a==null || a.length==0) 45 | return; 46 | int num = a.length / _channels; 47 | alloc(num); 48 | put(0, 0, a); //TODO: check ret val! 49 | } 50 | 51 | public float[] toArray() { 52 | int num = checkVector(_channels, _depth); 53 | if(num < 0) 54 | throw new RuntimeException("Native Mat has unexpected type or size: " + toString()); 55 | float[] a = new float[num * _channels]; 56 | if(num == 0) 57 | return a; 58 | get(0, 0, a); //TODO: check ret val! 59 | return a; 60 | } 61 | 62 | public void fromList(List lb) { 63 | if(lb==null || lb.size()==0) 64 | return; 65 | Float ab[] = lb.toArray(new Float[0]); 66 | float a[] = new float[ab.length]; 67 | for(int i=0; i 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) 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(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 | -------------------------------------------------------------------------------- /opencv-java/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 | -------------------------------------------------------------------------------- /opencv-java/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 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/util/IO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | * 5 | * Thank you to Ehsan Asdar (LASA). 6 | */ 7 | 8 | package org.lasarobotics.vision.util; 9 | 10 | import android.os.Environment; 11 | 12 | import org.lasarobotics.vision.android.Util; 13 | 14 | import java.io.BufferedWriter; 15 | import java.io.File; 16 | import java.io.FileWriter; 17 | import java.io.IOException; 18 | import java.util.Scanner; 19 | 20 | /** 21 | * File Input/Output operations 22 | */ 23 | class IO { 24 | /** 25 | * Write a text file on the device 26 | * 27 | * @param directory Directory to write the file into 28 | * @param filename The filename, including extension 29 | * @param data Data to write to file 30 | * @param overwrite True to overwrite file if exists, false to create new file with appended "." and integer 31 | */ 32 | public static void writeTextFile(String directory, String filename, String data, boolean overwrite) { 33 | try { 34 | File f; 35 | f = Util.createFileOnDevice(directory, filename, overwrite); 36 | FileWriter fw = new FileWriter(f.getAbsoluteFile()); 37 | BufferedWriter bw = new BufferedWriter(fw); 38 | bw.write(data); 39 | bw.close(); 40 | } catch (IOException e) { 41 | e.printStackTrace(); 42 | } 43 | } 44 | 45 | /** 46 | * Read an entire text file into a string 47 | * 48 | * @param directory Directory from which to read the file 49 | * @param filename Filename with extension(s) 50 | * @return String containing the file - use getLines() to get the lines of the file 51 | */ 52 | public static String readTextFile(String directory, String filename) { 53 | File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + directory, filename); 54 | try { 55 | String str = ""; 56 | Scanner s = new Scanner(f); 57 | while (s.hasNextLine()) 58 | str += s.nextLine() + "\n"; 59 | return str; 60 | } catch (Exception e) { 61 | e.printStackTrace(); 62 | return null; 63 | } 64 | } 65 | 66 | /** 67 | * Seperate a string into lines split by line endings 68 | * 69 | * @param data Single string 70 | * @return Lines 71 | */ 72 | public static String[] getLines(String data) { 73 | return data.split("\r?\n"); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/util/RollingAverage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | * 5 | * Thank you to FTCLib contributors. 6 | */ 7 | package org.lasarobotics.vision.util; 8 | 9 | import java.util.LinkedList; 10 | 11 | /** 12 | * Structure that performs a continuous rolling average on values 13 | * Uses doubles as internal structures 14 | */ 15 | class RollingAverage { 16 | private final LinkedList list; 17 | private int capacity; 18 | private double total; 19 | 20 | /** 21 | * Initialize a rolling average based with a specific capacity 22 | * 23 | * @param capacity Capacity of the rolling average 24 | */ 25 | public RollingAverage(int capacity) { 26 | list = new LinkedList<>(); 27 | this.capacity = capacity; 28 | total = 0; 29 | } 30 | 31 | /** 32 | * Add a value to the averager 33 | * 34 | * @param value Value to add 35 | */ 36 | public void addValue(T value) { 37 | list.addFirst(value); 38 | total += Double.valueOf(value.toString()); 39 | trim(); 40 | } 41 | 42 | private void trim() { 43 | while (list.size() > capacity) { 44 | total -= Double.valueOf(list.removeLast().toString()); 45 | } 46 | } 47 | 48 | /** 49 | * Get the capacity of the averager 50 | * 51 | * @return Capacity of the averager 52 | */ 53 | public int getCapacity() { 54 | return capacity; 55 | } 56 | 57 | /** 58 | * Set a capacity of the averager 59 | * 60 | * @param capacity New capacity 61 | */ 62 | public void setCapacity(int capacity) { 63 | this.capacity = capacity; 64 | } 65 | 66 | /** 67 | * Remove and zero all elements 68 | */ 69 | public void clear() { 70 | list.clear(); 71 | } 72 | 73 | /** 74 | * Get the current count of the items in the underlying array 75 | * 76 | * @return Current count of items in the averaging array 77 | */ 78 | public int getSize() { 79 | return list.size(); 80 | } 81 | 82 | /** 83 | * Get the average of the items currently in the array 84 | * 85 | * @return Average 86 | */ 87 | public double getAverage() { 88 | return (list.size() > 0) ? (total / list.size()) : 0; 89 | } 90 | 91 | /** 92 | * Get the sum of the numbers in the array 93 | * 94 | * @return Sum of values 95 | */ 96 | public double getTotal() { 97 | return total; 98 | } 99 | } -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/util/ScreenOrientation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | */ 5 | package org.lasarobotics.vision.util; 6 | 7 | import android.view.Surface; 8 | 9 | /** 10 | * Rotation relative to the horizontal positive x-axis (east) and increasing counterclockwise 11 | */ 12 | public enum ScreenOrientation { 13 | LANDSCAPE(0), 14 | DEFAULT(0), 15 | PORTRAIT(90), 16 | LANDSCAPE_REVERSE(180), 17 | PORTRAIT_REVERSE(270); 18 | 19 | private final double angle; 20 | 21 | ScreenOrientation(double angle) { 22 | this.angle = angle; 23 | } 24 | 25 | /** 26 | * Get the screen orientation from an angle value 27 | * 28 | * @param angle Angle value, in degrees 29 | * @return ScreenOrientation or throws RuntimeException if cannot convert 30 | */ 31 | public static ScreenOrientation getFromAngle(double angle) { 32 | return getFromAngle((int) angle); 33 | } 34 | 35 | private static ScreenOrientation getFromAngle(int angle) { 36 | while (angle >= 360) 37 | angle -= 360; 38 | while (angle < 0) 39 | angle += 360; 40 | 41 | switch (angle) { 42 | case 0: 43 | case 360: 44 | return LANDSCAPE; 45 | case 90: 46 | return PORTRAIT; 47 | case 180: 48 | return LANDSCAPE_REVERSE; 49 | case 270: 50 | return PORTRAIT_REVERSE; 51 | default: 52 | throw new RuntimeException("The input angle must be a multiple of 90 degrees!"); 53 | } 54 | } 55 | 56 | /** 57 | * Get a ScreenOrientation value from an android.view.Surface ID 58 | * 59 | * @param id android.view.Surface ID 60 | * @return ScreenOrientation instance 61 | */ 62 | public static ScreenOrientation getFromSurface(int id) { 63 | switch (id) { 64 | case Surface.ROTATION_0: 65 | return LANDSCAPE; 66 | case Surface.ROTATION_90: 67 | return PORTRAIT; 68 | case Surface.ROTATION_180: 69 | return LANDSCAPE_REVERSE; 70 | case Surface.ROTATION_270: 71 | return PORTRAIT_REVERSE; 72 | default: 73 | return LANDSCAPE; 74 | } 75 | } 76 | 77 | /** 78 | * Get the angle of this ScreenOrientation in degrees 79 | * 80 | * @return Angle, in degrees 81 | */ 82 | public double getAngle() { 83 | return angle; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /opencv-java/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 | return java.util.Arrays.equals(val, it.val); 82 | } 83 | 84 | @Override 85 | public String toString() { 86 | return "[" + val[0] + ", " + val[1] + ", " + val[2] + ", " + val[3] + "]"; 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /opencv-java/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 | { 38 | pt = new Point(x, y); 39 | size = _size; 40 | angle = _angle; 41 | response = _response; 42 | octave = _octave; 43 | class_id = _class_id; 44 | } 45 | 46 | // javadoc: KeyPoint::KeyPoint() 47 | public KeyPoint() 48 | { 49 | this(0, 0, 0, -1, 0, 0, -1); 50 | } 51 | 52 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response, _octave) 53 | public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave) 54 | { 55 | this(x, y, _size, _angle, _response, _octave, -1); 56 | } 57 | 58 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response) 59 | public KeyPoint(float x, float y, float _size, float _angle, float _response) 60 | { 61 | this(x, y, _size, _angle, _response, 0, -1); 62 | } 63 | 64 | // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle) 65 | public KeyPoint(float x, float y, float _size, float _angle) 66 | { 67 | this(x, y, _size, _angle, 0, 0, -1); 68 | } 69 | 70 | // javadoc: KeyPoint::KeyPoint(x, y, _size) 71 | public KeyPoint(float x, float y, float _size) 72 | { 73 | this(x, y, _size, -1, 0, 0, -1); 74 | } 75 | 76 | @Override 77 | public String toString() { 78 | return "KeyPoint [pt=" + pt + ", size=" + size + ", angle=" + angle 79 | + ", response=" + response + ", octave=" + octave 80 | + ", class_id=" + class_id + "]"; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/core/MatOfDMatch.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import org.opencv.core.DMatch; 7 | 8 | public class MatOfDMatch extends Mat { 9 | // 32FC4 10 | private static final int _depth = CvType.CV_32F; 11 | private static final int _channels = 4; 12 | 13 | public MatOfDMatch() { 14 | super(); 15 | } 16 | 17 | protected MatOfDMatch(long addr) { 18 | super(addr); 19 | if( !empty() && checkVector(_channels, _depth) < 0 ) 20 | throw new IllegalArgumentException("Incompatible Mat: " + toString()); 21 | //FIXME: do we need release() here? 22 | } 23 | 24 | public static MatOfDMatch fromNativeAddr(long addr) { 25 | return new MatOfDMatch(addr); 26 | } 27 | 28 | public MatOfDMatch(Mat m) { 29 | super(m, Range.all()); 30 | if( !empty() && checkVector(_channels, _depth) < 0 ) 31 | throw new IllegalArgumentException("Incompatible Mat: " + toString()); 32 | //FIXME: do we need release() here? 33 | } 34 | 35 | public MatOfDMatch(DMatch...ap) { 36 | super(); 37 | fromArray(ap); 38 | } 39 | 40 | public void alloc(int elemNumber) { 41 | if(elemNumber>0) 42 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 43 | } 44 | 45 | 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 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/util/color/ColorSpace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | */ 5 | package org.lasarobotics.vision.util.color; 6 | 7 | import org.opencv.imgproc.Imgproc; 8 | 9 | /** 10 | * Specifies a color space (such as RGB or HSV) and all possible conversions 11 | */ 12 | public enum ColorSpace { 13 | RGBA(new int[][]{null, 14 | new int[]{Imgproc.COLOR_RGBA2RGB, 4, 3}, 15 | new int[]{Imgproc.COLOR_RGBA2RGB, 4, 3, Imgproc.COLOR_RGB2HSV_FULL, 3, 3}, 16 | new int[]{Imgproc.COLOR_RGBA2GRAY, 4, 1}}, 17 | ColorRGBA.class), 18 | 19 | RGB(new int[][]{new int[]{Imgproc.COLOR_RGB2RGBA, 3, 4}, 20 | null, 21 | new int[]{Imgproc.COLOR_RGB2HSV_FULL, 3, 3}, 22 | new int[]{Imgproc.COLOR_RGB2GRAY, 3, 1}}, 23 | ColorRGBA.class), 24 | 25 | HSV(new int[][]{new int[]{Imgproc.COLOR_HSV2RGB_FULL, 3, 3, Imgproc.COLOR_RGB2RGBA, 3, 4}, 26 | new int[]{Imgproc.COLOR_HSV2RGB_FULL, 3, 3}, 27 | null, 28 | new int[]{Imgproc.COLOR_HSV2RGB_FULL, 3, 3, Imgproc.COLOR_RGB2GRAY, 3, 1}}, 29 | ColorHSV.class), 30 | 31 | GRAY(new int[][]{new int[]{Imgproc.COLOR_GRAY2RGBA, 1, 4}, 32 | new int[]{Imgproc.COLOR_GRAY2RGB, 1, 3}, 33 | new int[]{Imgproc.COLOR_GRAY2RGB, 1, 3, Imgproc.COLOR_RGB2HSV_FULL, 3, 3}, 34 | null}, 35 | ColorGRAY.class); 36 | 37 | /** 38 | * Each conversions array contains a list of int[], one for each other ColorSpace to convert to. 39 | *

40 | * Each int[] contains a list of operations and sizes, as such: 41 | * { operation, input scalar dimension, output scalar dimension, ... } 42 | */ 43 | private final int[][] conversions; 44 | /** 45 | * The class associated with a color - allows for dynamic casting to the class type 46 | */ 47 | private final Class colorClass; 48 | 49 | ColorSpace(int[][] conversions, Class colorClass) { 50 | this.conversions = conversions; 51 | this.colorClass = colorClass; 52 | } 53 | 54 | int[] getConversionsTo(ColorSpace to) { 55 | return conversions[to.ordinal()]; 56 | } 57 | 58 | Class getColorClass() { 59 | return colorClass; 60 | } 61 | 62 | /** 63 | * Tests whether the current color space can be converted to another 64 | * 65 | * @param to The color space to convert to 66 | * @return True if convertable, false otherwise 67 | */ 68 | public boolean canConvertTo(ColorSpace to) { 69 | return (to == this) || (getConversionsTo(to) != null); 70 | } 71 | } -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/photo/CalibrateRobertson.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | import org.opencv.core.Mat; 8 | 9 | // C++: class CalibrateRobertson 10 | //javadoc: CalibrateRobertson 11 | public class CalibrateRobertson extends CalibrateCRF { 12 | 13 | protected CalibrateRobertson(long addr) { super(addr); } 14 | 15 | 16 | // 17 | // C++: int getMaxIter() 18 | // 19 | 20 | //javadoc: CalibrateRobertson::getMaxIter() 21 | public int getMaxIter() 22 | { 23 | 24 | int retVal = getMaxIter_0(nativeObj); 25 | 26 | return retVal; 27 | } 28 | 29 | 30 | // 31 | // C++: void setMaxIter(int max_iter) 32 | // 33 | 34 | //javadoc: CalibrateRobertson::setMaxIter(max_iter) 35 | public void setMaxIter(int max_iter) 36 | { 37 | 38 | setMaxIter_0(nativeObj, max_iter); 39 | 40 | return; 41 | } 42 | 43 | 44 | // 45 | // C++: float getThreshold() 46 | // 47 | 48 | //javadoc: CalibrateRobertson::getThreshold() 49 | public float getThreshold() 50 | { 51 | 52 | float retVal = getThreshold_0(nativeObj); 53 | 54 | return retVal; 55 | } 56 | 57 | 58 | // 59 | // C++: void setThreshold(float threshold) 60 | // 61 | 62 | //javadoc: CalibrateRobertson::setThreshold(threshold) 63 | public void setThreshold(float threshold) 64 | { 65 | 66 | setThreshold_0(nativeObj, threshold); 67 | 68 | return; 69 | } 70 | 71 | 72 | // 73 | // C++: Mat getRadiance() 74 | // 75 | 76 | //javadoc: CalibrateRobertson::getRadiance() 77 | public Mat getRadiance() 78 | { 79 | 80 | Mat retVal = new Mat(getRadiance_0(nativeObj)); 81 | 82 | return retVal; 83 | } 84 | 85 | 86 | @Override 87 | protected void finalize() throws Throwable { 88 | delete(nativeObj); 89 | } 90 | 91 | 92 | 93 | // C++: int getMaxIter() 94 | private static native int getMaxIter_0(long nativeObj); 95 | 96 | // C++: void setMaxIter(int max_iter) 97 | private static native void setMaxIter_0(long nativeObj, int max_iter); 98 | 99 | // C++: float getThreshold() 100 | private static native float getThreshold_0(long nativeObj); 101 | 102 | // C++: void setThreshold(float threshold) 103 | private static native void setThreshold_0(long nativeObj, float threshold); 104 | 105 | // C++: Mat getRadiance() 106 | private static native long getRadiance_0(long nativeObj); 107 | 108 | // native support for java finalize() 109 | private static native void delete(long nativeObj); 110 | 111 | } 112 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/menu/ftc_robot_controller.xml: -------------------------------------------------------------------------------- 1 | 33 | 34 |

35 | 36 | 41 | 46 | 47 | 52 | 53 | 58 | 59 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/core/MatOfKeyPoint.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import org.opencv.core.KeyPoint; 7 | 8 | public class MatOfKeyPoint extends Mat { 9 | // 32FC7 10 | private static final int _depth = CvType.CV_32F; 11 | private static final int _channels = 7; 12 | 13 | public MatOfKeyPoint() { 14 | super(); 15 | } 16 | 17 | protected MatOfKeyPoint(long addr) { 18 | super(addr); 19 | if( !empty() && checkVector(_channels, _depth) < 0 ) 20 | throw new IllegalArgumentException("Incompatible Mat"); 21 | //FIXME: do we need release() here? 22 | } 23 | 24 | public static MatOfKeyPoint fromNativeAddr(long addr) { 25 | return new MatOfKeyPoint(addr); 26 | } 27 | 28 | public MatOfKeyPoint(Mat m) { 29 | super(m, Range.all()); 30 | if( !empty() && checkVector(_channels, _depth) < 0 ) 31 | throw new IllegalArgumentException("Incompatible Mat"); 32 | //FIXME: do we need release() here? 33 | } 34 | 35 | public MatOfKeyPoint(KeyPoint...a) { 36 | super(); 37 | fromArray(a); 38 | } 39 | 40 | public void alloc(int elemNumber) { 41 | if(elemNumber>0) 42 | super.create(elemNumber, 1, CvType.makeType(_depth, _channels)); 43 | } 44 | 45 | public void fromArray(KeyPoint...a) { 46 | if(a==null || a.length==0) 47 | return; 48 | int num = a.length; 49 | alloc(num); 50 | float buff[] = new float[num * _channels]; 51 | for(int i=0; i 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 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/layout/header.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 35 | 36 | 47 | 48 | 56 | 57 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /opencv-java/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 ? 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 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/FtcOpModeRegister.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, 2015 Qualcomm Technologies Inc 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted (subject to the limitations in the disclaimer below) provided that 7 | the following conditions are met: 8 | 9 | Redistributions of source code must retain the above copyright notice, this list 10 | of conditions and the following disclaimer. 11 | 12 | Redistributions in binary form must reproduce the above copyright notice, this 13 | list of conditions and the following disclaimer in the documentation and/or 14 | other materials provided with the distribution. 15 | 16 | Neither the name of Qualcomm Technologies Inc nor the names of its contributors 17 | may be used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS 21 | LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 23 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 25 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 31 | 32 | package com.qualcomm.ftcrobotcontroller.opmodes; 33 | 34 | import com.qualcomm.robotcore.eventloop.opmode.OpModeManager; 35 | import com.qualcomm.robotcore.eventloop.opmode.OpModeRegister; 36 | 37 | /** 38 | * Register Op Modes 39 | */ 40 | public class FtcOpModeRegister implements OpModeRegister { 41 | 42 | /** 43 | * The Op Mode Manager will call this method when it wants a list of all 44 | * available op modes. Add your op mode to the list to enable it. 45 | * 46 | * @param manager op mode manager 47 | */ 48 | public void register(OpModeManager manager) { 49 | 50 | /* 51 | * register your op modes here. 52 | * The first parameter is the name of the op mode 53 | * The second parameter is the op mode class property 54 | * 55 | * If two or more op modes are registered with the same name, the app will display an error. 56 | */ 57 | manager.register("NullOp", NullOp.class); 58 | manager.register("Basic Vision Sample", BasicVisionSample.class); 59 | manager.register("Linear Vision Sample", LinearVisionSample.class); 60 | manager.register("Manual Vision Sample", ManualVisionSample.class); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/core/Rect.java: -------------------------------------------------------------------------------- 1 | package org.opencv.core; 2 | 3 | //javadoc:Rect_ 4 | public class Rect { 5 | 6 | public int x, y, width, height; 7 | 8 | public Rect(int x, int y, int width, int height) { 9 | this.x = x; 10 | this.y = y; 11 | this.width = width; 12 | this.height = height; 13 | } 14 | 15 | public Rect() { 16 | this(0, 0, 0, 0); 17 | } 18 | 19 | public Rect(Point p1, Point p2) { 20 | x = (int) (p1.x < p2.x ? p1.x : p2.x); 21 | y = (int) (p1.y < p2.y ? p1.y : p2.y); 22 | width = (int) (p1.x > p2.x ? p1.x : p2.x) - x; 23 | height = (int) (p1.y > p2.y ? p1.y : p2.y) - y; 24 | } 25 | 26 | public Rect(Point p, Size s) { 27 | this((int) p.x, (int) p.y, (int) s.width, (int) s.height); 28 | } 29 | 30 | public Rect(double[] vals) { 31 | set(vals); 32 | } 33 | 34 | public void set(double[] vals) { 35 | if (vals != null) { 36 | x = vals.length > 0 ? (int) vals[0] : 0; 37 | y = vals.length > 1 ? (int) vals[1] : 0; 38 | width = vals.length > 2 ? (int) vals[2] : 0; 39 | height = vals.length > 3 ? (int) vals[3] : 0; 40 | } else { 41 | x = 0; 42 | y = 0; 43 | width = 0; 44 | height = 0; 45 | } 46 | } 47 | 48 | public Rect clone() { 49 | return new Rect(x, y, width, height); 50 | } 51 | 52 | public Point tl() { 53 | return new Point(x, y); 54 | } 55 | 56 | public Point br() { 57 | return new Point(x + width, y + height); 58 | } 59 | 60 | public Size size() { 61 | return new Size(width, height); 62 | } 63 | 64 | public double area() { 65 | return width * height; 66 | } 67 | 68 | public boolean contains(Point p) { 69 | return x <= p.x && p.x < x + width && y <= p.y && p.y < y + height; 70 | } 71 | 72 | @Override 73 | public int hashCode() { 74 | final int prime = 31; 75 | int result = 1; 76 | long temp; 77 | temp = Double.doubleToLongBits(height); 78 | result = prime * result + (int) (temp ^ (temp >>> 32)); 79 | temp = Double.doubleToLongBits(width); 80 | result = prime * result + (int) (temp ^ (temp >>> 32)); 81 | temp = Double.doubleToLongBits(x); 82 | result = prime * result + (int) (temp ^ (temp >>> 32)); 83 | temp = Double.doubleToLongBits(y); 84 | result = prime * result + (int) (temp ^ (temp >>> 32)); 85 | return result; 86 | } 87 | 88 | @Override 89 | public boolean equals(Object obj) { 90 | if (this == obj) return true; 91 | if (!(obj instanceof Rect)) return false; 92 | Rect it = (Rect) obj; 93 | return x == it.x && y == it.y && width == it.width && height == it.height; 94 | } 95 | 96 | @Override 97 | public String toString() { 98 | return "{" + x + ", " + y + ", " + width + "x" + height + "}"; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/NullOp.java: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2014, 2015 Qualcomm Technologies Inc 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted (subject to the limitations in the disclaimer below) provided that 7 | the following conditions are met: 8 | 9 | Redistributions of source code must retain the above copyright notice, this list 10 | of conditions and the following disclaimer. 11 | 12 | Redistributions in binary form must reproduce the above copyright notice, this 13 | list of conditions and the following disclaimer in the documentation and/or 14 | other materials provided with the distribution. 15 | 16 | Neither the name of Qualcomm Technologies Inc nor the names of its contributors 17 | may be used to endorse or promote products derived from this software without 18 | specific prior written permission. 19 | 20 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS 21 | LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 23 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 25 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 31 | 32 | package com.qualcomm.ftcrobotcontroller.opmodes; 33 | 34 | import com.qualcomm.robotcore.eventloop.opmode.OpMode; 35 | import com.qualcomm.robotcore.util.ElapsedTime; 36 | 37 | import java.text.SimpleDateFormat; 38 | import java.util.Date; 39 | 40 | /** 41 | * TeleOp Mode 42 | *

43 | * Enables control of the robot via the gamepad 44 | */ 45 | public class NullOp extends OpMode { 46 | 47 | private String startDate; 48 | private ElapsedTime runtime = new ElapsedTime(); 49 | 50 | @Override 51 | public void init() { 52 | } 53 | 54 | /* 55 | * Code to run when the op mode is first enabled goes here 56 | * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#start() 57 | */ 58 | @Override 59 | public void init_loop() { 60 | startDate = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(new Date()); 61 | runtime.reset(); 62 | telemetry.addData("Null Op Init Loop", runtime.toString()); 63 | } 64 | 65 | /* 66 | * This method will be called repeatedly in a loop 67 | * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#loop() 68 | */ 69 | @Override 70 | public void loop() { 71 | telemetry.addData("1 Start", "NullOp started at " + startDate); 72 | telemetry.addData("2 Status", "running for " + runtime.toString()); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /opencv-java/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_java3"); 96 | } 97 | 98 | return result; 99 | } 100 | 101 | private static final String TAG = "OpenCV/StaticHelper"; 102 | 103 | private static native String getLibraryList(); 104 | } 105 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/photo/CalibrateDebevec.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | 8 | 9 | // C++: class CalibrateDebevec 10 | //javadoc: CalibrateDebevec 11 | public class CalibrateDebevec extends CalibrateCRF { 12 | 13 | protected CalibrateDebevec(long addr) { super(addr); } 14 | 15 | 16 | // 17 | // C++: float getLambda() 18 | // 19 | 20 | //javadoc: CalibrateDebevec::getLambda() 21 | public float getLambda() 22 | { 23 | 24 | float retVal = getLambda_0(nativeObj); 25 | 26 | return retVal; 27 | } 28 | 29 | 30 | // 31 | // C++: void setLambda(float lambda) 32 | // 33 | 34 | //javadoc: CalibrateDebevec::setLambda(lambda) 35 | public void setLambda(float lambda) 36 | { 37 | 38 | setLambda_0(nativeObj, lambda); 39 | 40 | return; 41 | } 42 | 43 | 44 | // 45 | // C++: int getSamples() 46 | // 47 | 48 | //javadoc: CalibrateDebevec::getSamples() 49 | public int getSamples() 50 | { 51 | 52 | int retVal = getSamples_0(nativeObj); 53 | 54 | return retVal; 55 | } 56 | 57 | 58 | // 59 | // C++: void setSamples(int samples) 60 | // 61 | 62 | //javadoc: CalibrateDebevec::setSamples(samples) 63 | public void setSamples(int samples) 64 | { 65 | 66 | setSamples_0(nativeObj, samples); 67 | 68 | return; 69 | } 70 | 71 | 72 | // 73 | // C++: bool getRandom() 74 | // 75 | 76 | //javadoc: CalibrateDebevec::getRandom() 77 | public boolean getRandom() 78 | { 79 | 80 | boolean retVal = getRandom_0(nativeObj); 81 | 82 | return retVal; 83 | } 84 | 85 | 86 | // 87 | // C++: void setRandom(bool random) 88 | // 89 | 90 | //javadoc: CalibrateDebevec::setRandom(random) 91 | public void setRandom(boolean random) 92 | { 93 | 94 | setRandom_0(nativeObj, random); 95 | 96 | return; 97 | } 98 | 99 | 100 | @Override 101 | protected void finalize() throws Throwable { 102 | delete(nativeObj); 103 | } 104 | 105 | 106 | 107 | // C++: float getLambda() 108 | private static native float getLambda_0(long nativeObj); 109 | 110 | // C++: void setLambda(float lambda) 111 | private static native void setLambda_0(long nativeObj, float lambda); 112 | 113 | // C++: int getSamples() 114 | private static native int getSamples_0(long nativeObj); 115 | 116 | // C++: void setSamples(int samples) 117 | private static native void setSamples_0(long nativeObj, int samples); 118 | 119 | // C++: bool getRandom() 120 | private static native boolean getRandom_0(long nativeObj); 121 | 122 | // C++: void setRandom(bool random) 123 | private static native void setRandom_0(long nativeObj, boolean random); 124 | 125 | // native support for java finalize() 126 | private static native void delete(long nativeObj); 127 | 128 | } 129 | -------------------------------------------------------------------------------- /opencv-java/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 3.0.0. 62 | */ 63 | public static final String OPENCV_VERSION_3_0_0 = "3.0.0"; 64 | 65 | 66 | /** 67 | * Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java"). 68 | * @return Returns true is initialization of OpenCV was successful. 69 | */ 70 | public static boolean initDebug() 71 | { 72 | return StaticHelper.initOpenCV(false); 73 | } 74 | 75 | /** 76 | * Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java"). 77 | * @param InitCuda load and initialize CUDA runtime libraries. 78 | * @return Returns true is initialization of OpenCV was successful. 79 | */ 80 | public static boolean initDebug(boolean InitCuda) 81 | { 82 | return StaticHelper.initOpenCV(InitCuda); 83 | } 84 | 85 | /** 86 | * Loads and initializes OpenCV library using OpenCV Engine service. 87 | * @param Version OpenCV library version. 88 | * @param AppContext application context for connecting to the service. 89 | * @param Callback object, that implements LoaderCallbackInterface for handling the connection status. 90 | * @return Returns true if initialization of OpenCV is successful. 91 | */ 92 | public static boolean initAsync(String Version, Context AppContext, 93 | LoaderCallbackInterface Callback) 94 | { 95 | return AsyncServiceHelper.initOpenCV(Version, AppContext, Callback); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /ftc-visionlib/src/main/java/org/lasarobotics/vision/ftc/resq/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Arthur Pachachura, LASA Robotics, and contributors 3 | * MIT licensed 4 | */ 5 | 6 | package org.lasarobotics.vision.ftc.resq; 7 | 8 | import org.lasarobotics.vision.util.color.ColorHSV; 9 | 10 | /** 11 | * Res-Q field and object constants 12 | */ 13 | public abstract class Constants { 14 | //BEACON 15 | public static final double BEACON_WIDTH = 21.8; //entire beacon width 16 | public static final double BEACON_HEIGHT = 14.5; //entire beacon height 17 | public static final double BEACON_WH_RATIO = BEACON_WIDTH / BEACON_HEIGHT; //entire beacon ratio 18 | public static final ColorHSV COLOR_RED_LOWER = new ColorHSV((int) (300.0 / 360.0 * 255.0), (int) (0.090 * 255.0), (int) (0.500 * 255.0)); 19 | public static final ColorHSV COLOR_RED_UPPER = new ColorHSV((int) (400.0 / 360.0 * 255.0), 255, 255); 20 | public static final ColorHSV COLOR_BLUE_LOWER = new ColorHSV((int) (170.0 / 360.0 * 255.0), (int) (0.090 * 255.0), (int) (0.500 * 255.0)); 21 | public static final ColorHSV COLOR_BLUE_UPPER = new ColorHSV((int) (270.0 / 360.0 * 255.0), 255, 255); 22 | //FAST 23 | static final double ELLIPSE_SCORE_REQ = 10.0; 24 | static final double DETECTION_MIN_DISTANCE = 0.1; 25 | static final double ELLIPSE_MIN_DISTANCE = 0.15; 26 | static final double ELLIPSE_PRESENCE_BIAS = 1.5; 27 | static final double FAST_HEIGHT_DELTA_FACTOR = 4.0; 28 | static final double FAST_CONFIDENCE_NORM = 5.0; 29 | static final double FAST_CONFIDENCE_ROUNDNESS = 2.0; 30 | static final double FAST_ELLIPSE_MISMATCH_DIVISOR = 3.0; 31 | //COMPLEX 32 | static final double CONFIDENCE_DIVISOR = 800; 33 | static final double CONTOUR_RATIO_NORM = 0.2; //normal distribution variance for ratio 34 | static final double CONTOUR_RATIO_BIAS = 3.0; //points given at best ratio 35 | static final double CONTOUR_AREA_MIN = Math.log10(0.01); 36 | static final double CONTOUR_AREA_MAX = Math.log10(25.00); 37 | static final double CONTOUR_AREA_NORM = 0.4; 38 | static final double CONTOUR_AREA_BIAS = 6.0; 39 | static final double CONTOUR_SCORE_MIN = 1; 40 | static final double ELLIPSE_ECCENTRICITY_BEST = 0.4; //best eccentricity for 100% score 41 | static final double ELLIPSE_ECCENTRICITY_BIAS = 3.0; //points given at best eccentricity 42 | static final double ELLIPSE_ECCENTRICITY_NORM = 0.1; //normal distribution variance for eccentricity 43 | static final double ELLIPSE_AREA_MIN = 0.0001; //minimum area as percentage of screen (0 points) 44 | static final double ELLIPSE_AREA_MAX = 0.01; //maximum area (0 points given) 45 | static final double ELLIPSE_AREA_NORM = 1; 46 | static final double ELLIPSE_AREA_BIAS = 2.0; 47 | static final double ELLIPSE_CONTRAST_THRESHOLD = 60.0; 48 | static final double ELLIPSE_CONTRAST_BIAS = 7.0; 49 | static final double ELLIPSE_CONTRAST_NORM = 0.1; 50 | static final double ELLIPSE_SCORE_MIN = 1; //minimum score to keep the ellipse - theoretically, should be 1 51 | static final double ASSOCIATION_MAX_DISTANCE = 0.10; //as fraction of screen 52 | static final double ASSOCIATION_NO_ELLIPSE_FACTOR = 0.50; 53 | static final double ASSOCIATION_ELLIPSE_SCORE_MULTIPLIER = 0.75; 54 | static final double CONTOUR_RATIO_BEST = BEACON_WH_RATIO; //best ratio for 100% score 55 | } 56 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 33 | 34 | 35 | 36 | 40 | 47 | 48 | 49 | 56 | 57 | 60 | 61 | 64 | 65 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/imgproc/CLAHE.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.imgproc; 6 | 7 | import org.opencv.core.Algorithm; 8 | import org.opencv.core.Mat; 9 | import org.opencv.core.Size; 10 | 11 | // C++: class CLAHE 12 | //javadoc: CLAHE 13 | public class CLAHE extends Algorithm { 14 | 15 | protected CLAHE(long addr) { super(addr); } 16 | 17 | 18 | // 19 | // C++: void setClipLimit(double clipLimit) 20 | // 21 | 22 | //javadoc: CLAHE::setClipLimit(clipLimit) 23 | public void setClipLimit(double clipLimit) 24 | { 25 | 26 | setClipLimit_0(nativeObj, clipLimit); 27 | 28 | return; 29 | } 30 | 31 | 32 | // 33 | // C++: void apply(Mat src, Mat& dst) 34 | // 35 | 36 | //javadoc: CLAHE::apply(src, dst) 37 | public void apply(Mat src, Mat dst) 38 | { 39 | 40 | apply_0(nativeObj, src.nativeObj, dst.nativeObj); 41 | 42 | return; 43 | } 44 | 45 | 46 | // 47 | // C++: double getClipLimit() 48 | // 49 | 50 | //javadoc: CLAHE::getClipLimit() 51 | public double getClipLimit() 52 | { 53 | 54 | double retVal = getClipLimit_0(nativeObj); 55 | 56 | return retVal; 57 | } 58 | 59 | 60 | // 61 | // C++: void setTilesGridSize(Size tileGridSize) 62 | // 63 | 64 | //javadoc: CLAHE::setTilesGridSize(tileGridSize) 65 | public void setTilesGridSize(Size tileGridSize) 66 | { 67 | 68 | setTilesGridSize_0(nativeObj, tileGridSize.width, tileGridSize.height); 69 | 70 | return; 71 | } 72 | 73 | 74 | // 75 | // C++: void collectGarbage() 76 | // 77 | 78 | //javadoc: CLAHE::collectGarbage() 79 | public void collectGarbage() 80 | { 81 | 82 | collectGarbage_0(nativeObj); 83 | 84 | return; 85 | } 86 | 87 | 88 | // 89 | // C++: Size getTilesGridSize() 90 | // 91 | 92 | //javadoc: CLAHE::getTilesGridSize() 93 | public Size getTilesGridSize() 94 | { 95 | 96 | Size retVal = new Size(getTilesGridSize_0(nativeObj)); 97 | 98 | return retVal; 99 | } 100 | 101 | 102 | @Override 103 | protected void finalize() throws Throwable { 104 | delete(nativeObj); 105 | } 106 | 107 | 108 | 109 | // C++: void setClipLimit(double clipLimit) 110 | private static native void setClipLimit_0(long nativeObj, double clipLimit); 111 | 112 | // C++: void apply(Mat src, Mat& dst) 113 | private static native void apply_0(long nativeObj, long src_nativeObj, long dst_nativeObj); 114 | 115 | // C++: double getClipLimit() 116 | private static native double getClipLimit_0(long nativeObj); 117 | 118 | // C++: void setTilesGridSize(Size tileGridSize) 119 | private static native void setTilesGridSize_0(long nativeObj, double tileGridSize_width, double tileGridSize_height); 120 | 121 | // C++: void collectGarbage() 122 | private static native void collectGarbage_0(long nativeObj); 123 | 124 | // C++: Size getTilesGridSize() 125 | private static native double[] getTilesGridSize_0(long nativeObj); 126 | 127 | // native support for java finalize() 128 | private static native void delete(long nativeObj); 129 | 130 | } 131 | -------------------------------------------------------------------------------- /opencv-java/src/main/java/org/opencv/photo/TonemapReinhard.java: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // This file is auto-generated. Please don't modify it! 4 | // 5 | package org.opencv.photo; 6 | 7 | 8 | 9 | // C++: class TonemapReinhard 10 | //javadoc: TonemapReinhard 11 | public class TonemapReinhard extends Tonemap { 12 | 13 | protected TonemapReinhard(long addr) { super(addr); } 14 | 15 | 16 | // 17 | // C++: float getIntensity() 18 | // 19 | 20 | //javadoc: TonemapReinhard::getIntensity() 21 | public float getIntensity() 22 | { 23 | 24 | float retVal = getIntensity_0(nativeObj); 25 | 26 | return retVal; 27 | } 28 | 29 | 30 | // 31 | // C++: void setIntensity(float intensity) 32 | // 33 | 34 | //javadoc: TonemapReinhard::setIntensity(intensity) 35 | public void setIntensity(float intensity) 36 | { 37 | 38 | setIntensity_0(nativeObj, intensity); 39 | 40 | return; 41 | } 42 | 43 | 44 | // 45 | // C++: float getLightAdaptation() 46 | // 47 | 48 | //javadoc: TonemapReinhard::getLightAdaptation() 49 | public float getLightAdaptation() 50 | { 51 | 52 | float retVal = getLightAdaptation_0(nativeObj); 53 | 54 | return retVal; 55 | } 56 | 57 | 58 | // 59 | // C++: void setLightAdaptation(float light_adapt) 60 | // 61 | 62 | //javadoc: TonemapReinhard::setLightAdaptation(light_adapt) 63 | public void setLightAdaptation(float light_adapt) 64 | { 65 | 66 | setLightAdaptation_0(nativeObj, light_adapt); 67 | 68 | return; 69 | } 70 | 71 | 72 | // 73 | // C++: float getColorAdaptation() 74 | // 75 | 76 | //javadoc: TonemapReinhard::getColorAdaptation() 77 | public float getColorAdaptation() 78 | { 79 | 80 | float retVal = getColorAdaptation_0(nativeObj); 81 | 82 | return retVal; 83 | } 84 | 85 | 86 | // 87 | // C++: void setColorAdaptation(float color_adapt) 88 | // 89 | 90 | //javadoc: TonemapReinhard::setColorAdaptation(color_adapt) 91 | public void setColorAdaptation(float color_adapt) 92 | { 93 | 94 | setColorAdaptation_0(nativeObj, color_adapt); 95 | 96 | return; 97 | } 98 | 99 | 100 | @Override 101 | protected void finalize() throws Throwable { 102 | delete(nativeObj); 103 | } 104 | 105 | 106 | 107 | // C++: float getIntensity() 108 | private static native float getIntensity_0(long nativeObj); 109 | 110 | // C++: void setIntensity(float intensity) 111 | private static native void setIntensity_0(long nativeObj, float intensity); 112 | 113 | // C++: float getLightAdaptation() 114 | private static native float getLightAdaptation_0(long nativeObj); 115 | 116 | // C++: void setLightAdaptation(float light_adapt) 117 | private static native void setLightAdaptation_0(long nativeObj, float light_adapt); 118 | 119 | // C++: float getColorAdaptation() 120 | private static native float getColorAdaptation_0(long nativeObj); 121 | 122 | // C++: void setColorAdaptation(float color_adapt) 123 | private static native void setColorAdaptation_0(long nativeObj, float color_adapt); 124 | 125 | // native support for java finalize() 126 | private static native void delete(long nativeObj); 127 | 128 | } 129 | -------------------------------------------------------------------------------- /ftc-robotcontroller/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 35 | 36 | 37 | 38 | FTC Robot Controller 39 | OK 40 | 41 | Robot Configuration Settings 42 | Configure Robot 43 | Wifi Channel Selection 44 | 45 | Restart Robot 46 | Exit 47 | About 48 | Settings 49 | Settings 50 | pref_hardware_config_filename 51 | Settings 52 | Autoconfigure Robot 53 | 54 | 55 | Configure Wifi Direct 56 | 57 | 58 | View logs 59 | View logs 60 | View Logs 61 | Clear Logs 62 | 63 | 64 | pref_launch_settings 65 | Change Wifi Channel 66 | pref_launch_configure 67 | pref_launch_autoconfigure 68 | 69 | 70 | --------------------------------------------------------------------------------