points) {
+ if (points.size() == 0) return null;
+ double x = 0;
+ double y = 0;
+ for(Point point : points) {
+ x += Math.pow(point.x, 2);
+ y += Math.pow(point.y, 2);
+ }
+ return new Point(Math.sqrt(x/points.size()), Math.sqrt(y/points.size()));
+ }
+}
\ No newline at end of file
diff --git a/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/ColorDevScorer.java b/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/ColorDevScorer.java
new file mode 100644
index 00000000000..57c1c67903f
--- /dev/null
+++ b/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/ColorDevScorer.java
@@ -0,0 +1,28 @@
+package com.disnodeteam.dogecv.scoring;
+
+import com.disnodeteam.dogecv.math.MathFTC;
+
+import org.opencv.core.Core;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfDouble;
+import org.opencv.core.MatOfPoint;
+
+/**
+ * Created by LeviG on 10/7/2018.
+ */
+
+public class ColorDevScorer extends DogeCVScorer{
+
+ private MatOfDouble std = new MatOfDouble();
+ private MatOfDouble mean = new MatOfDouble();
+
+ /**
+ * @param input - Input mat
+ * @return - Difference from perfect score
+ */
+ @Override
+ public double calculateScore(Mat input) {
+ Core.meanStdDev(input, mean, std);
+ return MathFTC.mean(std.get(0,0));
+ }
+}
diff --git a/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/DogeCVScorer.java b/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/DogeCVScorer.java
new file mode 100644
index 00000000000..01591982aaf
--- /dev/null
+++ b/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/DogeCVScorer.java
@@ -0,0 +1,15 @@
+package com.disnodeteam.dogecv.scoring;
+
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfPoint;
+import org.opencv.core.Rect;
+
+import java.util.List;
+
+/**
+ * Created by Victo on 9/10/2018.
+ */
+
+public abstract class DogeCVScorer {
+ public abstract double calculateScore(Mat input);
+}
diff --git a/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/MaxAreaScorer.java b/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/MaxAreaScorer.java
new file mode 100644
index 00000000000..b6311640fc3
--- /dev/null
+++ b/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/MaxAreaScorer.java
@@ -0,0 +1,38 @@
+package com.disnodeteam.dogecv.scoring;
+
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfPoint;
+import org.opencv.core.MatOfPoint2f;
+import org.opencv.core.Rect;
+import org.opencv.imgproc.Imgproc;
+
+/**
+ * Created by Victo on 9/10/2018.
+ */
+
+public class MaxAreaScorer extends DogeCVScorer{
+ public double weight = 1.0;
+ /**
+ * Constructor
+ * @param weight - How much to weight the final score (1-10 is usually good)
+ */
+ public MaxAreaScorer( double weight){
+ this.weight = weight;
+
+ }
+
+ /**
+ * Calculate the score
+ * @param input - Input mat (Can be MatOfPoint for contours)
+ * @return - Difference from perfect score
+ */
+ @Override
+ public double calculateScore(Mat input) {
+ if(!(input instanceof MatOfPoint)) return Double.MAX_VALUE;
+ MatOfPoint contour = (MatOfPoint) input;
+ double area = Imgproc.contourArea(contour);
+
+ return -area * weight;
+ }
+
+}
diff --git a/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/PerfectAreaScorer.java b/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/PerfectAreaScorer.java
new file mode 100644
index 00000000000..f260484a686
--- /dev/null
+++ b/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/PerfectAreaScorer.java
@@ -0,0 +1,36 @@
+package com.disnodeteam.dogecv.scoring;
+
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfPoint;
+import org.opencv.imgproc.Imgproc;
+
+/**
+ * Created by Victo on 9/10/2018.
+ */
+
+public class PerfectAreaScorer extends DogeCVScorer {
+ public double weight = 1.0;
+ public double perfectArea = 5000;
+ /**
+ * Constructor
+ * @param perfectArea - Perfect area in pixels
+ * @param weight - How much to weight the final score (0.001 - 0.1 is usually good)
+ */
+ public PerfectAreaScorer(double perfectArea, double weight){
+ this.weight = weight;
+ this.perfectArea = perfectArea;
+
+ }
+ /**
+ * @param input - Input mat (Can be MatOfPoint for contours)
+ * @return - Difference from perfect score
+ */
+ @Override
+ public double calculateScore(Mat input) {
+ if(!(input instanceof MatOfPoint)) return Double.MAX_VALUE;
+ MatOfPoint contour = (MatOfPoint) input;
+ double area = Imgproc.contourArea(contour);
+ double areaDiffrence = Math.abs(perfectArea - area);
+ return areaDiffrence * weight;
+ }
+}
diff --git a/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/RatioScorer.java b/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/RatioScorer.java
new file mode 100644
index 00000000000..e6aacb62fb3
--- /dev/null
+++ b/DogeCV/src/main/java/com/disnodeteam/dogecv/scoring/RatioScorer.java
@@ -0,0 +1,54 @@
+package com.disnodeteam.dogecv.scoring;
+
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfPoint;
+import org.opencv.core.MatOfPoint2f;
+import org.opencv.core.Point;
+import org.opencv.core.Rect;
+import org.opencv.imgproc.Imgproc;
+
+import java.util.List;
+
+/**
+ * Created by Victo on 9/10/2018.
+ */
+
+public class RatioScorer extends DogeCVScorer{
+
+ public double weight = 1.0;
+ public double perfectRatio = 1.0;
+ public RatioScorer(){
+
+ }
+
+ /**
+ * Constructor
+ * @param perfectRatio - Perfect ratio of height / width (abs value)
+ * @param weight - How much to weight the final score (1-10 is usually good)
+ */
+ public RatioScorer(double perfectRatio, double weight){
+ this.weight = weight;
+ this.perfectRatio = perfectRatio;
+ }
+ /**
+ * @param input - Input mat (Can be MatOfPoint for contours)
+ * @return - Difference from perfect score
+ */
+ @Override
+ public double calculateScore(Mat input) {
+ if(!(input instanceof MatOfPoint)) return Double.MAX_VALUE;
+ MatOfPoint contour = (MatOfPoint) input;
+ double score = Double.MAX_VALUE;
+
+ // Get bounding rect of contour
+ Rect rect = Imgproc.boundingRect(contour);
+ double x = rect.x;
+ double y = rect.y;
+ double w = rect.width;
+ double h = rect.height;
+
+ double cubeRatio = Math.max(Math.abs(h/w), Math.abs(w/h)); // Get the ratio. We use max in case h and w get swapped??? it happens when u account for rotation
+ double ratioDiffrence = Math.abs(cubeRatio - perfectRatio);
+ return ratioDiffrence * weight;
+ }
+}
diff --git a/DogeCV/src/main/jniLibs/armeabi-v7a/libopencv_java3.so b/DogeCV/src/main/jniLibs/armeabi-v7a/libopencv_java3.so
new file mode 100644
index 00000000000..38f1ba4f995
Binary files /dev/null and b/DogeCV/src/main/jniLibs/armeabi-v7a/libopencv_java3.so differ
diff --git a/DogeCV/src/main/res/values/strings.xml b/DogeCV/src/main/res/values/strings.xml
new file mode 100644
index 00000000000..72fdbe9e185
--- /dev/null
+++ b/DogeCV/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ CVFTC
+
diff --git a/FtcRobotController/build.gradle b/FtcRobotController/build.gradle
index daf4ee2d48a..e3e0f743713 100644
--- a/FtcRobotController/build.gradle
+++ b/FtcRobotController/build.gradle
@@ -18,6 +18,7 @@ android {
}
}
+
repositories {
flatDir {
dirs '../libs'
diff --git a/FtcRobotController/src/main/AndroidManifest.xml b/FtcRobotController/src/main/AndroidManifest.xml
index 8774c501fed..79c6e0b8573 100644
--- a/FtcRobotController/src/main/AndroidManifest.xml
+++ b/FtcRobotController/src/main/AndroidManifest.xml
@@ -6,6 +6,10 @@
android:versionName="5.0">
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TeamCode/build.gradle b/TeamCode/build.gradle
index 301ff649463..62bf6418417 100644
--- a/TeamCode/build.gradle
+++ b/TeamCode/build.gradle
@@ -13,3 +13,16 @@
// Include common definitions from above.
apply from: '../build.common.gradle'
+
+android {
+ compileOptions {
+ sourceCompatibility 1.8
+ targetCompatibility 1.8
+ }
+}
+
+dependencies {
+ implementation project(path: ':bluejay')
+ implementation project(path: ':openCVLibrary3')
+ implementation project(path: ':DogeCV')
+}
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/AlignFind.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/AlignFind.java
new file mode 100644
index 00000000000..9ac86344d02
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/AlignFind.java
@@ -0,0 +1,224 @@
+/* Copyright (c) 2019 FIRST. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted (subject to the limitations in the disclaimer below) provided that
+ * the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither the name of FIRST nor the names of its contributors may be used to endorse or
+ * promote products derived from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
+ * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.firstinspires.ftc.team6417;
+
+import com.qualcomm.hardware.bosch.BNO055IMU;
+import com.qualcomm.robotcore.util.ElapsedTime;
+import com.qualcomm.robotcore.util.Range;
+import org.firstinspires.ftc.robotcore.external.ClassFactory;
+import org.firstinspires.ftc.robotcore.external.matrices.OpenGLMatrix;
+import org.firstinspires.ftc.robotcore.external.matrices.VectorF;
+import org.firstinspires.ftc.robotcore.external.navigation.Acceleration;
+import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesReference;
+import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
+import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer;
+import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable;
+import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackableDefaultListener;
+import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackables;
+import org.firstinspires.ftc.robotcore.internal.vuforia.VuforiaException;
+import org.firstinspires.ftc.team6417.Hardware6417;
+
+import detectors.ClosableVuforiaLocalizer;
+
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
+import com.qualcomm.robotcore.util.RobotLog;
+
+import static org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection.BACK;
+
+
+@Autonomous(name="VueBoi", group ="Linear Opmode")
+
+public class AlignFind extends LinearOpMode {
+
+ private ElapsedTime searchTime = new ElapsedTime(0);
+
+ /* vuforia key */
+ private static final String VUFORIA_KEY =
+ "ARuvZIj/////AAABmVkUSkLsEkjjhzixTaJVlaFNlxHEjVM47c6y7GtSCjJmsGR3bNdALVunnoGjmIog/AUoVdmCsQmzWc2WS0R1Qh+EVA5/H+39wEZ1sohFZ9UGpyWT/1da4Mm0sUbB4/atlnNbCs9PzFCnd0cFDpbzWRSmQjkaxdBlDY9rFnOGrqdEzdT9hWK2NznebhyCFWITMTu94TYY1vbuiyD+08KBIgsMPypNZ8tVSrB405WNTN3ZEqU1a+tQd7ppLUOIYfcYLKuXHRIsmiybps87PkhD84d+/NiE1pinNwBhtxhMPYgqGf1HrE7H+AzKYJpgla1DyG8AMLL1pwJKsA3penrUGwGENWr6EkVHkMLfsQoe6Jym";
+
+ private static final int skystoneMid = -100; //X positions of skystone positions
+ private static final int skystoneCenter = 100;
+
+ // Class Members
+ private OpenGLMatrix skystonePositionCoords = null;
+ public VuforiaLocalizer vuforia = null;
+
+ private static final VuforiaLocalizer.CameraDirection CAMERA_CHOICE = BACK;
+ private static final boolean PHONE_IS_PORTRAIT = true;
+
+ /**
+ * This is the webcam we are to use. As with other hardware devices such as motors and
+ * servos, this device is identified using the robot configuration tool in the FTC application.
+ */
+
+ private boolean targetVisible = false;
+
+ private int skystonePosition = 4;
+
+ Hardware6417 robot = new Hardware6417();
+ BNO055IMU imu;
+ Orientation angles;
+ Acceleration gravity;
+
+ //private WebcamName webcamName = null;
+
+
+ /**
+ * This method initiates vuforia. Make sure to pass a webcam object
+ *
+ * // * @param awebcamName The webcam object
+ */
+
+ public void runOpMode() {
+
+ int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier("cameraMonitorViewId", "id", hardwareMap.appContext.getPackageName());
+ VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(cameraMonitorViewId);
+
+ telemetry.addLine("initialized camera");
+ telemetry.update();
+
+ //robot.drivetoPosition(20, 0.5);
+
+ blueInit();
+ telemetry.addLine("blueInit");
+ telemetry.update();
+
+ try {
+ skystonePosition = visionTest();
+ telemetry.addData("SkyStone position:", skystonePosition);
+ telemetry.update();
+
+ } catch (Exception e) {
+ telemetry.addLine(e.getMessage());
+ telemetry.update();
+ }
+
+
+ /***
+
+ if(skystonePosition == 0){
+ robot.strafeToPosition(-8, 0.5);
+
+ } else if(skystonePosition == 2){
+ robot.strafeToPosition(8, 0.5);
+ }
+ ***/
+
+
+ }
+
+ public void blueInit() {
+
+ /*
+ * Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine.
+ * We can pass Vuforia the handle to a camera preview resource (on the RC phone);
+ * If no camera monitor is desired, use the parameter-less constructor instead (commented out below).
+ */
+
+ VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters();
+
+ parameters.vuforiaLicenseKey = VUFORIA_KEY;
+ parameters.cameraDirection = CAMERA_CHOICE;
+
+ /*
+ * We also indicate which camera on the RC we wish to use.
+ */
+
+ // Instantiate the Vuforia engine
+ vuforia = new ClosableVuforiaLocalizer(parameters);
+
+ float mmPerInch = 25.4f;
+ float mmBotWidth = 18 * mmPerInch;
+ float mmFTCFieldWidth = (12 * 12 - 2) * mmPerInch;
+
+ OpenGLMatrix phoneLocationOnRobot = OpenGLMatrix
+ .translation(mmBotWidth / 2, 0, 0)
+ .multiplied(Orientation.getRotationMatrix(
+ AxesReference.EXTRINSIC, AxesOrder.YZY,
+ AngleUnit.DEGREES, -90, 0, 0));
+
+ }
+
+ public int visionTest() {
+
+ VuforiaTrackables targetsSkyStone = this.vuforia.loadTrackablesFromAsset("Skystone");
+ VuforiaTrackable stoneTarget = targetsSkyStone.get(0);
+ stoneTarget.setName("Skystone");
+
+ targetsSkyStone.activate();
+
+ boolean noFoundSkystone = true;
+
+ searchTime.reset();
+ while (!isStopRequested()) {
+ //Just a refresh timer, don't actually need this
+ //if(timer.milliseconds() == 3) continue;
+ boolean stoneVisible = false;
+
+ // check to see if the skystone is visible.
+ if (((VuforiaTrackableDefaultListener) stoneTarget.getListener()).isVisible()) {
+ telemetry.addData("Visible Target", stoneTarget.getName()); //just returns "Stone Target"
+ /*In these coordinates, the X axis goes from the left (negative) to the right (positive).
+ The Y axis goes up and down on the middle of the screen, and the Z axis goes from the camera outward. */
+
+ //command to get the relative position as provided by vuforia
+ OpenGLMatrix location = ((VuforiaTrackableDefaultListener) stoneTarget.getListener()).getVuforiaCameraFromTarget();
+ if (location != null) {
+ // Get the positional part of the coordinates
+ VectorF translation = location.getTranslation();
+ //clip the actual X to see if it is closer to the left or right
+ float closestX = Range.clip(translation.get(0), -20f, 20f);
+ /*"center" because we (my team) only looks at the right two in the farthest set of three in the quarry,
+ so the leftmost image would be the center of the three stones concerned */
+ if (closestX == -20) telemetry.addData("Skystone Target:", "Center");
+ //Right most stone of the two
+ if (closestX == 20) telemetry.addData("Skystone Target:", "Right");
+ //Also express the relative pose (for info purposes)
+ telemetry.addData("Pos (in)", "{X, Y, Z} = %.1f, %.1f, %.1f",
+ translation.get(0), translation.get(1), translation.get(2));
+ }
+ } else {
+ telemetry.addData( "Visible Target", "none");
+ }
+ telemetry.update();
+ //timer.reset();
+
+ if (skystonePosition != 1 && skystonePosition != 2) skystonePosition = 0;
+
+ // Disable Tracking when we are done;
+ targetsSkyStone.deactivate();
+
+ }
+ return skystonePosition;
+ }
+}
\ No newline at end of file
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/AutoTest.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/AutoTest.java
new file mode 100644
index 00000000000..5f22d52cbb3
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/AutoTest.java
@@ -0,0 +1,121 @@
+package org.firstinspires.ftc.team6417;
+
+import com.qualcomm.hardware.modernrobotics.ModernRoboticsI2cGyro;
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
+import com.qualcomm.robotcore.hardware.ColorSensor;
+import com.qualcomm.robotcore.hardware.IntegratingGyroscope;
+import com.qualcomm.robotcore.util.ElapsedTime;
+
+import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
+import org.firstinspires.ftc.robotcore.external.navigation.AngularVelocity;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesReference;
+
+@Autonomous(name="AutoTest", group="Autonomous")
+public class AutoTest extends LinearOpMode {
+
+ IntegratingGyroscope gyro;
+ ModernRoboticsI2cGyro modernRoboticsI2cGyro;
+
+ Hardware6417 robot = new Hardware6417();
+ private ElapsedTime runtime = new ElapsedTime();
+
+ public void runOpMode() {
+
+ boolean lastResetState = false;
+ boolean curResetState = false;
+
+ // Get a reference to a Modern Robotics gyro object. We use several interfaces
+ // on this object to illustrate which interfaces support which functionality.
+ modernRoboticsI2cGyro = hardwareMap.get(ModernRoboticsI2cGyro.class, "gyro");
+ gyro = (IntegratingGyroscope)modernRoboticsI2cGyro;
+ // If you're only interested int the IntegratingGyroscope interface, the following will suffice.
+ // gyro = hardwareMap.get(IntegratingGyroscope.class, "gyro");
+ // A similar approach will work for the Gyroscope interface, if that's all you need.
+
+ // Start calibrating the gyro. This takes a few seconds and is worth performing
+ // during the initialization phase at the start of each opMode.
+ telemetry.log().add("Gyro Calibrating. Do Not Move!");
+ modernRoboticsI2cGyro.calibrate();
+
+ // Wait until the gyro calibration is complete
+ runtime.reset();
+ while (!isStopRequested() && modernRoboticsI2cGyro.isCalibrating()) {
+ telemetry.addData("calibrating", "%s", Math.round(runtime.seconds())%2==0 ? "|.." : "..|");
+ telemetry.update();
+ sleep(50);
+ }
+
+ telemetry.log().clear(); telemetry.log().add("Gyro Calibrated. Press Start.");
+ telemetry.clear(); telemetry.update();
+
+ // Wait for the start button to be pressed
+ waitForStart();
+ telemetry.log().clear();
+ telemetry.log().add("Press A & B to reset heading");
+
+ robot.strafe(0.2);
+ if (robot.colorSensor.blue() > robot.colorSensor.green() + robot.colorSensor.red()) {
+ robot.stop();
+ }
+
+ // Loop until we're asked to stop
+ while (opModeIsActive()) {
+
+ // If the A and B buttons are pressed just now, reset Z heading.
+ curResetState = (gamepad1.a && gamepad1.b);
+ if (curResetState && !lastResetState) {
+ modernRoboticsI2cGyro.resetZAxisIntegrator();
+ }
+ lastResetState = curResetState;
+
+ // The raw() methods report the angular rate of change about each of the
+ // three axes directly as reported by the underlying sensor IC.
+ int rawX = modernRoboticsI2cGyro.rawX();
+ int rawY = modernRoboticsI2cGyro.rawY();
+ int rawZ = modernRoboticsI2cGyro.rawZ();
+ int heading = modernRoboticsI2cGyro.getHeading();
+ int integratedZ = modernRoboticsI2cGyro.getIntegratedZValue();
+
+ // Read dimensionalized data from the gyro. This gyro can report angular velocities
+ // about all three axes. Additionally, it internally integrates the Z axis to
+ // be able to report an absolute angular Z orientation.
+ AngularVelocity rates = gyro.getAngularVelocity(AngleUnit.DEGREES);
+ float zAngle = gyro.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES).firstAngle;
+
+ // Read administrative information from the gyro
+ int zAxisOffset = modernRoboticsI2cGyro.getZAxisOffset();
+ int zAxisScalingCoefficient = modernRoboticsI2cGyro.getZAxisScalingCoefficient();
+
+ telemetry.addLine()
+ .addData("dx", formatRate(rates.xRotationRate))
+ .addData("dy", formatRate(rates.yRotationRate))
+ .addData("dz", "%s deg/s", formatRate(rates.zRotationRate));
+ telemetry.addData("angle", "%s deg", formatFloat(zAngle));
+ telemetry.addData("heading", "%3d deg", heading);
+ telemetry.addData("integrated Z", "%3d", integratedZ);
+ telemetry.addLine()
+ .addData("rawX", formatRaw(rawX))
+ .addData("rawY", formatRaw(rawY))
+ .addData("rawZ", formatRaw(rawZ));
+ telemetry.addLine().addData("z offset", zAxisOffset).addData("z coeff", zAxisScalingCoefficient);
+ telemetry.update();
+
+ }
+
+ }
+
+ String formatRaw(int rawValue) {
+ return String.format("%d", rawValue);
+ }
+
+ String formatRate(float rate) {
+ return String.format("%.3f", rate);
+ }
+
+ String formatFloat(float rate) {
+ return String.format("%.3f", rate);
+ }
+
+}
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/CVDisplay.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/CVDisplay.java
new file mode 100644
index 00000000000..692037c9fd5
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/CVDisplay.java
@@ -0,0 +1,94 @@
+package org.firstinspires.ftc.team6417;
+
+import com.disnodeteam.dogecv.CameraViewDisplay;
+import com.disnodeteam.dogecv.detectors.DogeCVDetector;
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.OpMode;
+import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
+
+import org.opencv.core.Mat;
+import org.opencv.core.Size;
+import org.opencv.imgproc.Imgproc;
+
+import detectors.FoundationPipeline.Pipeline;
+
+/*
+ If you're using this library, THANKS! I spent a lot of time on it.
+ However, stuff isn't as well-documented as I like...still working on that
+ So if you have questions, email me at xchenbox@gmail.com and I will get back to you in about a day (usually)
+ Enjoy!
+ Below is the code to display to the RC; thanks DogeCV! I tried easyOpenCV, but it was lagging and stuttering. (??)
+ If it crashes after about a minute, it's probably becaugit reflog expire --expire=now --all && git gc --prune=now --aggressivese OpenCV is using too much native memory. My solution
+ is to call System.gc() whenever it reaches 70% (works on my g4 play) , but if someone knows more please contact me.
+ */
+
+@Autonomous(name = "CV Simulator", group = "Autonomous")
+public class CVDisplay extends OpMode {
+
+ private DogeCVDetector detector = new DogeCVDetector() {
+ @Override
+ public Mat process(Mat rgba) {
+
+ /*
+ Here you can specify which elements are being detected.
+ At the moment, SkyStones are super-reliable, Individual stones can be detected if you set up
+ the camera right, and Foundations...need work.
+ */
+ Pipeline.doFoundations=false;
+ Pipeline.doStones=false;
+ Pipeline.doSkyStones=true;
+
+
+ Mat m = Pipeline.process(rgba);
+
+ telemetry.update();
+
+ Imgproc.resize(m, m, new Size(640*1.3, 480*1.3 ));
+ return m;
+ }
+ @Override
+ public void useDefaults() {}
+ };
+
+ @Override
+ public void init() {
+ telemetry.setAutoClear(true);
+ // Set up detector
+ detector.init(hardwareMap.appContext, CameraViewDisplay.getInstance()); // Initialize it with the app context and camera
+ detector.enable();
+ }
+ /*
+ * Code to run REPEATEDLY when the driver hits INIT
+ */
+ @Override
+ public void init_loop() {
+ }
+
+ /*
+ * Code to run ONCE when the driver hits PLAY
+ */
+ @Override
+ public void start() {
+
+ }
+
+ /*
+ * Code to run REPEATEDLY when the driver hits PLAY
+ */
+ @Override
+ public void loop() {
+ telemetry.update();
+ }
+
+ /*
+ * Code to run ONCE after the driver hits STOP
+ */
+ @Override
+ public void stop() {
+ if(detector != null) detector.disable(); //Make sure to run this on stop!
+ }
+
+ public static void clean(){
+ System.gc();
+ }
+}
\ No newline at end of file
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/Calibrate.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/Calibrate.java
new file mode 100644
index 00000000000..bbd9b306ea3
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/Calibrate.java
@@ -0,0 +1,166 @@
+package org.firstinspires.ftc.team6417;
+
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
+import com.qualcomm.robotcore.hardware.DcMotor;
+import com.qualcomm.robotcore.hardware.DcMotorSimple;
+
+@Autonomous(name="Calibrate", group="6417")
+public class Calibrate extends LinearOpMode {
+ Integer cpr = 28;
+ Integer gearratio = 26;
+ Double diameter = 3.93701;
+ Double cpi = (cpr * gearratio) / (Math.PI * diameter);
+ Double bias = 0.5;
+ Boolean exit = false;
+
+ Hardware6417 robot = new Hardware6417();
+
+ //
+ Double conversion = cpi * bias;
+ //
+ public void runOpMode() {
+ //
+ /***
+ frontleft = hardwareMap.dcMotor.get("FrontLeft");
+ frontright = hardwareMap.dcMotor.get("FrontRight");
+ backleft = hardwareMap.dcMotor.get("BackLeft");
+ backright = hardwareMap.dcMotor.get("BackRight");
+ frontleft.setDirection(DcMotorSimple.Direction.REVERSE);//If your robot goes backward, switch this from right to left
+ backleft.setDirection(DcMotorSimple.Direction.REVERSE);//If your robot goes backward, switch this from right to left
+ //
+ ***/
+
+ robot.init(hardwareMap);
+
+ waitForStartify();
+ //
+ moveToPosition(20, .2);//Don't change this line, unless you want to calibrate with different speeds
+ //
+ }
+ //
+ /*
+ This function's purpose is simply to drive forward or backward.
+ To drive backward, simply make the inches input negative.
+ */
+
+ public void moveToPosition(double inches, double speed){
+ //
+ int move = (int)(Math.round(inches*conversion));
+ //
+ robot.leftBack.setTargetPosition(robot.leftBack.getCurrentPosition() + move);
+ robot.leftFront.setTargetPosition(robot.leftFront.getCurrentPosition() + move);
+ robot.rightBack.setTargetPosition(robot.rightBack.getCurrentPosition() + move);
+ robot.rightFront.setTargetPosition(robot.rightFront.getCurrentPosition() + move);
+ //
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ //
+ robot.leftBack.setPower(speed);
+ robot.leftFront.setPower(speed);
+ robot.rightBack.setPower(speed);
+ robot.rightFront.setPower(speed);
+ //
+ while (robot.leftFront.isBusy() && robot.rightFront.isBusy() && robot.leftBack.isBusy() && robot.rightBack.isBusy()){
+
+ if (exit){
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ return;
+ }
+
+ }
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ robot.leftDragServo.setPosition(0);
+ robot.rightDragServo.setPosition(0);
+ return;
+
+ }
+
+ /***
+ public void moveToPosition(double inches, double speed) {
+ //
+ if (inches < 5) {
+ int move = (int) (Math.round(inches * conversion));
+ //
+ frontleft.setTargetPosition(frontleft.getCurrentPosition() + move);
+ frontright.setTargetPosition(frontright.getCurrentPosition() + move);
+ backleft.setTargetPosition(backleft.getCurrentPosition() + move);
+ backright.setTargetPosition(backright.getCurrentPosition() + move);
+ //
+ frontleft.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ frontright.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ backleft.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ backright.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ //
+ frontleft.setPower(speed);
+ frontright.setPower(speed);
+ backleft.setPower(speed);
+ backright.setPower(speed);
+ //
+ while (frontleft.isBusy() && frontright.isBusy() && backleft.isBusy() && backright.isBusy()) {
+ }
+ frontleft.setPower(0);
+ frontright.setPower(0);
+ backleft.setPower(0);
+ backright.setPower(0);
+ } else {
+ int move1 = (int) (Math.round((inches - 5) * conversion));
+ int movefl2 = frontleft.getCurrentPosition() + (int) (Math.round(inches * conversion));
+ int movefr2 = frontright.getCurrentPosition() + (int) (Math.round(inches * conversion));
+ int movebl2 = backleft.getCurrentPosition() + (int) (Math.round(inches * conversion));
+ int movebr2 = backright.getCurrentPosition() + (int) (Math.round(inches * conversion));
+ //
+ frontleft.setTargetPosition(frontleft.getCurrentPosition() + move1);
+ frontright.setTargetPosition(frontright.getCurrentPosition() + move1);
+ backleft.setTargetPosition(backleft.getCurrentPosition() + move1);
+ backright.setTargetPosition(backright.getCurrentPosition() + move1);
+ //
+ frontleft.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ frontright.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ backleft.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ backright.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ //
+ frontleft.setPower(speed);
+ frontright.setPower(speed);
+ backleft.setPower(speed);
+ backright.setPower(speed);
+ //
+ while (frontleft.isBusy() && frontright.isBusy() && backleft.isBusy() && backright.isBusy()) {
+ }
+ //
+ frontleft.setTargetPosition(movefl2);
+ frontright.setTargetPosition(movefr2);
+ backleft.setTargetPosition(movebl2);
+ backright.setTargetPosition(movebr2);
+ //
+ frontleft.setPower(.1);
+ frontright.setPower(.1);
+ backleft.setPower(.1);
+ backright.setPower(.1);
+ //
+ while (frontleft.isBusy() && frontright.isBusy() && backleft.isBusy() && backright.isBusy()) {
+ }
+ frontleft.setPower(0);
+ frontright.setPower(0);
+ backleft.setPower(0);
+ backright.setPower(0);
+ }
+ return;
+ }
+ ***/
+ /*
+ A tradition within the Thunder Pengwins code, we always start programs with waitForStartify,
+ our way of adding personality to our programs.
+ */
+ public void waitForStartify() {
+ waitForStart();
+ }
+}
\ No newline at end of file
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/ConceptEventOp.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/ConceptEventOp.java
new file mode 100644
index 00000000000..f536f27784b
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/ConceptEventOp.java
@@ -0,0 +1,98 @@
+package org.firstinspires.ftc.team6417;
+
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.Disabled;
+import com.qualcomm.robotcore.eventloop.opmode.OpMode;
+import com.qualcomm.robotcore.util.ElapsedTime;
+
+import org.firstinspires.ftc.robotcore.external.ClassFactory;
+import org.firstinspires.ftc.robotcore.external.matrices.OpenGLMatrix;
+import org.firstinspires.ftc.robotcore.external.matrices.VectorF;
+import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesReference;
+import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
+import org.firstinspires.ftc.robotcore.external.navigation.RelicRecoveryVuMark;
+import org.firstinspires.ftc.robotcore.external.navigation.VuMarkInstanceId;
+import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer;
+import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable;
+import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackableDefaultListener;
+import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackables;
+
+@Autonomous(name = "Concept: NullOp", group = "Concept")
+@Disabled
+public class ConceptEventOp extends OpMode {
+
+ private ElapsedTime runtime = new ElapsedTime();
+
+ //vuforia initialization
+ VuforiaLocalizer vuforia;
+
+ VuforiaTrackables relicTrackables;
+ VuforiaTrackable relicTemplate;
+
+ @Override
+ public void init() {
+
+ telemetry.addData("Status", "Initialized");
+
+ int cameraMonitorViewId = hardwareMap.appContext.getResources().getIdentifier("cameraMonitorViewId", "id", hardwareMap.appContext.getPackageName());
+ VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters(cameraMonitorViewId);
+
+ parameters.vuforiaLicenseKey = "AcWxpI//////AAABmSTUqOAeSU6ch+3XHmV8XvMbVbpRCaYwby/IOcqjvubbwTl3h6QgRRr5Sq8xDIqb44SiaO40EwykSMPj8lExZdBYpKxDIed6HDzF0bnyn8EOMvMwtw8y7qlfdoogz+XZ0QBLuYQJOtM6LoCNPVFikbunJRj72Pfty7C8WzzjaGmlZKjHWZamkhck6OvK6E1tlhRzwnPhFMDGfLFq/6clnV2RIo1CM8QJ0SJln+d28b4IjHp4FR6Ihl1PZz995tXGZE+cssZdTnIO3mX62f16wkSXVaQUxiPRIAJCGHExH1WkBge7d6r1pKLKmNOwwdrXLTP5WbOR2Mi5Qw9Lq6ATDBrseIVVnHXbgHbR9TaQXg8R";
+
+ parameters.cameraDirection = VuforiaLocalizer.CameraDirection.FRONT;
+ this.vuforia = ClassFactory.createVuforiaLocalizer(parameters);
+
+ relicTrackables = this.vuforia.loadTrackablesFromAsset("RelicVuMark");
+ relicTemplate = relicTrackables.get(0);
+ relicTemplate.setName("relicVuMarkTemplate"); // can help in debugging; otherwise not necessary
+
+ }
+
+ @Override
+ public void start() {
+
+ runtime.reset();
+
+ relicTrackables.activate();
+
+ }
+
+ @Override
+ public void loop() {
+
+ RelicRecoveryVuMark vuMark = RelicRecoveryVuMark.from(relicTemplate);
+ if (vuMark != RelicRecoveryVuMark.UNKNOWN) {
+
+ OpenGLMatrix pose = ((VuforiaTrackableDefaultListener) relicTemplate.getListener()).getPose();
+ if (vuMark == RelicRecoveryVuMark.RIGHT)
+ telemetry.addData("VuMark", "Right");
+ else if (vuMark == RelicRecoveryVuMark.CENTER)
+ telemetry.addData("VuMark", "Center");
+ else if (vuMark == RelicRecoveryVuMark.LEFT)
+ telemetry.addData("VuMark", "Left");
+ else if (vuMark == RelicRecoveryVuMark.UNKNOWN)
+ telemetry.addData("VuMark", "Unknown");
+
+ if (pose != null) {
+ VectorF trans = pose.getTranslation();
+ Orientation rot = Orientation.getOrientation(pose, AxesReference.EXTRINSIC, AxesOrder.XYZ, AngleUnit.DEGREES);
+
+ // Extract the X, Y, and Z components of the offset of the target relative to the robot
+ double tX = trans.get(0);
+ double tY = trans.get(1);
+ double tZ = trans.get(2);
+
+ // Extract the rotational components of the target relative to the robot
+ double rX = rot.firstAngle;
+ double rY = rot.secondAngle;
+ double rZ = rot.thirdAngle;
+ }
+ } else {
+ telemetry.addData("VuMark", "not visible");
+ }
+
+ telemetry.update();
+ }
+}
\ No newline at end of file
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/DuoDou.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/DuoDou.java
new file mode 100644
index 00000000000..00bc271eb48
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/DuoDou.java
@@ -0,0 +1,146 @@
+/* Copyright (c) 2019 FIRST. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted (subject to the limitations in the disclaimer below) provided that
+ * the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither the name of FIRST nor the names of its contributors may be used to endorse or
+ * promote products derived from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
+ * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.firstinspires.ftc.team6417;
+
+
+import android.util.Log;
+
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
+import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
+
+import org.firstinspires.ftc.robotcore.external.Telemetry;
+import org.opencv.core.Mat;
+
+import detectors.FoundationPipeline.SkyStone;
+import detectors.ImageDetector;
+
+import java.util.Iterator;
+import java.util.List;
+
+import detectors.ImageDetector;
+import detectors.OpenCvDetector;
+
+import detectors.StoneDetector;
+
+/*
+ If you're using this library, THANKS! I spent a lot of time on it.
+ However, stuff isn't as well-documented as I like...still working on that
+ So if you have questions, email me at xchenbox@gmail.com and I will get back to you in about a day (usually)
+ Enjoy!
+ Below is the Opmode example, which shows all the features of the library. 99% of my time has
+ been spent on the OpenCVDetector, so don't criticize the 10 minutes I spent on the other stuff...
+ */
+
+@Autonomous(name = "DuoDou", group = "Autonomous")
+public class DuoDou extends LinearOpMode {
+
+ public void runOpMode() throws InterruptedException {
+
+ telemetry.setAutoClear(true);
+
+ telemetry.addData("Booting Up", " . . .");
+ telemetry.update();
+
+ OpenCvDetector fieldDetector = new OpenCvDetector(this);
+ //ImageDetector detector = new ImageDetector(this, false);
+ //StoneDetector stone = new StoneDetector(this, false);
+
+ //stone.start();
+ //detector.start();
+ fieldDetector.start();
+ //imu.start();tr
+
+ while (!isStopRequested()) {
+ //detector.printposition(detector.getPosition());
+
+ //fieldDetector.print(fieldDetector.getObjectsFoundations());
+ //Log.d("GO TO MO","go");
+
+ SkyStone[] skyStone = fieldDetector.getObjectsSkyStones();
+
+ telemetry.addData("Skystones Found",skyStone.length);
+ int i = 0;
+ for(SkyStone s : skyStone){
+ i++;
+ telemetry.addLine(""+s);
+ }
+
+ Mat m = new Mat();
+ m = null;
+
+ //also, enabling/disabling detection for individual field elements:
+ /*
+ Pipeline.doFoundations=false;
+ Pipeline.doStones=false;
+ Pipeline.doSkyStones=false;
+ */
+
+
+ //getting positions of each element. Will return Objects for each element that all contain
+ // Phone camera coordinates for each element's center.
+ /*
+ List foundations = Pipeline.foundations;
+ List stones = Pipeline.stones;
+ List skystones = Pipeline.skyStones;
+ */
+
+
+
+ //stone.print(stone.getObjectsFoundations());
+
+ //imu.printposition(imu.getDeltaPosition());
+
+ telemetry.addData("==========", "Loop delimiter");
+
+ telemetry.update();
+ }
+
+ // Disable Tracking when we are done
+ //detector.stop();
+ //stone.stop();
+ fieldDetector.stop();
+ //imu.stop();
+ }
+
+ public void listhardware() {
+ telemetry.setAutoClear(false);
+
+ Iterator t = hardwareMap.iterator();
+ while (t.hasNext()) {
+
+ telemetry.addData("device found", (t.next().getDeviceName()));
+ telemetry.update();
+ }
+
+ telemetry.setAutoClear(true);
+
+ }
+}
\ No newline at end of file
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/Hardware6417.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/Hardware6417.java
new file mode 100644
index 00000000000..575b45a21f1
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/Hardware6417.java
@@ -0,0 +1,282 @@
+/* Copyright (c) 2017 FIRST. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted (subject to the limitations in the disclaimer below) provided that
+ * the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither the name of FIRST nor the names of its contributors may be used to endorse or
+ * promote products derived from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
+ * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.firstinspires.ftc.team6417;
+
+import com.qualcomm.hardware.bosch.BNO055IMU;
+import com.qualcomm.hardware.lynx.LynxEmbeddedIMU;
+import com.qualcomm.hardware.modernrobotics.ModernRoboticsI2cGyro;
+import com.qualcomm.robotcore.hardware.CRServo;
+import com.qualcomm.robotcore.hardware.ColorSensor;
+import com.qualcomm.robotcore.hardware.DcMotor;
+import com.qualcomm.robotcore.hardware.GyroSensor;
+import com.qualcomm.robotcore.hardware.HardwareMap;
+import com.qualcomm.robotcore.hardware.IntegratingGyroscope;
+import com.qualcomm.robotcore.hardware.Servo;
+import com.qualcomm.robotcore.hardware.configuration.typecontainers.ServoConfigurationType;
+import com.qualcomm.robotcore.util.ElapsedTime;
+
+import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesReference;
+
+import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
+import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
+
+
+/**
+ * This is NOT an opmode.
+ *
+ * This class can be used to define all the specific hardware for a single robot.
+ * In this case that robot is a Pushbot.
+ * See PushbotTeleopTank_Iterative and others classes starting with "Pushbot" for usage examples.
+ *
+ * This hardware class assumes the following device names have been configured on the robot:
+ * Note: All names are lower case and some have single spaces between words.
+ *
+ * Motor channel: Left drive motor: "left_drive"
+ * Motor channel: Right drive motor: "right_drive"
+ * Motor channel: Manipulator drive motor: "left_arm"
+ * Servo channel: Servo to open left claw: "left_hand"
+ * Servo channel: Servo to open right claw: "right_hand"
+ */
+// Based on HardwarePushbot
+public class Hardware6417
+{
+ /* Public OpMode members. */
+ public DcMotor leftFront = null, rightFront = null, leftBack = null, rightBack = null,
+ armMotor = null, extendMotor = null;
+
+ public Servo grabServo = null, alignServo = null, leftDragServo = null, rightDragServo = null;
+
+ ColorSensor colorSensor;
+
+ ModernRoboticsI2cGyro alignGyro;
+ IntegratingGyroscope gyro;
+
+ public static final double TURN_POWER_LIFT = 0.5 ;
+ public static final int CPR = 1440;
+ public static final double DIAMETER = 3.93701; //inches
+ //public static final int BLOCK_HEIGHT = 127; //millimeters
+
+ public LynxEmbeddedIMU imu;
+
+ /* local OpMode members. */
+ HardwareMap hwMap = null;
+ private ElapsedTime period = new ElapsedTime();
+
+ /* Constructor */
+ public Hardware6417(){
+ }
+
+ private void checkOrientation() {
+ // read the orientation of the robot
+ Orientation angles = this.imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+ this.imu.getPosition();
+ // and save the heading
+ double curHeading = angles.firstAngle;
+ }
+
+ /* Initialize standard Hardware interfaces */
+ public void init(HardwareMap ahwMap) {
+ // Save reference to Hardware map
+ hwMap = ahwMap;
+
+ // Define and initialize motors
+ leftFront = hwMap.get(DcMotor.class, "FrontLeft");
+ leftBack = hwMap.get(DcMotor.class, "BackLeft");
+ rightFront = hwMap.get(DcMotor.class, "FrontRight");
+ rightBack = hwMap.get(DcMotor.class, "BackRight");
+ armMotor = hwMap.get(DcMotor.class, "ArmMotor");
+ extendMotor = hwMap.get(DcMotor.class, "ExtendMotor");
+
+ // Define and initialize servos
+ alignServo = hwMap.get(Servo.class, "AlignServo");
+ leftDragServo = hwMap.get(Servo.class, "leftDragServo");
+ rightDragServo = hwMap.get(Servo.class, "rightDragServo");
+ grabServo = hwMap.get(Servo.class, "GrabServo");
+
+ colorSensor = hwMap.get(ColorSensor.class, "color");
+
+ alignGyro = hwMap.get(ModernRoboticsI2cGyro.class, "alignGyro");
+ gyro = (IntegratingGyroscope)alignGyro;
+
+ // Set motor and servo directions based on orientation of motors on robot
+ leftFront.setDirection(DcMotor.Direction.REVERSE);
+ leftBack.setDirection(DcMotor.Direction.REVERSE);
+ rightFront.setDirection(DcMotor.Direction.FORWARD);
+ rightBack.setDirection(DcMotor.Direction.FORWARD);
+ armMotor.setDirection(DcMotor.Direction.FORWARD);
+ extendMotor.setDirection(DcMotor.Direction.FORWARD);
+
+ alignServo.setDirection(Servo.Direction.REVERSE);
+ leftDragServo.setDirection(Servo.Direction.FORWARD);
+ rightDragServo.setDirection(Servo.Direction.FORWARD);
+
+ // Set initial servo positions
+ //alignServo.setPosition(1.0);
+ //rightDragServo.setPosition(0);
+ //leftDragServo.setPosition(0);
+
+ // Set all motors to zero power
+ leftFront.setPower(0);
+ leftBack.setPower(0);
+ rightFront.setPower(0);
+ rightBack.setPower(0);
+
+ // Set all motors to run with encoders
+ leftFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ leftBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ rightFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ rightBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+
+
+ /***
+ LynxEmbeddedIMU imu = hwMap.get(LynxEmbeddedIMU.class, "AlignGyro");
+ BNO055IMU.Parameters params = new BNO055IMU.Parameters();
+ imu.initialize(params);
+ ***/
+
+ }
+
+ public void drivetoPosition(int d, double power){
+
+ leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ leftBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ rightBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+
+ int distance = (int)(CPR / (DIAMETER * Math.PI) * d);
+
+ leftFront.setTargetPosition(distance);
+ rightFront.setTargetPosition(distance);
+ leftBack.setTargetPosition(distance);
+ rightBack.setTargetPosition(distance);
+
+ leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+
+ leftFront.setPower(power);
+ rightFront.setPower(power);
+ leftBack.setPower(power);
+ rightBack.setPower(power);
+
+ while(leftFront.isBusy() || rightFront.isBusy() || leftBack.isBusy() || rightBack.isBusy()){ }
+
+ leftFront.setPower(0);
+ rightFront.setPower(0);
+ leftBack.setPower(0);
+ rightBack.setPower(0);
+
+ leftFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ rightFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ leftBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ rightBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+
+ }
+
+
+ public void strafeToPosition(int d, double power){
+
+ leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ leftBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ rightBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+
+ int distance = (int)(CPR / (DIAMETER * Math.PI) * d);
+
+ leftFront.setTargetPosition(distance);
+ rightFront.setTargetPosition(-distance);
+ leftBack.setTargetPosition(-distance);
+ rightBack.setTargetPosition(distance);
+
+ leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+
+ leftFront.setPower(power);
+ rightFront.setPower(power);
+ leftBack.setPower(power);
+ rightBack.setPower(power);
+
+ while(leftFront.isBusy() || rightFront.isBusy() || leftBack.isBusy() || rightBack.isBusy()){ }
+
+ leftFront.setPower(0);
+ rightFront.setPower(0);
+ leftBack.setPower(0);
+ rightBack.setPower(0);
+
+ leftFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ rightFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ leftBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ rightBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+
+ }
+
+ public void strafe(double power){
+
+ // Set all motors to the same power
+ // rightFront and leftBack go in the opposite directions to strafe
+ leftFront.setPower(power);
+ rightFront.setPower(-power);
+ leftBack.setPower(-power);
+ rightBack.setPower(power);
+
+ }
+
+ public void drive(double power){
+
+ // Set all motors to the same power to drive forward
+ leftFront.setPower(power);
+ rightFront.setPower(power);
+ leftBack.setPower(power);
+ rightBack.setPower(power);
+
+ }
+
+ public void stop(){
+
+ // Set all motors to 0 power
+ leftFront.setPower(0);
+ rightFront.setPower(0);
+ leftBack.setPower(0);
+ rightBack.setPower(0);
+
+ }
+
+ public void turnWithEncoder(double input){
+ leftFront.setPower(input);
+ leftBack.setPower(input);
+ rightFront.setPower(-input);
+ rightBack.setPower(-input);
+ }
+
+}
\ No newline at end of file
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/MecanumDriveOpMode.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/MecanumDriveOpMode.java
new file mode 100644
index 00000000000..f1e8c57ed5d
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/MecanumDriveOpMode.java
@@ -0,0 +1,235 @@
+/* Copyright (c) 2017 FIRST. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted (subject to the limitations in the disclaimer below) provided that
+ * the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list
+ * of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * Neither the name of FIRST nor the names of its contributors may be used to endorse or
+ * promote products derived from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
+ * LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+package org.firstinspires.ftc.team6417;
+
+import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
+import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
+import com.qualcomm.robotcore.hardware.CRServo;
+import com.qualcomm.robotcore.hardware.DcMotorSimple;
+import com.qualcomm.robotcore.util.ElapsedTime;
+
+import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesReference;
+import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
+
+
+/**
+ * This file contains an minimal example of a Linear "OpMode". An OpMode is a 'program' that runs in either
+ * the autonomous or the teleop period of an FTC match. The names of OpModes appear on the menu
+ * of the FTC Driver Station. When an selection is made from the menu, the corresponding OpMode
+ * class is instantiated on the Robot Controller and executed.
+ *
+ * This particular OpMode just executes a basic Tank Drive Teleop for a two wheeled robot
+ * It includes all the skeletal structure that all linear OpModes contain.
+ *
+ * Use Android Studios to Copy this Class, and Paste it into your team's code folder with a new name.
+ * Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list
+ */
+
+@TeleOp(name = "Mecanum Opmode", group = "Linear Opmode")
+//@Disabled
+public class MecanumDriveOpMode extends LinearOpMode {
+
+ enum Direction {
+ FORWARD, BACKWARD, LEFT, RIGHT, STLEFT, STRIGHT;
+ }
+
+ // higher lift factor means less adjustment for grab hand during height change
+ private final int LIFT_FACTOR = 1500;
+
+ // Declare OpMode members.
+ private ElapsedTime runtime = new ElapsedTime();
+ Hardware6417 robot = new Hardware6417();
+
+ @Override
+ public void runOpMode() {
+
+ robot.init(hardwareMap);
+ telemetry.addData("Status", "Initialized");
+ telemetry.update();
+
+ // Initialize the hardware variables. Note that the strings used here as parameters
+ // to 'get' must correspond to the names assigned during the robot configuration
+ // step (using the FTC Robot Controller app on the phone).
+
+ // Most robots need the motor on one side to be reversed to drive forward
+ // Reverse the motor that runs backwards when connected directly to the battery
+ // Wait for the game to start (driver presses PLAY)
+
+ waitForStart();
+ runtime.reset();
+
+ double forward, strafe, rotate, lift, armSpeed, extendSpeed, armangle;
+ robot.leftDragServo.setPosition(0);
+ robot.rightDragServo.setPosition(0);
+
+ telemetry.log().add("Gyro Calibrating...");
+ robot.alignGyro.calibrate();
+
+ // run until the end of the match (driver presses STOP)
+ while (opModeIsActive()) {
+
+ forward = -gamepad1.left_stick_y;
+ strafe = gamepad1.left_stick_x;
+ rotate = gamepad1.right_stick_x;
+ lift = -gamepad2.left_stick_y;
+
+ if(Math.abs(forward) > 0.3 || Math.abs(strafe) > 0.3 || Math.abs(rotate) > 0.3){
+ setDriveSpeeds(forward, strafe, rotate);
+ }
+ else{
+ setDriveSpeeds(0, 0, 0);
+ }
+
+ // code to raise and lower arm
+ if(Math.abs(lift) > 0.3){
+ armSpeed = gamepad2.left_stick_y;
+ }
+ else{
+ armSpeed = 0;
+ }
+
+ robot.armMotor.setPower(armSpeed);
+
+ // this section rotates the grabber claw on a servo so that it is always
+ // aligned perpendicular to the ground. This helps us keep the skystone
+ // at a 90 degree angle so we can stack it on top of the building
+
+ armangle = robot.gyro.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES).firstAngle;
+ telemetry.addData("Gyro reading:", armangle);
+ telemetry.update();
+ robot.alignServo.setPosition(robot.alignServo.getPosition() - (lift / LIFT_FACTOR));
+
+ // extend and retract the arm's extrusions
+ extendSpeed = gamepad2.right_stick_y;
+ robot.extendMotor.setPower(extendSpeed / 2);
+
+ // latch and unlatch the grabber claw onto the skystone
+ if(gamepad2.left_trigger > 0) {
+ robot.grabServo.setPosition(0);
+ }
+ else if(gamepad2.right_trigger > 0) {
+ robot.grabServo.setPosition(0.75);
+ }
+
+ // nudging allows us to move a small distance more precisely
+ // than we can with the gamepad sticks
+ if(gamepad1.dpad_up || gamepad2.dpad_up){
+ nudgeRobot(Direction.FORWARD, 10);
+ }
+ else if(gamepad1.dpad_left || gamepad2.dpad_left){
+ nudgeRobot(Direction.LEFT, 10);
+ }
+ else if(gamepad1.dpad_down || gamepad2.dpad_down){
+ nudgeRobot(Direction.BACKWARD, 10);
+ }
+ else if(gamepad1.dpad_right || gamepad2.dpad_right){
+ nudgeRobot(Direction.RIGHT, 10);
+ }
+ else if(gamepad1.left_bumper || gamepad2.left_bumper){
+ nudgeRobot(Direction.STLEFT, 20);
+ }
+ else if(gamepad2.right_bumper || gamepad1.right_bumper){
+ nudgeRobot(Direction.STRIGHT, 20);
+ }
+
+ // latch and unlatch onto the building platform
+ if(gamepad1.left_trigger > 0) {
+ robot.leftDragServo.setPosition(0.75);
+ robot.rightDragServo.setPosition(0);
+ }
+ else if(gamepad1.right_trigger > 0){
+ robot.leftDragServo.setPosition(0);
+ robot.rightDragServo.setPosition(0.75);
+ }
+
+ if(gamepad2.y) {
+ resetArm();
+ }
+ }
+ }
+
+ // moves robot in direction controlled by top gamepad button for a moment
+ private void setDriveSpeeds(double forward, double strafe, double rotate) {
+
+ double frontLeftSpeed = forward + strafe + rotate;
+ double frontRightSpeed = forward - strafe - rotate;
+ double backLeftSpeed = forward - strafe + rotate;
+ double backRightSpeed = forward + strafe - rotate;
+
+ double largest = 1.0;
+ largest = Math.max(largest, Math.abs(frontLeftSpeed));
+ largest = Math.max(largest, Math.abs(frontRightSpeed));
+ largest = Math.max(largest, Math.abs(backLeftSpeed));
+ largest = Math.max(largest, Math.abs(backRightSpeed));
+
+ robot.leftFront.setPower(frontLeftSpeed / largest);
+ robot.rightFront.setPower(frontRightSpeed / largest);
+ robot.leftBack.setPower(backLeftSpeed / largest);
+ robot.rightBack.setPower(backRightSpeed / largest);
+ }
+
+ // nudges robot based on direction passed in
+ // directions will be dealt with in runOpMode
+ private void nudgeRobot(Direction dir, int sl) {
+
+ switch(dir) {
+ case FORWARD:
+ setDriveSpeeds(0.2, 0, 0);
+ break;
+ case BACKWARD:
+ setDriveSpeeds(-0.2, 0, 0);
+ break;
+ case LEFT:
+ setDriveSpeeds(0, 0, -0.2);
+ break;
+ case RIGHT:
+ setDriveSpeeds(0, 0, 0.2);
+ break;
+ case STLEFT:
+ setDriveSpeeds(0, -0.2, 0);
+ break;
+ case STRIGHT:
+ setDriveSpeeds(0, 0.2, 0);
+ break;
+ }
+
+ sleep(sl);
+ setDriveSpeeds(0, 0, 0);
+
+ }
+
+ // resets grab hand angle to perpendicular to arm
+ // used in case the auto adjust code messes up for whatever reason
+ private void resetArm() {
+ robot.alignServo.setPosition(.8);
+ }
+}
\ No newline at end of file
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/Waffle.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/Waffle.java
new file mode 100644
index 00000000000..e5c37423cd5
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/Waffle.java
@@ -0,0 +1,41 @@
+package org.firstinspires.ftc.team6417;
+
+import com.qualcomm.hardware.bosch.BNO055IMU;
+import com.qualcomm.hardware.lynx.LynxEmbeddedIMU;
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
+
+import org.firstinspires.ftc.robotcore.external.navigation.Acceleration;
+import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
+
+import detectors.FoundationPipeline.SkyStone;
+import detectors.ImageDetector;
+import detectors.OpenCvDetector;
+
+@Autonomous(name="Wafflywaffle", group="Autonomous")
+public class Waffle extends LinearOpMode {
+
+ Hardware6417 robot = new Hardware6417();
+ BNO055IMU imu;
+ Orientation angles;
+ Acceleration gravity;
+
+ Boolean exit = false;
+
+ public void runOpMode(){
+
+ ImageDetector detector = new ImageDetector(this, false);
+ detector.start();
+
+ detector.getPosition();
+
+
+ /***
+ OpenCvDetector cam = new OpenCvDetector(this);
+ cam.loop(); // update
+ SkyStone[] stones = cam.getObjectsSkyStones();
+ ***/
+
+ }
+
+}
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto2.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto2.java
new file mode 100644
index 00000000000..432cfef032a
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto2.java
@@ -0,0 +1,91 @@
+package org.firstinspires.ftc.team6417.irrelevent;
+
+import com.qualcomm.hardware.bosch.BNO055IMU;
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
+import com.qualcomm.robotcore.hardware.DcMotor;
+
+import org.firstinspires.ftc.robotcore.external.navigation.Acceleration;
+import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
+import org.firstinspires.ftc.team6417.Hardware6417;
+
+@Autonomous(name="ParkRight", group="Autonomous")
+public class Auto2 extends LinearOpMode {
+
+ Hardware6417 robot = new Hardware6417();
+ BNO055IMU imu;
+ Orientation angles;
+ Acceleration gravity;
+
+ Boolean exit = false;
+
+ public void runOpMode(){
+
+ robot.init(hardwareMap);
+ waitForStart();
+
+ robot.drive(-0.2);
+ sleep(2200);
+ robot.stop();
+
+ robot.leftDragServo.setPosition(0);
+ robot.rightDragServo.setPosition(0.75);
+
+ sleep(1000);
+
+ robot.drive(0.2);
+ sleep(2500);
+ robot.stop();
+
+ robot.leftDragServo.setPosition(0.75);
+ robot.rightDragServo.setPosition(0);
+
+ sleep(1000);
+
+ robot.strafe(-0.75);
+ sleep(1000);
+ robot.stop();
+
+ }
+
+ /***
+ public void moveToPosition(double inches, double speed){
+ //
+ int move = (int)(Math.round(inches*conversion));
+ //
+ robot.leftBack.setTargetPosition(robot.leftBack.getCurrentPosition() + move);
+ robot.leftFront.setTargetPosition(robot.leftFront.getCurrentPosition() + move);
+ robot.rightBack.setTargetPosition(robot.rightBack.getCurrentPosition() + move);
+ robot.rightFront.setTargetPosition(robot.rightFront.getCurrentPosition() + move);
+ //
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ //
+ robot.leftBack.setPower(speed);
+ robot.leftFront.setPower(speed);
+ robot.rightBack.setPower(speed);
+ robot.rightFront.setPower(speed);
+ //
+ while (robot.leftFront.isBusy() && robot.rightFront.isBusy() && robot.leftBack.isBusy() && robot.rightBack.isBusy()){
+ if (exit){
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ return;
+ }
+ }
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ robot.leftDragServo.setPosition(0);
+ robot.rightDragServo.setPosition(0);
+ return;
+
+ }
+ ***/
+
+}
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto3.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto3.java
new file mode 100644
index 00000000000..d429eb08831
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto3.java
@@ -0,0 +1,96 @@
+package org.firstinspires.ftc.team6417.irrelevent;
+
+import com.qualcomm.hardware.bosch.BNO055IMU;
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
+
+import org.firstinspires.ftc.robotcore.external.navigation.Acceleration;
+import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
+import org.firstinspires.ftc.team6417.Hardware6417;
+
+@Autonomous(name="ParkLeft", group="Autonomous")
+public class Auto3 extends LinearOpMode {
+
+ Hardware6417 robot = new Hardware6417();
+ BNO055IMU imu;
+ Orientation angles;
+ Acceleration gravity;
+
+ Boolean exit = false;
+
+ public void runOpMode(){
+
+ robot.init(hardwareMap);
+ waitForStart();
+
+ robot.drive(-0.2);
+ sleep(2200);
+ robot.stop();
+
+ robot.leftDragServo.setPosition(0);
+ robot.rightDragServo.setPosition(0.75);
+
+ sleep(1000);
+
+ robot.drive(0.2);
+ sleep(2500);
+ robot.stop();
+
+ robot.leftDragServo.setPosition(0.75);
+ robot.rightDragServo.setPosition(0);
+
+ sleep(1000);
+
+ robot.strafe(0.75);
+ sleep(1000);
+ robot.stop();
+
+ /***
+ while(robot.colorSensor.blue() < 40 && robot.colorSensor.red() < 40){
+ }
+ sleep(1000);
+ ***/
+
+ }
+
+ /***
+ public void moveToPosition(double inches, double speed){
+ //
+ int move = (int)(Math.round(inches*conversion));
+ //
+ robot.leftBack.setTargetPosition(robot.leftBack.getCurrentPosition() + move);
+ robot.leftFront.setTargetPosition(robot.leftFront.getCurrentPosition() + move);
+ robot.rightBack.setTargetPosition(robot.rightBack.getCurrentPosition() + move);
+ robot.rightFront.setTargetPosition(robot.rightFront.getCurrentPosition() + move);
+ //
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ //
+ robot.leftBack.setPower(speed);
+ robot.leftFront.setPower(speed);
+ robot.rightBack.setPower(speed);
+ robot.rightFront.setPower(speed);
+ //
+ while (robot.leftFront.isBusy() && robot.rightFront.isBusy() && robot.leftBack.isBusy() && robot.rightBack.isBusy()){
+ if (exit){
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ return;
+ }
+ }
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ robot.leftDragServo.setPosition(0);
+ robot.rightDragServo.setPosition(0);
+ return;
+
+ }
+ ***/
+
+}
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto6417.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto6417.java
new file mode 100644
index 00000000000..31012a25c28
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto6417.java
@@ -0,0 +1,300 @@
+package org.firstinspires.ftc.team6417.irrelevent;
+
+import com.qualcomm.hardware.bosch.BNO055IMU;
+import com.qualcomm.hardware.bosch.JustLoggingAccelerationIntegrator;
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
+import com.qualcomm.robotcore.hardware.DcMotor;
+
+import org.firstinspires.ftc.robotcore.external.navigation.Acceleration;
+import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesReference;
+import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
+import org.firstinspires.ftc.team6417.Hardware6417;
+
+
+//@disabled
+@Autonomous(name="WAFFLE BOI RED", group="Autonomous")
+public class Auto6417 extends LinearOpMode {
+
+ Hardware6417 robot = new Hardware6417();
+
+ //28 * 20 / (2ppi * 4.125)
+ Double width = 16.0; //inches
+ Integer cpr = 723; //counts per rotation
+ Integer gearratio = 26;
+ Double diameter = 4.125;
+ Double cpi = (cpr * gearratio)/(Math.PI * diameter); //counts per inch, 28cpr * gear ratio / (2 * pi * diameter (in inches, in the center))
+ Double bias = 0.8;//default 0.8
+ Double meccyBias = 0.9;//change to adjust only strafing movement
+ //
+ Double conversion = cpi * bias;
+ Boolean exit = false;
+ //
+ BNO055IMU imu;
+ Orientation angles;
+ Acceleration gravity;
+ //
+ public void runOpMode(){
+
+ robot.init(hardwareMap);
+ initGyro();
+ waitForStartify();
+
+ moveToPosition(-46.4, 0.2);
+
+ /***
+ moveToPosition(46.4, 0.2);
+ strafeToPosition(23.6, 0.2);
+ moveToPosition(-22.8, 0.2);
+ turnWithGyro(90, 0.2);
+ moveToPosition(22.8, 0.2);
+ robot.leftDragServo.setPosition(0.75);
+ robot.rightDragServo.setPosition(0.75);
+ ***/
+
+ }
+ /*
+ This function's purpose is simply to drive forward.
+ */
+ public void moveToPosition(double inches, double speed){
+ //
+ int move = (int)(Math.round(inches*conversion));
+ //
+ robot.leftBack.setTargetPosition(robot.leftBack.getCurrentPosition() + move);
+ robot.leftFront.setTargetPosition(robot.leftFront.getCurrentPosition() + move);
+ robot.rightBack.setTargetPosition(robot.rightBack.getCurrentPosition() + move);
+ robot.rightFront.setTargetPosition(robot.rightFront.getCurrentPosition() + move);
+ //
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ //
+ robot.leftBack.setPower(speed);
+ robot.leftFront.setPower(speed);
+ robot.rightBack.setPower(speed);
+ robot.rightFront.setPower(speed);
+ //
+ while (robot.leftFront.isBusy() && robot.rightFront.isBusy() && robot.leftBack.isBusy() && robot.rightBack.isBusy()){
+ if (exit){
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ return;
+ }
+ }
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ robot.leftDragServo.setPosition(0);
+ robot.rightDragServo.setPosition(0);
+ return;
+
+ }
+ //
+ /*
+ This function uses the Expansion Hub IMU Gyro to turn a 90 degrees.
+ */
+ public void turnWithGyro(double degrees, double speedDirection){
+ //
+ angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+ double yaw = -angles.firstAngle;//make this negative
+ telemetry.addData("Speed Direction", speedDirection);
+ telemetry.addData("Yaw", yaw);
+ telemetry.update();
+ //
+ telemetry.addData("stuff", speedDirection);
+ telemetry.update();
+ //
+ double first;
+ double second;
+ //
+ //
+ if (speedDirection > 0){//set target positions
+ //
+ if (degrees > 10){
+ first = (degrees - 10) + devertify(yaw);
+ second = degrees + devertify(yaw);
+ }else{
+ first = devertify(yaw);
+ second = degrees + devertify(yaw);
+ }
+ //
+ }else{
+ //
+ if (degrees > 10){
+ first = devertify(-(degrees - 10) + devertify(yaw));
+ second = devertify(-degrees + devertify(yaw));
+ }else{
+ first = devertify(yaw);
+ second = devertify(-degrees + devertify(yaw));
+ }
+ //
+ //
+ }
+ //
+ //
+ Double firsta = convertify(first - 5);//175
+ Double firstb = convertify(first + 5);//-175
+ //
+ turnWithEncoder(speedDirection);
+ //
+ if (Math.abs(firsta - firstb) < 11) {
+ while (!(firsta < yaw && yaw < firstb) && opModeIsActive()) {//within range?
+ angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+ gravity = imu.getGravity();
+ yaw = -angles.firstAngle;
+ telemetry.addData("Position", yaw);
+ telemetry.addData("first before", first);
+ telemetry.addData("first after", convertify(first));
+ telemetry.update();
+ }
+ }else{
+ //
+ while (!((firsta < yaw && yaw < 180) || (-180 < yaw && yaw < firstb)) && opModeIsActive()) {//within range?
+ angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+ gravity = imu.getGravity();
+ yaw = -angles.firstAngle;
+ telemetry.addData("Position", yaw);
+ telemetry.addData("first before", first);
+ telemetry.addData("first after", convertify(first));
+ telemetry.update();
+ }
+ }
+ //
+ Double seconda = convertify(second - 5);//175
+ Double secondb = convertify(second + 5);//-175
+ //
+ turnWithEncoder(speedDirection / 3);
+ //
+ if (Math.abs(seconda - secondb) < 11) {
+ while (!(seconda < yaw && yaw < secondb) && opModeIsActive()) {//within range?
+ angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+ gravity = imu.getGravity();
+ yaw = -angles.firstAngle;
+ telemetry.addData("Position", yaw);
+ telemetry.addData("second before", second);
+ telemetry.addData("second after", convertify(second));
+ telemetry.update();
+ }
+ while (!((seconda < yaw && yaw < 180) || (-180 < yaw && yaw < secondb)) && opModeIsActive()) {//within range?
+ angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+ gravity = imu.getGravity();
+ yaw = -angles.firstAngle;
+ telemetry.addData("Position", yaw);
+ telemetry.addData("second before", second);
+ telemetry.addData("second after", convertify(second));
+ telemetry.update();
+ }
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ }
+ //
+ //
+ robot.leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ robot.rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ robot.leftBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ robot.rightBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ }
+ //
+ /*
+ This function uses the encoders to strafe left or right.
+ This section of the code strafes the bot towards the center of the field
+ */
+ public void strafeToPosition(double inches, double speed){
+ //
+ int move = (int)(Math.round(inches * cpi * meccyBias));
+ //
+ robot.leftBack.setTargetPosition(robot.leftBack.getCurrentPosition() - move);
+ robot.leftFront.setTargetPosition(robot.leftFront.getCurrentPosition() + move);
+ robot.rightBack.setTargetPosition(robot.rightBack.getCurrentPosition() + move);
+ robot.rightFront.setTargetPosition(robot.rightFront.getCurrentPosition() - move);
+ //
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ //
+ robot.leftFront.setPower(speed);
+ robot.leftBack.setPower(speed);
+ robot.rightFront.setPower(speed);
+ robot.rightBack.setPower(speed);
+ //
+ while (robot.leftFront.isBusy() && robot.rightFront.isBusy() && robot.leftBack.isBusy() && robot.rightBack.isBusy()){}
+ robot.rightFront.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.leftBack.setPower(0);
+ return;
+ }
+
+ public void waitForStartify(){
+ waitForStart();
+ }
+ //
+ /*
+ These functions are used in the turnWithGyro function to ensure inputs
+ are interpreted properly.
+ */
+ public double devertify(double degrees){
+ if (degrees < 0){
+ degrees = degrees + 360;
+ }
+ return degrees;
+ }
+ public double convertify(double degrees){
+ if (degrees > 179){
+ degrees = -(360 - degrees);
+ } else if(degrees < -180){
+ degrees = 360 + degrees;
+ } else if(degrees > 360){
+ degrees = degrees - 360;
+ }
+ return degrees;
+ }
+ //
+ /*
+ This function is called at the beginning of the program to activate
+ the IMU Integrated Gyro.
+ */
+ public void initGyro(){
+ BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();
+ parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES;
+ parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC;
+ //parameters.calibrationDataFile = "GyroCal.json"; // see the calibration sample opmode
+ parameters.loggingEnabled = true;
+ parameters.loggingTag = "IMU";
+ parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator();
+ //
+ imu = hardwareMap.get(BNO055IMU.class, "imu");
+ imu.initialize(parameters);
+ }
+ //
+ /*
+ This function is used in the turnWithGyro function to set the
+ encoder mode and turn.
+ */
+ public void turnWithEncoder(double input){
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ //
+ robot.leftFront.setPower(input);
+ robot.leftBack.setPower(input);
+ robot.rightFront.setPower(-input);
+ robot.rightBack.setPower(-input);
+ }
+ //
+}
\ No newline at end of file
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto6417Blue.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto6417Blue.java
new file mode 100644
index 00000000000..638a27ba7ee
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/Auto6417Blue.java
@@ -0,0 +1,297 @@
+package org.firstinspires.ftc.team6417.irrelevent;
+
+import com.qualcomm.hardware.bosch.BNO055IMU;
+import com.qualcomm.hardware.bosch.JustLoggingAccelerationIntegrator;
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
+import com.qualcomm.robotcore.hardware.DcMotor;
+
+import org.firstinspires.ftc.robotcore.external.navigation.Acceleration;
+import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder;
+import org.firstinspires.ftc.robotcore.external.navigation.AxesReference;
+import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
+import org.firstinspires.ftc.team6417.Hardware6417;
+
+
+//@disabled
+@Autonomous(name="WAFFLE BOI BLUE", group="Autonomous")
+public class Auto6417Blue extends LinearOpMode {
+
+ Hardware6417 robot = new Hardware6417();
+
+ //28 * 20 / (2ppi * 4.125)
+ Double width = 16.0; //inches
+ Integer cpr = 28; //counts per rotation
+ Integer gearratio = 26;
+ Double diameter = 4.125;
+ Double cpi = (cpr * gearratio)/(Math.PI * diameter); //counts per inch, 28cpr * gear ratio / (2 * pi * diameter (in inches, in the center))
+ Double bias = 0.8;//default 0.8
+ Double meccyBias = 0.9;//change to adjust only strafing movement
+ //
+ Double conversion = cpi * bias;
+ Boolean exit = false;
+ //
+ BNO055IMU imu;
+ Orientation angles;
+ Acceleration gravity;
+ //
+ public void runOpMode(){
+
+ robot.init(hardwareMap);
+ initGyro();
+ waitForStartify();
+
+ moveToPosition(46.4, 0.2);
+ moveToPosition(-46.4, 0.2);
+ strafeToPosition(-23.6, 0.2);
+ moveToPosition(22.8, 0.2);
+ turnWithGyro(90, 0.2);
+ moveToPosition(-22.8, 0.2);
+ robot.leftDragServo.setPosition(0.75);
+ robot.rightDragServo.setPosition(0.75);
+
+ }
+ /*
+ This function's purpose is simply to drive forward.
+ */
+ public void moveToPosition(double inches, double speed){
+ //
+ int move = (int)(Math.round(inches*conversion));
+ //
+ robot.leftBack.setTargetPosition(robot.leftBack.getCurrentPosition() + move);
+ robot.leftFront.setTargetPosition(robot.leftFront.getCurrentPosition() + move);
+ robot.rightBack.setTargetPosition(robot.rightBack.getCurrentPosition() + move);
+ robot.rightFront.setTargetPosition(robot.rightFront.getCurrentPosition() + move);
+ //
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ //
+ robot.leftBack.setPower(speed);
+ robot.leftFront.setPower(speed);
+ robot.rightBack.setPower(speed);
+ robot.rightFront.setPower(speed);
+ //
+ while (robot.leftFront.isBusy() && robot.rightFront.isBusy() && robot.leftBack.isBusy() && robot.rightBack.isBusy()){
+ if (exit){
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ return;
+ }
+ }
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ robot.leftDragServo.setPosition(0);
+ robot.rightDragServo.setPosition(0);
+ return;
+
+ }
+ //
+ /*
+ This function uses the Expansion Hub IMU Gyro to turn a 90 degrees.
+ */
+ public void turnWithGyro(double degrees, double speedDirection){
+ //
+ angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+ double yaw = -angles.firstAngle;//make this negative
+ telemetry.addData("Speed Direction", speedDirection);
+ telemetry.addData("Yaw", yaw);
+ telemetry.update();
+ //
+ telemetry.addData("stuff", speedDirection);
+ telemetry.update();
+ //
+ double first;
+ double second;
+ //
+ //
+ if (speedDirection > 0){//set target positions
+ //
+ if (degrees > 10){
+ first = (degrees - 10) + devertify(yaw);
+ second = degrees + devertify(yaw);
+ }else{
+ first = devertify(yaw);
+ second = degrees + devertify(yaw);
+ }
+ //
+ }else{
+ //
+ if (degrees > 10){
+ first = devertify(-(degrees - 10) + devertify(yaw));
+ second = devertify(-degrees + devertify(yaw));
+ }else{
+ first = devertify(yaw);
+ second = devertify(-degrees + devertify(yaw));
+ }
+ //
+ //
+ }
+ //
+ //
+ Double firsta = convertify(first - 5);//175
+ Double firstb = convertify(first + 5);//-175
+ //
+ turnWithEncoder(speedDirection);
+ //
+ if (Math.abs(firsta - firstb) < 11) {
+ while (!(firsta < yaw && yaw < firstb) && opModeIsActive()) {//within range?
+ angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+ gravity = imu.getGravity();
+ yaw = -angles.firstAngle;
+ telemetry.addData("Position", yaw);
+ telemetry.addData("first before", first);
+ telemetry.addData("first after", convertify(first));
+ telemetry.update();
+ }
+ }else{
+ //
+ while (!((firsta < yaw && yaw < 180) || (-180 < yaw && yaw < firstb)) && opModeIsActive()) {//within range?
+ angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+ gravity = imu.getGravity();
+ yaw = -angles.firstAngle;
+ telemetry.addData("Position", yaw);
+ telemetry.addData("first before", first);
+ telemetry.addData("first after", convertify(first));
+ telemetry.update();
+ }
+ }
+ //
+ Double seconda = convertify(second - 5);//175
+ Double secondb = convertify(second + 5);//-175
+ //
+ turnWithEncoder(speedDirection / 3);
+ //
+ if (Math.abs(seconda - secondb) < 11) {
+ while (!(seconda < yaw && yaw < secondb) && opModeIsActive()) {//within range?
+ angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+ gravity = imu.getGravity();
+ yaw = -angles.firstAngle;
+ telemetry.addData("Position", yaw);
+ telemetry.addData("second before", second);
+ telemetry.addData("second after", convertify(second));
+ telemetry.update();
+ }
+ while (!((seconda < yaw && yaw < 180) || (-180 < yaw && yaw < secondb)) && opModeIsActive()) {//within range?
+ angles = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+ gravity = imu.getGravity();
+ yaw = -angles.firstAngle;
+ telemetry.addData("Position", yaw);
+ telemetry.addData("second before", second);
+ telemetry.addData("second after", convertify(second));
+ telemetry.update();
+ }
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ }
+ //
+ //
+ robot.leftFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ robot.rightFront.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ robot.leftBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+ robot.rightBack.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
+
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ }
+ //
+ /*
+ This function uses the encoders to strafe left or right.
+ This section of the code strafes the bot towards the center of the field
+ */
+ public void strafeToPosition(double inches, double speed){
+ //
+ int move = (int)(Math.round(inches * cpi * meccyBias));
+ //
+ robot.leftBack.setTargetPosition(robot.leftBack.getCurrentPosition() - move);
+ robot.leftFront.setTargetPosition(robot.leftFront.getCurrentPosition() + move);
+ robot.rightBack.setTargetPosition(robot.rightBack.getCurrentPosition() + move);
+ robot.rightFront.setTargetPosition(robot.rightFront.getCurrentPosition() - move);
+ //
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ //
+ robot.leftFront.setPower(speed);
+ robot.leftBack.setPower(speed);
+ robot.rightFront.setPower(speed);
+ robot.rightBack.setPower(speed);
+ //
+ while (robot.leftFront.isBusy() && robot.rightFront.isBusy() && robot.leftBack.isBusy() && robot.rightBack.isBusy()){}
+ robot.rightFront.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.leftBack.setPower(0);
+ return;
+ }
+
+ public void waitForStartify(){
+ waitForStart();
+ }
+ //
+ /*
+ These functions are used in the turnWithGyro function to ensure inputs
+ are interpreted properly.
+ */
+ public double devertify(double degrees){
+ if (degrees < 0){
+ degrees = degrees + 360;
+ }
+ return degrees;
+ }
+ public double convertify(double degrees){
+ if (degrees > 179){
+ degrees = -(360 - degrees);
+ } else if(degrees < -180){
+ degrees = 360 + degrees;
+ } else if(degrees > 360){
+ degrees = degrees - 360;
+ }
+ return degrees;
+ }
+ //
+ /*
+ This function is called at the beginning of the program to activate
+ the IMU Integrated Gyro.
+ */
+ public void initGyro(){
+ BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();
+ parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES;
+ parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC;
+ //parameters.calibrationDataFile = "GyroCal.json"; // see the calibration sample opmode
+ parameters.loggingEnabled = true;
+ parameters.loggingTag = "IMU";
+ parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator();
+ //
+ imu = hardwareMap.get(BNO055IMU.class, "imu");
+ imu.initialize(parameters);
+ }
+ //
+ /*
+ This function is used in the turnWithGyro function to set the
+ encoder mode and turn.
+ */
+ public void turnWithEncoder(double input){
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
+ //
+ robot.leftFront.setPower(input);
+ robot.leftBack.setPower(input);
+ robot.rightFront.setPower(-input);
+ robot.rightBack.setPower(-input);
+ }
+ //
+}
\ No newline at end of file
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/PullMat.java b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/PullMat.java
new file mode 100644
index 00000000000..be43e2d6bb5
--- /dev/null
+++ b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/irrelevent/PullMat.java
@@ -0,0 +1,86 @@
+package org.firstinspires.ftc.team6417.irrelevent;
+
+import com.qualcomm.hardware.bosch.BNO055IMU;
+import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
+import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
+
+import org.firstinspires.ftc.robotcore.external.navigation.Acceleration;
+import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
+import org.firstinspires.ftc.team6417.Hardware6417;
+
+@Autonomous(name="PullMat", group="Autonomous")
+public class PullMat extends LinearOpMode {
+
+ Hardware6417 robot = new Hardware6417();
+ BNO055IMU imu;
+ Orientation angles;
+ Acceleration gravity;
+
+ Boolean exit = false;
+
+ public void runOpMode(){
+
+ robot.init(hardwareMap);
+ waitForStart();
+
+ robot.drive(-0.1);
+ sleep(3200);
+ robot.stop();
+
+ robot.leftDragServo.setPosition(0);
+ robot.rightDragServo.setPosition(0.75);
+
+ sleep(1000);
+
+ robot.drive(0.1);
+ sleep(3200);
+ robot.stop();
+
+ robot.leftDragServo.setPosition(0.75);
+ robot.rightDragServo.setPosition(0);
+
+ sleep(1000);
+
+ }
+
+ /***
+ public void moveToPosition(double inches, double speed){
+ //
+ int move = (int)(Math.round(inches*conversion));
+ //
+ robot.leftBack.setTargetPosition(robot.leftBack.getCurrentPosition() + move);
+ robot.leftFront.setTargetPosition(robot.leftFront.getCurrentPosition() + move);
+ robot.rightBack.setTargetPosition(robot.rightBack.getCurrentPosition() + move);
+ robot.rightFront.setTargetPosition(robot.rightFront.getCurrentPosition() + move);
+ //
+ robot.leftBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.leftFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightBack.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ robot.rightFront.setMode(DcMotor.RunMode.RUN_TO_POSITION);
+ //
+ robot.leftBack.setPower(speed);
+ robot.leftFront.setPower(speed);
+ robot.rightBack.setPower(speed);
+ robot.rightFront.setPower(speed);
+ //
+ while (robot.leftFront.isBusy() && robot.rightFront.isBusy() && robot.leftBack.isBusy() && robot.rightBack.isBusy()){
+ if (exit){
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ return;
+ }
+ }
+ robot.leftBack.setPower(0);
+ robot.leftFront.setPower(0);
+ robot.rightBack.setPower(0);
+ robot.rightFront.setPower(0);
+ robot.leftDragServo.setPosition(0);
+ robot.rightDragServo.setPosition(0);
+ return;
+
+ }
+ ***/
+
+}
diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/readme.md b/TeamCode/src/main/java/org/firstinspires/ftc/team6417/readme.md
similarity index 100%
rename from TeamCode/src/main/java/org/firstinspires/ftc/teamcode/readme.md
rename to TeamCode/src/main/java/org/firstinspires/ftc/team6417/readme.md
diff --git a/bluejay/build.gradle b/bluejay/build.gradle
new file mode 100644
index 00000000000..2e34cc345b4
--- /dev/null
+++ b/bluejay/build.gradle
@@ -0,0 +1,38 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 28
+ buildToolsVersion '28.0.3'
+
+ defaultConfig {
+ minSdkVersion 19
+ targetSdkVersion 27
+ versionCode 1
+ versionName "1.0"
+
+
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+ }
+}
+repositories {
+ flatDir {
+ dirs '../libs'
+ }
+}
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+ implementation project(path: ':openCVLibrary3')
+ implementation (name: 'RobotCore-release', ext: 'aar')
+ implementation project(path: ':FtcRobotController')
+ implementation project(path: ':DogeCV')
+
+}
diff --git a/bluejay/src/main/AndroidManifest.xml b/bluejay/src/main/AndroidManifest.xml
new file mode 100644
index 00000000000..4610bbb91da
--- /dev/null
+++ b/bluejay/src/main/AndroidManifest.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff --git a/bluejay/src/main/java/detectors/ClosableVuforiaLocalizer.java b/bluejay/src/main/java/detectors/ClosableVuforiaLocalizer.java
new file mode 100644
index 00000000000..d5e8d3c3045
--- /dev/null
+++ b/bluejay/src/main/java/detectors/ClosableVuforiaLocalizer.java
@@ -0,0 +1,15 @@
+package detectors;
+
+import org.firstinspires.ftc.robotcore.internal.vuforia.VuforiaLocalizerImpl;
+
+public class ClosableVuforiaLocalizer extends VuforiaLocalizerImpl {
+ boolean closed = false;
+ public ClosableVuforiaLocalizer(Parameters parameters) {
+ super(parameters);
+ }
+ @Override
+ public void close() {
+ if (!closed) super.close();
+ closed = true;
+ }
+}
\ No newline at end of file
diff --git a/bluejay/src/main/java/detectors/FoundationPipeline/Analysis.java b/bluejay/src/main/java/detectors/FoundationPipeline/Analysis.java
new file mode 100644
index 00000000000..6df5e949407
--- /dev/null
+++ b/bluejay/src/main/java/detectors/FoundationPipeline/Analysis.java
@@ -0,0 +1,77 @@
+package detectors.FoundationPipeline;
+
+import org.opencv.core.Mat;
+import org.opencv.core.Point;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+public class Analysis {
+
+ /*
+ * In order of left to right, return gaps between stones (sorted),
+ * provided that there is a non negative distance between
+ * the end of one stone and the start of another
+ */
+ private static List gaps(List stones) {
+ if(stones.size()==0) return new ArrayList();
+
+ Stone first = stones.get(0).clone();
+ Stone last = stones.get(stones.size()-1).clone();
+
+ first.bounds.x-=first.bounds.width*2;
+ last.bounds.x+=last.bounds.width*2;
+ stones.add(0,first);
+ stones.add(last);
+
+ List ret = new ArrayList();
+
+ if(stones.size()<=1) return ret;
+
+ //sort stones
+ Collections.sort(stones, new Comparator() {
+ public int compare(Stone one, Stone two) {
+ if(one.x < two.x) return -1;
+ if(one.x > two.x) return 1;
+ return 0;
+ }
+ });
+
+ //iterate over stones and make gaps
+ for(int i=0;i 0) {
+ ret.add(new gap((int)stones.get(i).y,
+ stones.get(i).bounds.x+stones.get(i).bounds.width,
+ stones.get(i+1).bounds.x));
+ }
+
+ }
+
+ return ret;
+ }
+
+ public static Point skystonePosition(List stones, Mat canvas) {
+ List gaps = gaps(stones);
+
+ for(gap g : gaps) {
+ g.draw(canvas);
+ }
+
+ if(gaps.size()==0)return null;
+
+ Collections.sort(gaps, new Comparator() {
+ public int compare(gap o1, gap o2) {
+ if(o1.width > o2.width)return 1;
+ if(o1.width < o2.width)return -1;
+ return 0;
+ }
+ });
+
+ return gaps.get(0).center;
+ }
+}
diff --git a/bluejay/src/main/java/detectors/FoundationPipeline/Constants.java b/bluejay/src/main/java/detectors/FoundationPipeline/Constants.java
new file mode 100644
index 00000000000..dfd7a1b1f42
--- /dev/null
+++ b/bluejay/src/main/java/detectors/FoundationPipeline/Constants.java
@@ -0,0 +1,74 @@
+package detectors.FoundationPipeline;
+
+import org.opencv.core.Mat;
+
+public class Constants {
+ public static final double[] blueColor1 = {170,180};
+ public static final double[] blueColor2 = {0,10};
+
+ public static final double[] redColor = {110,120};
+
+ public static final double[] yellowColor = {7+67,38+67};
+ public static final double[] stressedYellowColor = {-12+67,45+67};
+
+ public static Mat redOutput = new Mat();
+ public static Mat blueOutput = new Mat();
+ public static Mat blackOutput = new Mat();
+ public static Mat yellowOutput = new Mat();
+ public static Mat yellowTags = new Mat();
+
+ public static void updateColors(Mat resizedImage, Mat equalizedImage, double blackCutOff) {
+ /*
+ //For yellow
+ double[] yellowRange = {73,86};
+
+ //For Blue
+ double[] blueRange1 = {160,180};
+ double[] blueRange2 = {0,20};
+
+ //for Red
+ double[] redRange = {40,63};
+ */
+
+ double[] satRange = {60, 255};
+ double[] valRange = {blackCutOff*1.0, 255};
+
+ redOutput = compute.threshold(resizedImage, redColor, satRange, valRange);
+
+ blueOutput = compute.combine(
+ compute.threshold(resizedImage, blueColor1, satRange, valRange),
+ compute.threshold(resizedImage, blueColor2, satRange, valRange));
+
+ blackOutput = compute.threshold(
+ resizedImage,
+ new double[]{0, 255},//hue 0, 180
+ new double[]{0, 180},//sat 0, 180
+ new double[]{0, blackCutOff*0.8});//val
+
+
+ //For yellow HUE HUE HUE
+ double[] yellowRange = yellowColor;
+ double[] stressedYellowRange = stressedYellowColor;
+
+ //STONE STONE STONE
+ yellowOutput = compute.threshold( //equalize to spread. yellowRange to be less
+ equalizedImage,
+ yellowRange,
+ new double[]{100, 255},//sat
+ new double[]{blackCutOff*1.0, 255}); //val
+
+ //SKYSTONE SKYSTONE
+ yellowTags = compute.threshold( //just want all of it
+ resizedImage,
+ stressedYellowRange,
+ new double[]{90, 255},//sat
+ new double[]{blackCutOff*0.8 , 255}); //val
+ // Mat yellowTags = compute.threshold(
+// resizedImage,
+// new double[]{80,105},
+// new double[]{100, 255},//sat
+// new double[]{blackCutOff*1.5, 255}); //val
+
+ }
+
+}
diff --git a/bluejay/src/main/java/detectors/FoundationPipeline/Detected.java b/bluejay/src/main/java/detectors/FoundationPipeline/Detected.java
new file mode 100644
index 00000000000..7e1fd9ee904
--- /dev/null
+++ b/bluejay/src/main/java/detectors/FoundationPipeline/Detected.java
@@ -0,0 +1,73 @@
+package detectors.FoundationPipeline;
+
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfPoint;
+import org.opencv.core.Point;
+import org.opencv.core.Rect;
+import org.opencv.core.Scalar;
+import org.opencv.imgproc.Imgproc;
+
+import java.util.Arrays;
+
+class Detected {
+ enum Color {
+ BLUE, RED, YELLOW, BLACK, STONE
+ }
+
+ double x, y;
+ double length;
+ MatOfPoint shape;
+ Color c;
+ boolean isBastard = false;
+ Rect bounds;
+
+ public Detected(MatOfPoint shape, Color c) {
+ this.length = circularity(shape);
+
+ double size = Imgproc.contourArea(shape);
+ if(c== Color.BLACK){
+ if (length < 1)
+ isBastard = true;
+ if(size<200) isBastard = true;
+ }else{
+ if(size<1300) isBastard = true;
+ }
+ if(isBastard)return;
+
+ this.shape = shape;
+ bounds = Imgproc.boundingRect(shape);
+ Point centerPoint = center(shape);
+ this.x = centerPoint.x;
+ this.y = centerPoint.y;
+ this.c = c;
+
+ }
+
+ //will use rectangular bounds instead of moments because Moments
+ //are expensive to calculate and Rectangles are perfectly
+ //fine for our horozontally aligned foundations
+ Point center(MatOfPoint inp) {
+ return new Point(bounds.x+bounds.width/2, bounds.y+bounds.height/2);
+ }
+
+ //We will cheat and do width/height because the correct calculation is expensive
+ //higher is longer
+ double circularity(MatOfPoint inp) {
+ final Rect bb = Imgproc.boundingRect(inp);
+ final double ratio = bb.width / (double) bb.height;
+ return ratio;
+ //double perimeter = Imgproc.arcLength(new MatOfPoint2f(inp.toArray()),true);
+ //return (Math.PI * perimeter * perimeter) / (4 * Imgproc.contourArea(inp));
+ }
+
+ public void draw(Mat canvas) {
+ Scalar color = new Scalar(00, 255, 00);
+ Scalar black = new Scalar(0, 0, 0);
+
+ Imgproc.drawContours(canvas, Arrays.asList(shape), 0, color, 2);
+ Imgproc.putText(canvas, c.toString(), new Point(bounds.tl().x,bounds.tl().y+20), 0, 0.6, black, 7);
+ Imgproc.putText(canvas, c.toString(), new Point(bounds.tl().x,bounds.tl().y+20), 0, 0.6, color, 2);
+ Imgproc.circle(canvas, new Point(x, y), 4, new Scalar(255, 255, 255), -1);
+ }
+
+}
diff --git a/bluejay/src/main/java/detectors/FoundationPipeline/Foundation.java b/bluejay/src/main/java/detectors/FoundationPipeline/Foundation.java
new file mode 100644
index 00000000000..f28faccbf25
--- /dev/null
+++ b/bluejay/src/main/java/detectors/FoundationPipeline/Foundation.java
@@ -0,0 +1,70 @@
+package detectors.FoundationPipeline;
+
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfPoint;
+import org.opencv.core.Point;
+import org.opencv.core.Rect;
+import org.opencv.core.Scalar;
+import org.opencv.imgproc.Imgproc;
+
+public class Foundation {
+ enum Type {
+ BLUEFOUNDATION, REDFOUNDATION, UNKNOWNFOUNDATION
+ }
+
+ public int x = 0;
+ public int y = 0;
+ public Type t;
+ Rect bounds;
+
+ public Foundation(Rect bounds, Type t) {
+ this.x = bounds.x + bounds.width / 2;
+ this.y = bounds.y + bounds.height / 2;
+ this.bounds = bounds;
+ this.t = t;
+ }
+
+ public void draw(Mat canvas) {
+ Scalar color = new Scalar(00, 255, 00);
+ Scalar black = new Scalar(0, 0, 0);
+
+ Imgproc.rectangle(canvas, bounds.tl(), bounds.br(), new Scalar(255, 0, 0), 4);
+ Imgproc.putText(canvas, t.toString(), new Point(bounds.tl().x,bounds.tl().y+20), 0, 0.6, black, 7);
+ Imgproc.putText(canvas, t.toString(), new Point(bounds.tl().x,bounds.tl().y+20), 0, 0.6, color, 2);
+
+ }
+
+
+ /**
+ * @param d is a black detected
+ * @param j is either blue or red or yellow detected
+ */
+ static Foundation createFoundation(Detected d, Detected j) {
+ //combine Point arrays
+ Point[] blackPoints = d.shape.toArray();
+ Point[] colorPoints = j.shape.toArray();
+ Point[] allTogetherNow = new Point[blackPoints.length+colorPoints.length];
+ for(int i =0;i foundations = new ArrayList<>();
+ public static List stones = new ArrayList<>();
+ public static List skyStones = new ArrayList<>();
+
+ private static int blackcut=0;
+
+ public static boolean doFoundations = false;
+ public static boolean doStones = false;
+ public static boolean doSkyStones = true;
+
+
+ public static Mat process(Mat source0){
+
+ if(FtcRobotControllerActivity.PercentAvailable computeSkyStones(Mat yellowTags){
+ //morph
+ yellowTags = compute.fillHoro(yellowTags);
+
+ List skyStones = new ArrayList<>();
+
+ List hulls = compute.findHulls(yellowTags);
+
+ Mat mask = yellowTags.clone();
+ compute.rectangle(mask,true);
+
+ compute.drawHulls(hulls,mask, new Scalar(255,255,255),-1);
+ compute.drawHulls(hulls,mask, new Scalar(0,0,0),2);//fuckin' aliased edges
+
+ mask = compute.flip(mask);
+ yellowTags = compute.add(yellowTags,mask);
+
+ //Start.display(yellowTags,1,"yellowTAG");
+
+ //setup Mat
+ Mat drawInternalHulls = new Mat(yellowTags.rows(), yellowTags.cols(), CvType.CV_8UC3);
+
+ Imgproc.rectangle(drawInternalHulls,
+ new Point(0,0),
+ new Point(drawInternalHulls.width(),drawInternalHulls.height()),
+ new Scalar(0,0,0),
+ -1);
+
+ yellowTags = compute.flip(yellowTags);
+
+ //Start.display(yellowTags,1,"flipTags");
+ List internalHulls = compute.findHulls(yellowTags);
+ internalHulls = compute.filterContours(internalHulls,1500);//1700
+
+ compute.drawHulls(internalHulls,drawInternalHulls);
+ //Start.display(drawInternalHulls,1,"hulls");
+
+ for(MatOfPoint h : internalHulls) {
+ SkyStone ss = new SkyStone(h);
+ if(!ss.isBastard) {
+ skyStones.add(ss);
+ }
+ }
+
+ mask.release();
+ drawInternalHulls.release();
+
+ return skyStones;
+ }
+
+ /*
+ * Takes in yellow masks, and image to annotate on
+ * spits out list of Stones
+ */
+ private static List computeStones(Mat yellowOutput){
+ Mat dTrans = compute.distanceTransform(yellowOutput,12);
+ //Start.display(dTrans,1,"trans");
+
+ List stonesContour = compute.findHulls(dTrans);
+
+ List stones = new ArrayList<>();
+
+ for(MatOfPoint con : stonesContour) {
+ Stone d = new Stone(con);
+ if(!d.isBastard) {
+ stones.add(d);
+ }
+ }
+
+ dTrans.release();
+
+ return stones;
+ }
+
+ /*
+ * Takes in red, blue, yellow, black masks, and image to annotate on
+ * spits out list of Foundations
+ */
+ private static List computeFoundations(Mat redOutput, Mat blueOutput, Mat yellowOutput, Mat blackOutput, Mat canvas){
+ //Find Contours
+ List hullsRed = compute.findHulls(redOutput);
+ List hullsBlue = compute.findHulls(blueOutput);
+ List hullsYellow = compute.findHulls(yellowOutput);
+
+ //populate array of detected (color only)
+ List detected = new ArrayList<>();
+ List detectedHulls = new ArrayList<>();
+
+ //we will segregate the blacks
+ List blacks = new ArrayList<>();
+
+ for (MatOfPoint p : hullsRed) {
+ Detected toadd = new Detected(p, Detected.Color.RED);
+ if (!toadd.isBastard) {
+ detected.add(toadd);
+ detectedHulls.add(p);
+ }
+ }
+ for (MatOfPoint p : hullsBlue) {
+ Detected toadd = new Detected(p, Detected.Color.BLUE);
+ if (!toadd.isBastard) {
+ detected.add(toadd);
+ detectedHulls.add(p);
+ }
+ }
+ /*
+ for (MatOfPoint p : hullsYellow) {
+ Detected toadd = new Detected(p, Detected.Color.YELLOW);
+ if (!toadd.isBastard) {
+ detected.add(toadd);
+ }
+ }*/
+ Mat detectedAll = new Mat(redOutput.rows(),redOutput.cols(),redOutput.type());
+ Imgproc.rectangle(detectedAll,
+ new Point(0,0),
+ new Point(detectedAll.width(),detectedAll.height()),
+ new Scalar(0,0,0),
+ -1);
+ compute.drawHulls(detectedHulls, detectedAll, new Scalar(255,255,255),-1);
+
+ //limit black to regions underneath
+ Imgproc.dilate(detectedAll,detectedAll,
+ Imgproc.getStructuringElement(
+ Imgproc.MORPH_RECT,
+ new Size(1,80),
+ new Point(0,0)
+ ));
+ detectedAll = compute.flip(detectedAll);
+ blackOutput = compute.subtract(blackOutput,detectedAll);
+
+ //cut sides of color contours. Field walls are bad.
+ for(Detected d:detected) {
+ Point one = new Point(d.bounds.x,d.bounds.y+d.bounds.height*0.1);
+ Point two = new Point(d.bounds.x,d.bounds.y+d.bounds.height*0.1+regionSideClipExtensionLength);
+ Imgproc.line(blackOutput,one, two,new Scalar(new double[] {0,0,0}),1);
+
+ one = new Point(d.bounds.x+d.bounds.width,d.bounds.y+d.bounds.height*0.1);
+ two = new Point(d.bounds.x+d.bounds.width,d.bounds.y+d.bounds.height*0.1+regionSideClipExtensionLength);
+ Imgproc.line(blackOutput,one, two,new Scalar(new double[] {0,0,0}),1);
+ }
+
+ ArrayList hullsBlack = compute.findHulls(blackOutput);
+
+ for (MatOfPoint p : hullsBlack) {
+ Detected toadd = new Detected(p, Detected.Color.BLACK);
+ if (!toadd.isBastard) {
+ blacks.add(toadd);
+ }
+ }
+
+ for (Detected d : detected) {
+ d.draw(canvas);
+ }for (Detected d : blacks) {
+ d.draw(canvas);
+ }
+
+ //process sandwiches, populate foundation ArrayList
+ List foundations = new ArrayList<>();
+
+ Imgproc.putText(canvas, String.valueOf(blackcut), new Point(20,20), 0, 0.6, new Scalar(0,0,0), 7);
+ Imgproc.putText(canvas, String.valueOf(blackcut), new Point(20,20), 0, 0.6, new Scalar(255,255,0), 2);
+
+ for (Detected black : blacks) {
+ for (Detected col : detected) {
+ if (black.x > col.x - 40 && //one above the other, within 40 pix
+ black.bounds.y < col.bounds.y+col.bounds.height+30 &&//touching, within 30 pix
+ Math.abs(black.bounds.width*1.0/col.bounds.width-1) < 0.6) {//widths match, within 0.6
+ foundations.add(Foundation.createFoundation(black, col));
+ }
+ }
+ }
+
+ detectedAll.release();
+
+ return foundations;
+ }
+
+}
+
diff --git a/bluejay/src/main/java/detectors/FoundationPipeline/SkyStone.java b/bluejay/src/main/java/detectors/FoundationPipeline/SkyStone.java
new file mode 100644
index 00000000000..5b0f6e04e46
--- /dev/null
+++ b/bluejay/src/main/java/detectors/FoundationPipeline/SkyStone.java
@@ -0,0 +1,37 @@
+package detectors.FoundationPipeline;
+
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfPoint;
+import org.opencv.core.Point;
+import org.opencv.core.RotatedRect;
+import org.opencv.core.Scalar;
+import org.opencv.core.Size;
+import org.opencv.imgproc.Imgproc;
+
+import java.util.Arrays;
+
+public class SkyStone extends Stone {
+
+ public SkyStone(MatOfPoint shape) {
+ super(shape);
+ isBastard = false;
+ if(length<0.4 || Properlength>25)isBastard = true;
+
+ RotatedRect rr = Imgproc.minAreaRect(compute.toDouble(shape));
+ Size s = rr.size;
+ double ratio = Imgproc.contourArea(shape)/(s.width*s.height);
+ //System.out.println(ratio);
+ if(ratio<0.75) isBastard=true;
+ }
+
+ public void draw(Mat canvas) {
+ Scalar color = new Scalar(0, 255, 0);
+ Scalar black = new Scalar(0, 0, 0);
+
+ Imgproc.drawContours(canvas, Arrays.asList(shape), 0, new Scalar(255, 0, 255), 4);
+ Imgproc.putText(canvas, "SKYSTONE", new Point(x, y - 30), 0, 0.6, black, 7);
+ Imgproc.putText(canvas, "SKYSTONE", new Point(x, y - 30), 0, 0.6, color, 2);
+ Imgproc.circle(canvas, new Point(x, y), 4, new Scalar(255, 255, 255), -1);
+ }
+
+}
diff --git a/bluejay/src/main/java/detectors/FoundationPipeline/Stone.java b/bluejay/src/main/java/detectors/FoundationPipeline/Stone.java
new file mode 100644
index 00000000000..541b1f376c9
--- /dev/null
+++ b/bluejay/src/main/java/detectors/FoundationPipeline/Stone.java
@@ -0,0 +1,79 @@
+package detectors.FoundationPipeline;
+
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfPoint;
+import org.opencv.core.MatOfPoint2f;
+import org.opencv.core.Point;
+import org.opencv.core.Rect;
+import org.opencv.core.Scalar;
+import org.opencv.imgproc.Imgproc;
+
+public class Stone {
+
+ public double x, y;
+ double length;
+ double Properlength;
+ MatOfPoint shape;
+ boolean isBastard = false;
+ Rect bounds;
+
+ public Stone(MatOfPoint shape) {
+ bounds = Imgproc.boundingRect(shape);
+ this.length = (1.0*bounds.width)/bounds.height;
+ this.Properlength = circularity(shape);
+
+ if (length < 1)
+ isBastard = true; //We only like the long ones. The short ones will be disposed of
+ if(Imgproc.contourArea(shape)<70)
+ isBastard = true;
+
+ this.shape = shape;
+
+ Point centerPoint = center(bounds);
+ this.x = centerPoint.x;
+ this.y = centerPoint.y;
+
+ //expand bounds
+ bounds.height+=30;
+ bounds.width+=30;
+ bounds.x-=15;
+ bounds.y-=15;
+ }
+
+ //will use rectangular bounds instead of moments because Moments
+ //are expensive to calculate and Rectangles are perfectly
+ //fine for our horozontally aligned foundations
+ Point center(Rect bounds) {
+ return new Point(bounds.x+bounds.width/2, bounds.y+bounds.height/2);
+ }
+
+ //We will cheat and do width/height because the correct calculation is expensive
+ double circularity(MatOfPoint inp) {
+ //final Rect bb = Imgproc.boundingRect(inp);
+ //final double ratio = bb.width / (double) bb.height;
+ //return ratio;
+ double perimeter = Imgproc.arcLength(new MatOfPoint2f(inp.toArray()),true);
+ return (Math.PI * perimeter * perimeter) / (4 * Imgproc.contourArea(inp));
+ }
+
+ public void draw(Mat canvas) {
+ Scalar color = new Scalar(00, 255, 00);
+ Scalar black = new Scalar(0, 0, 0);
+
+ //Imgproc.drawContours(canvas, Arrays.asList(shape), 0, new Scalar(0, 0, 255), 4);
+ Imgproc.rectangle(canvas, bounds.tl(), bounds.br(), new Scalar(0, 0, 255), 4);
+ Imgproc.putText(canvas, "STONE", new Point(x, y - 30), 0, 0.6, black, 7);
+ Imgproc.putText(canvas, "STONE", new Point(x, y - 30), 0, 0.6, color, 2);
+ Imgproc.circle(canvas, new Point(x, y), 4, new Scalar(255, 255, 255), -1);
+ }
+
+ public Stone clone () {
+ return new Stone(shape);
+ }
+
+ public String toString(){
+ return x+" "+y;
+ }
+
+}
+
diff --git a/bluejay/src/main/java/detectors/FoundationPipeline/compute.java b/bluejay/src/main/java/detectors/FoundationPipeline/compute.java
new file mode 100644
index 00000000000..7e9f07d78f9
--- /dev/null
+++ b/bluejay/src/main/java/detectors/FoundationPipeline/compute.java
@@ -0,0 +1,338 @@
+package detectors.FoundationPipeline;
+
+import org.opencv.core.Core;
+import org.opencv.core.CvType;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfFloat;
+import org.opencv.core.MatOfInt;
+import org.opencv.core.MatOfPoint;
+import org.opencv.core.MatOfPoint2f;
+import org.opencv.core.Point;
+import org.opencv.core.Rect;
+import org.opencv.core.Scalar;
+import org.opencv.core.Size;
+import org.opencv.imgproc.Imgproc;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class compute {
+
+ static MatOfPoint2f toDouble(MatOfPoint p) {
+ return new MatOfPoint2f(p.toArray());
+ }
+
+ /**
+ * draw rectangle border
+ */
+ static void rectangle(Mat canvas, boolean fill) {
+ Point topleftPoint, bottomrightPoint;
+
+ // new point
+ topleftPoint = new Point(0, 0);
+ bottomrightPoint = new Point(canvas.width(), canvas.height());
+
+ // rectangle
+ Scalar cvRectangleColor = new Scalar(0.0, 0.0, 0.0, 0.0);
+ int cvRectangleThickness;
+ if (fill)
+ cvRectangleThickness = -1;
+ else
+ cvRectangleThickness = 2;
+ int cvRectangleLinetype = Core.BORDER_DEFAULT;
+ int cvRectangleShift = 0;
+ Imgproc.rectangle(canvas, topleftPoint, bottomrightPoint, cvRectangleColor, cvRectangleThickness,
+ cvRectangleLinetype, cvRectangleShift);
+ }
+
+ /**
+ * Takes an RGB image and allplies thresholding based on HSV ranges
+ *
+ * @param input An RGB image
+ * @param colRange Hue range
+ * @param satRange Saturation range
+ * @param valRange Value Range
+ * @return Thresholded image
+ */
+ static Mat threshold(Mat input, double[] colRange, double[] satRange, double[] valRange) {
+ Mat output = new Mat();
+
+ Imgproc.cvtColor(input.clone(), output, Imgproc.COLOR_BGR2HSV);
+ Core.inRange(output, new Scalar(colRange[0], satRange[0], valRange[0]),
+ new Scalar(colRange[1], satRange[1], valRange[1]), output);
+
+ return output;
+ }
+
+ static ArrayList findHulls(Mat inp) {
+ return findHulls(inp, false);
+ }
+
+ /**
+ * Returns a matrix of points representing the convex hulls of the blobs in the
+ * input
+ *
+ * @param inp a binary image
+ */
+ static ArrayList findHulls(Mat inp, boolean external) {
+ // rectangle(inp,false);
+
+ ArrayList contours = new ArrayList();
+ ArrayList hullsOutput = new ArrayList();
+
+ findContours(inp, external, contours);
+
+ convexHulls(contours, hullsOutput);
+
+ return hullsOutput;
+ }
+
+ static void drawHulls(List hulls, Mat drawOn) {
+ Scalar color = new Scalar(0, 255, 0); // Green
+ drawHulls(hulls, drawOn, color, 1);
+ }
+
+ /**
+ * Takes a point matrix and draws the shape it represents on the Mat input
+ *
+ * @param drawOn thing that gets drawn on
+ */
+ static void drawHulls(List hulls, Mat drawOn, Scalar color, int thick) {
+ // draw convex hulls
+ for (int i = 0; i < hulls.size(); i++) {
+ Imgproc.drawContours(drawOn, hulls, i, color, thick);
+ }
+ }
+
+ /**
+ * Finds the shapes of blobs
+ *
+ * @param externalOnly Whether to ignore shapes inside shapes
+ */
+ static void findContours(Mat input, boolean externalOnly, List contours) {
+ Mat hierarchy = new Mat();
+ contours.clear();
+ int mode;
+ if (externalOnly) {
+ mode = Imgproc.RETR_EXTERNAL;
+ } else {
+ mode = Imgproc.RETR_LIST;
+ }
+ int method = Imgproc.CHAIN_APPROX_SIMPLE;
+ Imgproc.findContours(input, contours, hierarchy, mode, method);
+
+
+ }
+
+ static void floodFill(Mat canvas, Point origin) {
+ double[] pixel = canvas.get((int) origin.y, (int) origin.x);
+ if (pixel[0] == 0)
+ return;
+
+ Imgproc.floodFill(canvas, new Mat(canvas.height() + 2, canvas.width() + 2, canvas.type()), origin,
+ new Scalar(0, 0, 0));
+ }
+
+ /**
+ * Filters out contours that do not meet certain criteria. Also removes contours
+ * surrounding everything
+ *
+ * @param inputContours is the input list of contours
+ * @return is the the output list of contours
+ * @param minArea is the minimum area of a contour that will be kept
+ */
+ static List filterContours(List inputContours, double minArea) {
+ List output = new ArrayList();
+ // operation
+ for (int i = 0; i < inputContours.size(); i++) {
+ final MatOfPoint contour = inputContours.get(i);
+ final double area = Imgproc.contourArea(contour);
+ if (area < minArea)
+ continue;
+ Point tl = Imgproc.boundingRect(contour).tl();
+ Rect b = Imgproc.boundingRect(contour);
+ if (tl.x < 5 & tl.y < 5)
+ continue;
+ if (b.width + b.x > 636 || b.height + b.y > 475)
+ continue;
+
+ output.add(contour);
+ }
+
+ return output;
+ }
+
+ /**
+ * Compute the convex hulls of contours.
+ */
+ private static void convexHulls(List inputContours, ArrayList outputContours) {
+ final MatOfInt hull = new MatOfInt();
+ outputContours.clear();
+ for (int i = 0; i < inputContours.size(); i++) {
+ final MatOfPoint contour = inputContours.get(i);
+ final MatOfPoint mopHull = new MatOfPoint();
+ Imgproc.convexHull(contour, hull);
+ mopHull.create((int) hull.size().height, 1, CvType.CV_32SC2);
+ for (int j = 0; j < hull.size().height; j++) {
+ int index = (int) hull.get(j, 0)[0];
+ double[] point = new double[] { contour.get(index, 0)[0], contour.get(index, 0)[1] };
+ mopHull.put(j, 0, point);
+ }
+ outputContours.add(mopHull);
+ }
+ }
+
+ static Mat distanceTransform(Mat inp, int threshold) {
+ Mat proc = new Mat();
+ /*
+ * Imgproc.distanceTransform(inp,proc, Imgproc.DIST_C,5);
+ *
+ * Core.inRange(proc,new Scalar(threshold), new Scalar(255), proc);
+ */
+ Imgproc.erode(inp, proc, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2, 40), new Point(0, 39)));
+ return proc;
+ }
+
+ static Mat fillHoro(Mat inp) {
+ Mat proc = new Mat();
+ /*
+ * Imgproc.distanceTransform(inp,proc, Imgproc.DIST_C,5);
+ *
+ * Core.inRange(proc,new Scalar(threshold), new Scalar(255), proc);
+ */
+ Imgproc.dilate(inp, proc, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(4, 1), new Point(2, 0)));
+ return proc;
+ }
+
+ /**
+ * Runs bitwise and on two binary images
+ */
+ static Mat combine(Mat one, Mat two) {
+ Mat ret = new Mat();
+
+ Core.bitwise_or(one, two, ret);
+
+ return ret;
+ }
+
+ static Mat subtract(Mat one, Mat two) {
+ Mat ret = new Mat();
+
+ Core.subtract(one, two, ret);
+
+ return ret;
+ }
+
+ static Mat add(Mat one, Mat two) {
+ Mat ret = new Mat();
+
+ Core.add(one, two, ret);
+
+ return ret;
+ }
+
+ static Mat flip(Mat one) {
+ Mat ret = new Mat();
+
+ Core.bitwise_not(one, ret);
+
+ return ret;
+ }
+
+
+// static void whiteBalance(Mat canvas, double blueC, double redC) {
+// compute.forEach(canvas, (double[] d) -> {
+// // b,g,r
+// d[0] *= blueC;
+// d[2] *= redC;
+//
+// return d;
+// });
+// }
+
+ static Mat equalize(Mat inp) {
+ Mat out = new Mat();
+
+ List channels = new ArrayList();
+ Core.split(inp, channels);
+ for (Mat mat : channels) {
+ Imgproc.equalizeHist(mat, mat);
+ }
+ Core.merge(channels, out);
+ return out;
+ }
+
+ // ============Histogram================
+ // ============Histogram================
+
+ // no visual debug
+ /**
+ * Creates a histogram from input 3 channel mat. it will ananlyze white sufaces
+ * and decide the image brightness from them Then it returns a value
+ * proportional to the brightness
+ */
+ public static double getHistogramfast(Mat in) {
+ int histSize = 255;// # bins
+ int histogramHeight = 512;// physcical size
+
+ Mat[] histData = new Mat[] { new Mat(), new Mat(), new Mat() };
+
+ Mat output = new Mat(new Size(512, 512), in.type());
+
+ // memory leaks and phased out data add static to the image
+ Imgproc.rectangle(output, new Point(0, 0), new Point(1000, 1000), new Scalar(new double[] { 0, 0, 0 }), -1);
+
+ for (int i = 0; i < 3; i++) {
+ getHistdataf(in, i, histData[i], histSize);
+
+ // stretch vertically
+ Core.normalize(histData[i], histData[i], histogramHeight, 0, Core.NORM_INF);
+
+ }
+ // analysis
+ // sum of all white colors
+ double whiteSum = 0;
+ double whiteTot = 0;
+ for (int j = 0; j < histSize; j++) {
+ // avg
+ double Val = (histData[0].get(j, 0)[0] + histData[1].get(j, 0)[0] + histData[2].get(j, 0)[0]) / 3;
+ // min
+ double minVal = minf(histData[0].get(j, 0)[0], histData[1].get(j, 0)[0], histData[2].get(j, 0)[0]);
+
+ whiteSum += minVal * j;
+ whiteTot += Val * j;
+
+ }
+ double whiteSumAvg = whiteSum / whiteTot * 500;// width of the thing
+ double blackCutOff = whiteSumAvg * 1 / 5;
+
+ histData[0].release();
+ histData[1].release();
+ histData[2].release();
+
+ return blackCutOff;
+
+ }
+
+ static void getHistdataf(Mat in, int channel, Mat out, int histsize) {
+
+ Imgproc.calcHist(Arrays.asList(in), new MatOfInt(channel), // color channel
+ new Mat(), out, new MatOfInt(histsize), // size
+ new MatOfFloat(1, 256));// ranges we do not count zeros because they skew it
+
+ Imgproc.blur(out, out, new Size(90, 90));
+ }
+
+ static double minf(double... vals) {
+ double min = vals[0];
+
+ for (int i = 1; i < vals.length; i++) {
+ if (vals[i] < min)
+ min = vals[i];
+ }
+
+ return min;
+ }
+
+}
diff --git a/bluejay/src/main/java/detectors/FoundationPipeline/gap.java b/bluejay/src/main/java/detectors/FoundationPipeline/gap.java
new file mode 100644
index 00000000000..72333338f50
--- /dev/null
+++ b/bluejay/src/main/java/detectors/FoundationPipeline/gap.java
@@ -0,0 +1,31 @@
+package detectors.FoundationPipeline;
+
+import org.opencv.core.Mat;
+import org.opencv.core.Point;
+import org.opencv.core.Scalar;
+import org.opencv.imgproc.Imgproc;
+
+public class gap {
+ public int y;
+ public int x1;
+ public int x2;
+ public int width;
+ public Point center;
+
+ public void draw (Mat canvas) {
+ Scalar color = new Scalar(100,225,255);
+
+ Imgproc.line(canvas, new Point(x1,y), new Point(x2,y), color, 3);
+ Imgproc.line(canvas, new Point(x1,y+10), new Point(x1,y-10), color, 3);
+ Imgproc.line(canvas, new Point(x2,y+10), new Point(x2,y-10), color, 3);
+ }
+
+ public gap(int y, int x1, int x2) {
+ this.y=y;
+ this.x1=x1;
+ this.x2=x2;
+
+ width = Math.abs(x2-x1);
+ center = new Point((x2+x1)/2,y);
+ }
+}
diff --git a/bluejay/src/main/java/detectors/ImageDetector.java b/bluejay/src/main/java/detectors/ImageDetector.java
new file mode 100644
index 00000000000..da4485618f7
--- /dev/null
+++ b/bluejay/src/main/java/detectors/ImageDetector.java
@@ -0,0 +1,307 @@
+package detectors;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import com.qualcomm.robotcore.eventloop.opmode.OpMode;
+import com.vuforia.Image;
+import com.vuforia.PIXEL_FORMAT;
+import com.vuforia.Vuforia;
+
+import org.firstinspires.ftc.robotcore.external.ClassFactory;
+import org.firstinspires.ftc.robotcore.external.matrices.OpenGLMatrix;
+import org.firstinspires.ftc.robotcore.external.matrices.VectorF;
+import org.firstinspires.ftc.robotcore.external.navigation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import localizers.Localizer;
+import localizers.PoseOrientation;
+
+import static org.firstinspires.ftc.robotcore.external.navigation.AngleUnit.DEGREES;
+import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.XYZ;
+import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.YZX;
+import static org.firstinspires.ftc.robotcore.external.navigation.AxesReference.EXTRINSIC;
+import static org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection.BACK;
+
+public class ImageDetector extends StartStoppable implements Localizer{
+ private static final String VUFORIA_KEY =
+ "ARuvZIj/////AAABmVkUSkLsEkjjhzixTaJVlaFNlxHEjVM47c6y7GtSCjJmsGR3bNdALVunnoGjmIog/AUoVdmCsQmzWc2WS0R1Qh+EVA5/H+39wEZ1sohFZ9UGpyWT/1da4Mm0sUbB4/atlnNbCs9PzFCnd0cFDpbzWRSmQjkaxdBlDY9rFnOGrqdEzdT9hWK2NznebhyCFWITMTu94TYY1vbuiyD+08KBIgsMPypNZ8tVSrB405WNTN3ZEqU1a+tQd7ppLUOIYfcYLKuXHRIsmiybps87PkhD84d+/NiE1pinNwBhtxhMPYgqGf1HrE7H+AzKYJpgla1DyG8AMLL1pwJKsA3penrUGwGENWr6EkVHkMLfsQoe6Jym";
+ //phone attributes
+ private static final boolean PHONE_IS_PORTRAIT = false;
+ // Everything is in mm
+ private static final float mmPerInch = 25.4f;
+ private static final float mmTargetHeight = (6) * mmPerInch; // the height of the center of the target
+ // Constant for Stone Target
+ private static final float stoneZ = 2.00f * mmPerInch;
+ // Constants for the center support targets
+ private static final float bridgeZ = 6.42f * mmPerInch;
+ private static final float bridgeY = 23 * mmPerInch;
+ private static final float bridgeX = 5.18f * mmPerInch;
+ private static final float bridgeRotY = 59; // Units are degrees
+ // image above the floor
+ private static final float bridgeRotZ = 180;
+ // Constants for perimeter targets
+ private static final float halfField = 72 * mmPerInch;
+ private static final float quadField = 36 * mmPerInch;
+ VuforiaTrackables allTrackables;
+ private VuforiaLocalizer vuforia = null;
+
+ public ImageDetector(OpMode opMode) {
+ this(opMode, false);
+ }
+
+ public ImageDetector(OpMode opMode, boolean useDisplay) {
+
+ if (isVuforiaInitialized()) return;
+
+ setupVuforia(useDisplay, opMode.hardwareMap.appContext);
+
+ allTrackables = this.vuforia.loadTrackablesFromAsset("Skystone");
+
+ setupTrackables(allTrackables);
+
+ setupPhone();
+ }
+
+ /**
+ * ensures that the static vuforia is made
+ **/
+ private void setupVuforia(boolean useDisplay, Context appContext) {
+ int cameraMonitorViewId = appContext.getResources().getIdentifier("cameraMonitorViewId", "id",
+ appContext.getPackageName());
+
+ //Configure Vuforia by creating a Parameter object, and passing it to the Vuforia engine.
+ VuforiaLocalizer.Parameters parameters;
+ if (useDisplay) parameters = new VuforiaLocalizer.Parameters(cameraMonitorViewId);
+ else parameters = new VuforiaLocalizer.Parameters();
+
+ parameters.vuforiaLicenseKey = VUFORIA_KEY;
+ parameters.cameraDirection = VuforiaLocalizer.CameraDirection.BACK;
+
+ // Instantiate the Vuforia engine
+ VuforiaLocalizer vuforia = ClassFactory.getInstance().createVuforia(parameters);
+
+ //not necessary, you can ignore it
+ Vuforia.setFrameFormat(PIXEL_FORMAT.RGB565, true);
+
+ this.vuforia = vuforia;
+
+ vuforia.setFrameQueueCapacity(1);
+ }
+
+ private void setupTrackables(VuforiaTrackables targetsSkyStone) {
+ // Load the data sets for the trackable objects. These particular data
+ // sets are stored in the 'assets' part of our application.
+
+ VuforiaTrackable stoneTarget = targetsSkyStone.get(0);
+ stoneTarget.setName("Stone Target");
+ VuforiaTrackable blueRearBridge = targetsSkyStone.get(1);
+ blueRearBridge.setName("Blue Rear Bridge");
+ VuforiaTrackable redRearBridge = targetsSkyStone.get(2);
+ redRearBridge.setName("Red Rear Bridge");
+ VuforiaTrackable redFrontBridge = targetsSkyStone.get(3);
+ redFrontBridge.setName("Red Front Bridge");
+ VuforiaTrackable blueFrontBridge = targetsSkyStone.get(4);
+ blueFrontBridge.setName("Blue Front Bridge");
+ VuforiaTrackable red1 = targetsSkyStone.get(5);
+ red1.setName("Red Perimeter 1");
+ VuforiaTrackable red2 = targetsSkyStone.get(6);
+ red2.setName("Red Perimeter 2");
+ VuforiaTrackable front1 = targetsSkyStone.get(7);
+ front1.setName("Front Perimeter 1");
+ VuforiaTrackable front2 = targetsSkyStone.get(8);
+ front2.setName("Front Perimeter 2");
+ VuforiaTrackable blue1 = targetsSkyStone.get(9);
+ blue1.setName("Blue Perimeter 1");
+ VuforiaTrackable blue2 = targetsSkyStone.get(10);
+ blue2.setName("Blue Perimeter 2");
+ VuforiaTrackable rear1 = targetsSkyStone.get(11);
+ rear1.setName("Rear Perimeter 1");
+ VuforiaTrackable rear2 = targetsSkyStone.get(12);
+ rear2.setName("Rear Perimeter 2");
+
+ stoneTarget.setLocation(OpenGLMatrix
+ .translation(0, 0, stoneZ)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0,
+ -90)));
+
+ //Set the position of the bridge support targets with relation to origin (center of field)
+ blueFrontBridge.setLocation(OpenGLMatrix
+ .translation(-bridgeX, bridgeY, bridgeZ)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 0,
+ bridgeRotY, bridgeRotZ)));
+
+ blueRearBridge.setLocation(OpenGLMatrix
+ .translation(-bridgeX, bridgeY, bridgeZ)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 0,
+ -bridgeRotY, bridgeRotZ)));
+
+ redFrontBridge.setLocation(OpenGLMatrix
+ .translation(-bridgeX, -bridgeY, bridgeZ)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 0,
+ -bridgeRotY, 0)));
+
+ redRearBridge.setLocation(OpenGLMatrix
+ .translation(bridgeX, -bridgeY, bridgeZ)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 0,
+ bridgeRotY, 0)));
+
+ //Set the position of the perimeter targets with relation to origin (center of field)
+ red1.setLocation(OpenGLMatrix
+ .translation(quadField, -halfField, mmTargetHeight)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 180)));
+
+ red2.setLocation(OpenGLMatrix
+ .translation(-quadField, -halfField, mmTargetHeight)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 180)));
+
+ front1.setLocation(OpenGLMatrix
+ .translation(-halfField, -quadField, mmTargetHeight)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 90)));
+
+ front2.setLocation(OpenGLMatrix
+ .translation(-halfField, quadField, mmTargetHeight)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 90)));
+
+ blue1.setLocation(OpenGLMatrix
+ .translation(-quadField, halfField, mmTargetHeight)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 0)));
+
+ blue2.setLocation(OpenGLMatrix
+ .translation(quadField, halfField, mmTargetHeight)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, 0)));
+
+ rear1.setLocation(OpenGLMatrix
+ .translation(halfField, quadField, mmTargetHeight)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, -90)));
+
+ rear2.setLocation(OpenGLMatrix
+ .translation(halfField, -quadField, mmTargetHeight)
+ .multiplied(Orientation.getRotationMatrix(EXTRINSIC, XYZ, DEGREES, 90, 0, -90)));
+ }
+
+ private void setupPhone() {
+ // We need to rotate the camera around its long axis to bring the correct camera forward.
+ //if (CAMERA_CHOICE == BACK) { We always use the back camera
+ float phoneYRotate = -90;
+ float phoneXRotate = 0;
+
+ // Rotate the phone vertical about the X axis if it's in portrait mode
+ if (PHONE_IS_PORTRAIT) {
+ phoneXRotate = 90;
+ }
+
+ // Next, translate the camera lens to where it is on the robot.
+ // In this example, it is centered (left to right), but forward of the middle of the robot, and above ground
+ // level.
+ final float CAMERA_FORWARD_DISPLACEMENT = 4.0f * mmPerInch; // eg: Camera is 4 Inches in front of robot
+ // center
+ final float CAMERA_VERTICAL_DISPLACEMENT = 8.0f * mmPerInch; // eg: Camera is 8 Inches above ground
+ final float CAMERA_LEFT_DISPLACEMENT = 0; // eg: Camera is ON the robot's center line
+
+ float phoneZRotate = 0;
+ OpenGLMatrix robotFromCamera = OpenGLMatrix.translation(
+ CAMERA_FORWARD_DISPLACEMENT, CAMERA_LEFT_DISPLACEMENT, CAMERA_VERTICAL_DISPLACEMENT
+ ).multiplied(Orientation.getRotationMatrix(
+ EXTRINSIC, YZX, DEGREES,
+ phoneYRotate, phoneZRotate, phoneXRotate
+ ));
+
+ for (VuforiaTrackable trackable : allTrackables) {
+ ((VuforiaTrackableDefaultListener) trackable.getListener()).setPhoneInformation(robotFromCamera, BACK);
+ }
+ }
+
+ public boolean isVuforiaInitialized() {
+ return vuforia != null;
+ }
+
+ public VuforiaLocalizer getVuforiaLocalizer() {
+ return vuforia;
+ }
+
+ public void begin() {
+ allTrackables.activate();
+ }
+
+ public void end() {
+ allTrackables.deactivate();
+ //vuforia.close();
+ }
+
+ @Override
+ public void loop() {
+ calculatePosition();
+ }
+
+ /**
+ * Gets the most recent position, if available.
+ */
+ public PoseOrientation getPosition() {
+ if (!activated) throw new IllegalStateException("Not activated");
+ OpenGLMatrix matrix = calculatePosition();
+ if (matrix == null) return null;
+ return toPoseOrientation(matrix);
+ }
+
+ OpenGLMatrix calculatePosition() {
+ List newLocations = new ArrayList<>();
+ for (VuforiaTrackable trackable : allTrackables) {
+ VuforiaTrackableDefaultListener listener = (VuforiaTrackableDefaultListener) trackable.getListener();
+ if (listener.isVisible()) {
+
+ if (trackable.getName().equals("Stone Target")) {
+ //we cannot depend on this for coordinates
+ continue;
+ }
+ OpenGLMatrix robotLocationTransform = listener.getRobotLocation();
+ //get, instead of get updated.
+ //store in list.
+ if (robotLocationTransform != null) {
+ newLocations.add(robotLocationTransform);
+ }
+ }
+ }
+ //take average, or null if none.
+ if (newLocations.isEmpty()) return null;
+ OpenGLMatrix sum = newLocations.get(0);
+ for (int i = 1; i < newLocations.size(); i++) {
+ sum.add(newLocations.get(i));
+ }
+ sum.multiply(1f / newLocations.size());
+ return sum;
+ }
+
+ private PoseOrientation toPoseOrientation(OpenGLMatrix matrix) {
+ VectorF translation = matrix.getTranslation();
+ Orientation rotation = Orientation.getOrientation(matrix, EXTRINSIC, XYZ, DEGREES);
+ return new PoseOrientation(translation.get(0), translation.get(1), rotation.thirdAngle);
+ }
+
+ /**
+ * @return next image if available.
+ */
+ public Bitmap getImage() {
+ try {
+
+ VuforiaLocalizer.CloseableFrame closeableFrame = vuforia.getFrameQueue().take();
+ try {
+ for (int i = 0; i < closeableFrame.getNumImages(); i++) {
+ Image image = closeableFrame.getImage(i);
+
+ if (image.getFormat() == PIXEL_FORMAT.RGB565) {
+ Bitmap bm = Bitmap.createBitmap(image.getWidth(), image.getHeight(), Bitmap.Config.RGB_565);
+ bm.copyPixelsFromBuffer(image.getPixels());
+ return bm;
+ }
+ }
+ } finally {
+ closeableFrame.close();
+ }
+ } catch (InterruptedException ignored) {
+ Thread.currentThread().interrupt();
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/bluejay/src/main/java/detectors/OpenCvDetector.java b/bluejay/src/main/java/detectors/OpenCvDetector.java
new file mode 100644
index 00000000000..7e3dddeac99
--- /dev/null
+++ b/bluejay/src/main/java/detectors/OpenCvDetector.java
@@ -0,0 +1,100 @@
+package detectors;
+
+import android.graphics.Bitmap;
+import android.util.Log;
+
+import com.qualcomm.robotcore.eventloop.opmode.OpMode;
+
+import org.opencv.android.OpenCVLoader;
+import org.opencv.android.Utils;
+import org.opencv.core.CvType;
+import org.opencv.core.Mat;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import detectors.FoundationPipeline.Foundation;
+import detectors.FoundationPipeline.Pipeline;
+import detectors.FoundationPipeline.SkyStone;
+import detectors.FoundationPipeline.Stone;
+
+public class OpenCvDetector extends StartStoppable {
+
+ //Originally in RobotControllerActivity, but caused the camera shutter to make weird noises, so now it lives here
+ static {
+ OpenCVLoader.initDebug();
+ //OR System.LoadLibrary("opencv_java3");
+ }
+
+ private List foundations = new ArrayList<>(); //detected foundations
+ private List stones = new ArrayList<>();
+ private List skyStones = new ArrayList<>();
+ private ImageDetector vuforia;
+
+
+ public OpenCvDetector(OpMode opMode) {
+ this.vuforia = new ImageDetector(opMode, true);
+ }
+
+ @Override
+ public void loop() {
+ //Log.d("GO TO MO","go");
+ updateObjects();
+ }
+
+ @Override
+ public void begin() {
+ vuforia.start();
+ }
+
+ @Override
+ public void end() {
+ vuforia.stop();
+ }
+
+ /**
+ * hold the phone as you would use it to browse reddit
+ * x: 0 at the top, increases as you go down
+ * y: 0 at the right, increases as you go left
+ */
+ private void updateObjects() {
+ //get raw image
+ //raw image for camera
+ start();
+ Bitmap image = vuforia.getImage();
+ end();
+
+ //raw to Mat
+ //image converted to OpenCV Mat
+ Mat matImage = new Mat(image.getWidth(), image.getHeight(), CvType.CV_8UC1);
+ Utils.bitmapToMat(image, matImage);
+
+ //Opencv pipeline
+ Pipeline.process(matImage);
+
+ foundations.clear();
+ foundations.addAll(Pipeline.foundations);
+ stones.clear();
+ stones.addAll(Pipeline.stones);
+ skyStones.clear();
+ skyStones.addAll(Pipeline.skyStones);
+ }
+
+ public Foundation[] getObjectsFoundations() {
+ if (!activated) throw new IllegalStateException("Not activated");
+
+ return foundations.toArray(new Foundation[0]);
+ }
+
+ public Stone[] getObjectsStones() {
+ if (!activated) throw new IllegalStateException("Not activated");
+
+ return stones.toArray(new Stone[0]);
+ }
+
+ public SkyStone[] getObjectsSkyStones() {
+ if (!activated) throw new IllegalStateException("Not activated");
+
+ return skyStones.toArray(new SkyStone[0]);
+ }
+}
diff --git a/bluejay/src/main/java/detectors/StartStoppable.java b/bluejay/src/main/java/detectors/StartStoppable.java
new file mode 100644
index 00000000000..e2f689bb264
--- /dev/null
+++ b/bluejay/src/main/java/detectors/StartStoppable.java
@@ -0,0 +1,28 @@
+package detectors;
+
+public abstract class StartStoppable {
+ volatile boolean activated = false;
+
+ Thread loop = new Thread(()->{
+ while (activated){
+ loop();
+ }
+ });
+
+ public final void start() {
+ activated = true;
+ loop.start();
+ }
+
+ public final void stop() {
+ //yes stop() is deprecated but there is no big penalty for premature death
+ //and suspend is useless as well because each cycle is independent
+ activated = false;
+ loop.stop();
+ }
+
+ public abstract void loop();
+ public abstract void begin();
+ public abstract void end();
+
+}
diff --git a/bluejay/src/main/java/detectors/StoneDetector.java b/bluejay/src/main/java/detectors/StoneDetector.java
new file mode 100644
index 00000000000..19ae5459bc5
--- /dev/null
+++ b/bluejay/src/main/java/detectors/StoneDetector.java
@@ -0,0 +1,81 @@
+package detectors;
+
+import com.qualcomm.robotcore.eventloop.opmode.OpMode;
+import com.qualcomm.robotcore.hardware.HardwareMap;
+import com.qualcomm.robotcore.util.RobotLog;
+import org.firstinspires.ftc.robotcore.external.ClassFactory;
+import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer;
+import org.firstinspires.ftc.robotcore.external.tfod.Recognition;
+import org.firstinspires.ftc.robotcore.external.tfod.TFObjectDetector;
+
+import java.util.List;
+
+public class StoneDetector extends StartStoppable {
+ List objects;
+ private TFObjectDetector tfod;
+
+ private HardwareMap hardwareMap;
+
+ public StoneDetector(OpMode opMode, boolean useDisplay) {
+ this.hardwareMap = opMode.hardwareMap;
+
+ //by creating an image detector, we ensure that the vulocalizer singleton has been created
+ tfod = SetupTensorflow(new ImageDetector(opMode).getVuforiaLocalizer(), useDisplay);
+ }
+
+ private TFObjectDetector SetupTensorflow(VuforiaLocalizer vuforia, boolean useDisplay) {
+ if (!ClassFactory.getInstance().canCreateTFObjectDetector()) {
+ RobotLog.e("Tensorflow bootup failed. Brace for errors");
+ return null;
+ }
+
+ //apply viewID to parameter object
+ int tfodMonitorViewId = hardwareMap.appContext.getResources().getIdentifier(
+ "tfodMonitorViewId", "id", hardwareMap.appContext.getPackageName());
+ TFObjectDetector.Parameters tfodParameters;
+ if (useDisplay) tfodParameters = new TFObjectDetector.Parameters(tfodMonitorViewId);
+ else tfodParameters = new TFObjectDetector.Parameters();
+
+ tfodParameters.minimumConfidence = 0.7;
+
+ //create a detector with the viewID
+ TFObjectDetector tfod = ClassFactory.getInstance().createTFObjectDetector(tfodParameters, vuforia);
+
+ //tell the detector what to detect
+ tfod.loadModelFromAsset("Skystone.tflite", "Stone", "Skystone");
+
+ return tfod;
+ }
+
+ @Override
+ public void loop() {
+ updateObjects();
+ }
+
+ @Override
+ public void begin() {
+ tfod.activate();
+ }
+
+ @Override
+ public void end() {
+ tfod.shutdown();
+ }
+
+ private void updateObjects() {
+ List sto = tfod.getUpdatedRecognitions();
+
+ if (sto == null) return;
+
+ objects = sto;
+ }
+
+ /**
+ * may be null if see nothing
+ */
+ public List getObjects() {
+ if (!activated) return null;
+
+ return objects;
+ }
+}
diff --git a/bluejay/src/main/java/localizers/IMU.java b/bluejay/src/main/java/localizers/IMU.java
new file mode 100644
index 00000000000..3e6a28a1016
--- /dev/null
+++ b/bluejay/src/main/java/localizers/IMU.java
@@ -0,0 +1,122 @@
+//package localizers;
+//
+//import com.qualcomm.robotcore.eventloop.opmode.OpMode;
+//import org.firstinspires.ftc.robotcore.external.navigation.*;
+//
+//public class IMU implements deltaLocalizer {
+// BNO055IMU imu;
+// OpMode opmode;
+//
+// Orientation lastAngle = new Orientation();
+// Position lastPos = new Position();
+//
+// double deltaAngle;
+// Position deltaPos;
+//
+// volatile boolean activated = false;
+//
+// public IMU(OpMode opMode) {
+//
+// this.opmode = opMode;
+//
+// BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();
+//
+// parameters.mode = BNO055IMU.SensorMode.IMU;
+// parameters.angleUnit = BNO055IMU.AngleUnit.DEGREES;
+// parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC;
+// parameters.loggingEnabled = false;
+//
+// //TODO assumption that that thing is named "imu"
+// imu = opmode.hardwareMap.get(BNO055IMU.class, "imu");
+//
+// imu.initialize(parameters);
+//
+// //watchdog
+// long start = System.currentTimeMillis();
+// //make sure the imu gyro is calibrated before continuing.
+// while (!imu.isGyroCalibrated()) {
+// if (System.currentTimeMillis() - start > 500) {
+// opmode.telemetry.addData("IMU", "watchdig quit");
+// opmode.telemetry.update();
+//
+// break;
+// }
+//
+// //wait
+// opmode.telemetry.addData("IMU", ("Loading" + Math.random()));
+// opmode.telemetry.update();
+// }
+//
+// opmode.telemetry.addData("IMU", "startup done");
+// opmode.telemetry.update();
+// }
+//
+// public void start() {
+// resetAngle();
+// }
+//
+// /**
+// * Resets the cumulative angle tracking to zero.
+// */
+// private void resetAngle() {
+// lastAngle = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+// lastPos = imu.getPosition();
+//
+// deltaAngle = 0;
+// deltaPos = new Position();
+// }
+//
+// public void stop() {
+// }
+//
+// /**
+// * call this as fast as you can!
+// * return difference in orientation to when you last called it
+// * (x,y) is currently broken. But it isn't accurate so you should never use it
+// *
+// * @return defaults to mm for position x and y
+// */
+// public PoseOrientation getDeltaPosition() {
+// updatePos();
+// return new PoseOrientation(deltaPos.x, deltaPos.y, deltaAngle);
+// }
+//
+// /**
+// * Based on the last time we called get angle, take the smallest possible rotation difference
+// * trig angles
+// */
+// private void updatePos() {
+// //z axis is the one we want
+//
+// Orientation angle = imu.getAngularOrientation(AxesReference.INTRINSIC, AxesOrder.ZYX, AngleUnit.DEGREES);
+// Position pos = imu.getPosition();
+//
+// //=========ANGLE=============
+// double deltaAngle = angle.firstAngle - lastAngle.firstAngle;
+//
+// if (deltaAngle < -180)
+// deltaAngle += 360;
+//
+// else if (deltaAngle > 180)
+// deltaAngle -= 360;
+//
+// this.deltaAngle = deltaAngle;
+//
+// lastAngle = angle;
+// //========POSITION==========
+// opmode.telemetry.addData("imu raw read", pos.x);
+//
+// deltaPos.x = pos.x - lastPos.x;
+// deltaPos.y = pos.y - lastPos.y;
+//
+// lastPos = pos;
+// }
+//
+// public void printposition(PoseOrientation toprint) {
+// if (toprint != null) {
+// opmode.telemetry.addData("IMU-Position (mm) (rot)", toprint.x + " " + toprint.y + " " + toprint.rot);
+// } else {
+// opmode.telemetry.addData("IMU", "offline");
+// }
+// }
+//}
diff --git a/bluejay/src/main/java/localizers/LocalizationManager.java b/bluejay/src/main/java/localizers/LocalizationManager.java
new file mode 100644
index 00000000000..6beadede951
--- /dev/null
+++ b/bluejay/src/main/java/localizers/LocalizationManager.java
@@ -0,0 +1,68 @@
+package localizers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LocalizationManager {
+ List delta = new ArrayList<>();
+ List absolute = new ArrayList<>();
+
+ PoseOrientation lastknowpos = new PoseOrientation(0, 0, 0);
+
+ volatile boolean activated = false;
+
+ Thread run = new Thread() {
+ @Override
+ public void run() {
+ while (activated) {
+ lastknowpos = getPosition();
+ }
+ }
+ };
+
+ /**
+ * Gives a position based on the best combined guess of all localizers given to this class
+ * Priority is as follows: absolute localizers first, first added to last added
+ * relative localizers next, first added to last added
+ */
+ public PoseOrientation getPosition() {
+
+ for (Localizer loc : absolute) {
+ PoseOrientation o;
+ if ((o = loc.getPosition()) != null) {
+ lastknowpos = o;
+ return o;
+ }
+ }
+
+ for (deltaLocalizer loc : delta) {
+ PoseOrientation o;
+ if ((o = loc.getDeltaPosition()) != null) {
+ lastknowpos.x += o.x;
+ lastknowpos.y += o.y;
+ lastknowpos.rot += o.rot;
+ return o;
+ }
+ }
+
+ return null;
+ }
+
+ public void start() {
+ activated = true;
+ run.start();
+ }
+
+ public void stop() {
+ activated = false;
+ }
+
+ public void addLocalizer(deltaLocalizer l) {
+ delta.add(l);
+ }
+
+ public void addLocalizer(Localizer l) {
+ absolute.add(l);
+ }
+}
+
diff --git a/bluejay/src/main/java/localizers/Localizer.java b/bluejay/src/main/java/localizers/Localizer.java
new file mode 100644
index 00000000000..98afc7776a4
--- /dev/null
+++ b/bluejay/src/main/java/localizers/Localizer.java
@@ -0,0 +1,6 @@
+package localizers;
+
+
+public interface Localizer {
+ PoseOrientation getPosition();
+}
diff --git a/bluejay/src/main/java/localizers/PoseOrientation.java b/bluejay/src/main/java/localizers/PoseOrientation.java
new file mode 100644
index 00000000000..d054274f250
--- /dev/null
+++ b/bluejay/src/main/java/localizers/PoseOrientation.java
@@ -0,0 +1,16 @@
+package localizers;
+
+/**
+ * Units in mm and degrees.
+ */
+public class PoseOrientation {
+ public double x;
+ public double y;
+ public double rot;
+
+ public PoseOrientation(double x, double y, double rot) {
+ this.x = x;
+ this.y = y;
+ this.rot = rot;
+ }
+}
diff --git a/bluejay/src/main/java/localizers/deltaLocalizer.java b/bluejay/src/main/java/localizers/deltaLocalizer.java
new file mode 100644
index 00000000000..cb7fda9c583
--- /dev/null
+++ b/bluejay/src/main/java/localizers/deltaLocalizer.java
@@ -0,0 +1,5 @@
+package localizers;
+
+public interface deltaLocalizer {
+ PoseOrientation getDeltaPosition();
+}
diff --git a/bluejay/src/main/java/util/FileReadUtil.java b/bluejay/src/main/java/util/FileReadUtil.java
new file mode 100644
index 00000000000..4cbbe4aa770
--- /dev/null
+++ b/bluejay/src/main/java/util/FileReadUtil.java
@@ -0,0 +1,36 @@
+package util;
+
+import android.os.Environment;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class FileReadUtil {
+ public static String readFromSD(){
+ File sdcard = Environment.getExternalStorageDirectory();
+
+ //Get the text file
+ File file= new File(sdcard,"Vuforia Key.txt");
+
+ //Read text from file
+ StringBuilder text = new StringBuilder();
+
+ try {
+ BufferedReader br = new BufferedReader(new FileReader(file));
+ String line;
+
+ while ((line = br.readLine()) != null) {
+ text.append(line);
+ text.append('\n');
+ }
+ br.close();
+ }
+ catch (IOException e) {
+ }
+
+ return text.toString();
+ }
+
+}
diff --git a/import-summary.txt b/import-summary.txt
new file mode 100644
index 00000000000..5e4581babcc
--- /dev/null
+++ b/import-summary.txt
@@ -0,0 +1,255 @@
+ECLIPSE ANDROID PROJECT IMPORT SUMMARY
+======================================
+
+Ignored Files:
+--------------
+The following files were *not* copied into the new Gradle project; you
+should evaluate whether these are still needed in your project and if
+so manually move them:
+
+* .DS_Store
+* javadoc/
+* javadoc/allclasses-frame.html
+* javadoc/allclasses-noframe.html
+* javadoc/constant-values.html
+* javadoc/help-doc.html
+* javadoc/index-all.html
+* javadoc/index.html
+* javadoc/mymath.js
+* javadoc/org/
+* javadoc/org/opencv/
+* javadoc/org/opencv/android/
+* javadoc/org/opencv/android/BaseLoaderCallback.html
+* javadoc/org/opencv/android/Camera2Renderer.html
+* javadoc/org/opencv/android/CameraActivity.html
+* javadoc/org/opencv/android/CameraBridgeViewBase.CvCameraViewFrame.html
+* javadoc/org/opencv/android/CameraBridgeViewBase.CvCameraViewListener.html
+* javadoc/org/opencv/android/CameraBridgeViewBase.CvCameraViewListener2.html
+* javadoc/org/opencv/android/CameraBridgeViewBase.ListItemAccessor.html
+* javadoc/org/opencv/android/CameraBridgeViewBase.html
+* javadoc/org/opencv/android/CameraGLRendererBase.html
+* javadoc/org/opencv/android/CameraGLSurfaceView.CameraTextureListener.html
+* javadoc/org/opencv/android/CameraGLSurfaceView.html
+* javadoc/org/opencv/android/CameraRenderer.html
+* javadoc/org/opencv/android/FpsMeter.html
+* javadoc/org/opencv/android/InstallCallbackInterface.html
+* javadoc/org/opencv/android/JavaCamera2View.JavaCameraSizeAccessor.html
+* javadoc/org/opencv/android/JavaCamera2View.html
+* javadoc/org/opencv/android/JavaCameraView.JavaCameraSizeAccessor.html
+* javadoc/org/opencv/android/JavaCameraView.html
+* javadoc/org/opencv/android/LoaderCallbackInterface.html
+* javadoc/org/opencv/android/OpenCVLoader.html
+* javadoc/org/opencv/android/Utils.html
+* javadoc/org/opencv/android/package-frame.html
+* javadoc/org/opencv/android/package-summary.html
+* javadoc/org/opencv/android/package-tree.html
+* javadoc/org/opencv/calib3d/
+* javadoc/org/opencv/calib3d/Calib3d.html
+* javadoc/org/opencv/calib3d/StereoBM.html
+* javadoc/org/opencv/calib3d/StereoMatcher.html
+* javadoc/org/opencv/calib3d/StereoSGBM.html
+* javadoc/org/opencv/calib3d/package-frame.html
+* javadoc/org/opencv/calib3d/package-summary.html
+* javadoc/org/opencv/calib3d/package-tree.html
+* javadoc/org/opencv/core/
+* javadoc/org/opencv/core/Algorithm.html
+* javadoc/org/opencv/core/Core.MinMaxLocResult.html
+* javadoc/org/opencv/core/Core.html
+* javadoc/org/opencv/core/CvException.html
+* javadoc/org/opencv/core/CvType.html
+* javadoc/org/opencv/core/DMatch.html
+* javadoc/org/opencv/core/KeyPoint.html
+* javadoc/org/opencv/core/Mat.html
+* javadoc/org/opencv/core/MatOfByte.html
+* javadoc/org/opencv/core/MatOfDMatch.html
+* javadoc/org/opencv/core/MatOfDouble.html
+* javadoc/org/opencv/core/MatOfFloat.html
+* javadoc/org/opencv/core/MatOfFloat4.html
+* javadoc/org/opencv/core/MatOfFloat6.html
+* javadoc/org/opencv/core/MatOfInt.html
+* javadoc/org/opencv/core/MatOfInt4.html
+* javadoc/org/opencv/core/MatOfKeyPoint.html
+* javadoc/org/opencv/core/MatOfPoint.html
+* javadoc/org/opencv/core/MatOfPoint2f.html
+* javadoc/org/opencv/core/MatOfPoint3.html
+* javadoc/org/opencv/core/MatOfPoint3f.html
+* javadoc/org/opencv/core/MatOfRect.html
+* javadoc/org/opencv/core/MatOfRect2d.html
+* javadoc/org/opencv/core/MatOfRotatedRect.html
+* javadoc/org/opencv/core/Point.html
+* javadoc/org/opencv/core/Point3.html
+* javadoc/org/opencv/core/Range.html
+* javadoc/org/opencv/core/Rect.html
+* javadoc/org/opencv/core/Rect2d.html
+* javadoc/org/opencv/core/RotatedRect.html
+* javadoc/org/opencv/core/Scalar.html
+* javadoc/org/opencv/core/Size.html
+* javadoc/org/opencv/core/TermCriteria.html
+* javadoc/org/opencv/core/TickMeter.html
+* javadoc/org/opencv/core/package-frame.html
+* javadoc/org/opencv/core/package-summary.html
+* javadoc/org/opencv/core/package-tree.html
+* javadoc/org/opencv/dnn/
+* javadoc/org/opencv/dnn/ClassificationModel.html
+* javadoc/org/opencv/dnn/DetectionModel.html
+* javadoc/org/opencv/dnn/DictValue.html
+* javadoc/org/opencv/dnn/Dnn.html
+* javadoc/org/opencv/dnn/KeypointsModel.html
+* javadoc/org/opencv/dnn/Layer.html
+* javadoc/org/opencv/dnn/Model.html
+* javadoc/org/opencv/dnn/Net.html
+* javadoc/org/opencv/dnn/SegmentationModel.html
+* javadoc/org/opencv/dnn/package-frame.html
+* javadoc/org/opencv/dnn/package-summary.html
+* javadoc/org/opencv/dnn/package-tree.html
+* javadoc/org/opencv/features2d/
+* javadoc/org/opencv/features2d/AKAZE.html
+* javadoc/org/opencv/features2d/AgastFeatureDetector.html
+* javadoc/org/opencv/features2d/BFMatcher.html
+* javadoc/org/opencv/features2d/BOWImgDescriptorExtractor.html
+* javadoc/org/opencv/features2d/BOWKMeansTrainer.html
+* javadoc/org/opencv/features2d/BOWTrainer.html
+* javadoc/org/opencv/features2d/BRISK.html
+* javadoc/org/opencv/features2d/DescriptorMatcher.html
+* javadoc/org/opencv/features2d/FastFeatureDetector.html
+* javadoc/org/opencv/features2d/Feature2D.html
+* javadoc/org/opencv/features2d/Features2d.html
+* javadoc/org/opencv/features2d/FlannBasedMatcher.html
+* javadoc/org/opencv/features2d/GFTTDetector.html
+* javadoc/org/opencv/features2d/KAZE.html
+* javadoc/org/opencv/features2d/MSER.html
+* javadoc/org/opencv/features2d/ORB.html
+* javadoc/org/opencv/features2d/Params.html
+* javadoc/org/opencv/features2d/SimpleBlobDetector.html
+* javadoc/org/opencv/features2d/package-frame.html
+* javadoc/org/opencv/features2d/package-summary.html
+* javadoc/org/opencv/features2d/package-tree.html
+* javadoc/org/opencv/imgcodecs/
+* javadoc/org/opencv/imgcodecs/Imgcodecs.html
+* javadoc/org/opencv/imgcodecs/package-frame.html
+* javadoc/org/opencv/imgcodecs/package-summary.html
+* javadoc/org/opencv/imgcodecs/package-tree.html
+* javadoc/org/opencv/imgproc/
+* javadoc/org/opencv/imgproc/CLAHE.html
+* javadoc/org/opencv/imgproc/GeneralizedHough.html
+* javadoc/org/opencv/imgproc/GeneralizedHoughBallard.html
+* javadoc/org/opencv/imgproc/GeneralizedHoughGuil.html
+* javadoc/org/opencv/imgproc/Imgproc.html
+* javadoc/org/opencv/imgproc/LineSegmentDetector.html
+* javadoc/org/opencv/imgproc/Moments.html
+* javadoc/org/opencv/imgproc/Subdiv2D.html
+* javadoc/org/opencv/imgproc/package-frame.html
+* javadoc/org/opencv/imgproc/package-summary.html
+* javadoc/org/opencv/imgproc/package-tree.html
+* javadoc/org/opencv/ml/
+* javadoc/org/opencv/ml/ANN_MLP.html
+* javadoc/org/opencv/ml/Boost.html
+* javadoc/org/opencv/ml/DTrees.html
+* javadoc/org/opencv/ml/EM.html
+* javadoc/org/opencv/ml/KNearest.html
+* javadoc/org/opencv/ml/LogisticRegression.html
+* javadoc/org/opencv/ml/Ml.html
+* javadoc/org/opencv/ml/NormalBayesClassifier.html
+* javadoc/org/opencv/ml/ParamGrid.html
+* javadoc/org/opencv/ml/RTrees.html
+* javadoc/org/opencv/ml/SVM.html
+* javadoc/org/opencv/ml/SVMSGD.html
+* javadoc/org/opencv/ml/StatModel.html
+* javadoc/org/opencv/ml/TrainData.html
+* javadoc/org/opencv/ml/package-frame.html
+* javadoc/org/opencv/ml/package-summary.html
+* javadoc/org/opencv/ml/package-tree.html
+* javadoc/org/opencv/objdetect/
+* javadoc/org/opencv/objdetect/BaseCascadeClassifier.html
+* javadoc/org/opencv/objdetect/CascadeClassifier.html
+* javadoc/org/opencv/objdetect/HOGDescriptor.html
+* javadoc/org/opencv/objdetect/Objdetect.html
+* javadoc/org/opencv/objdetect/QRCodeDetector.html
+* javadoc/org/opencv/objdetect/package-frame.html
+* javadoc/org/opencv/objdetect/package-summary.html
+* javadoc/org/opencv/objdetect/package-tree.html
+* javadoc/org/opencv/osgi/
+* javadoc/org/opencv/osgi/OpenCVInterface.html
+* javadoc/org/opencv/osgi/OpenCVNativeLoader.html
+* javadoc/org/opencv/osgi/package-frame.html
+* javadoc/org/opencv/osgi/package-summary.html
+* javadoc/org/opencv/osgi/package-tree.html
+* javadoc/org/opencv/photo/
+* javadoc/org/opencv/photo/AlignExposures.html
+* javadoc/org/opencv/photo/AlignMTB.html
+* javadoc/org/opencv/photo/CalibrateCRF.html
+* javadoc/org/opencv/photo/CalibrateDebevec.html
+* javadoc/org/opencv/photo/CalibrateRobertson.html
+* javadoc/org/opencv/photo/MergeDebevec.html
+* javadoc/org/opencv/photo/MergeExposures.html
+* javadoc/org/opencv/photo/MergeMertens.html
+* javadoc/org/opencv/photo/MergeRobertson.html
+* javadoc/org/opencv/photo/Photo.html
+* javadoc/org/opencv/photo/Tonemap.html
+* javadoc/org/opencv/photo/TonemapDrago.html
+* javadoc/org/opencv/photo/TonemapMantiuk.html
+* javadoc/org/opencv/photo/TonemapReinhard.html
+* javadoc/org/opencv/photo/package-frame.html
+* javadoc/org/opencv/photo/package-summary.html
+* javadoc/org/opencv/photo/package-tree.html
+* javadoc/org/opencv/utils/
+* javadoc/org/opencv/utils/Converters.html
+* javadoc/org/opencv/utils/package-frame.html
+* javadoc/org/opencv/utils/package-summary.html
+* javadoc/org/opencv/utils/package-tree.html
+* javadoc/org/opencv/video/
+* javadoc/org/opencv/video/BackgroundSubtractor.html
+* javadoc/org/opencv/video/BackgroundSubtractorKNN.html
+* javadoc/org/opencv/video/BackgroundSubtractorMOG2.html
+* javadoc/org/opencv/video/DISOpticalFlow.html
+* javadoc/org/opencv/video/DenseOpticalFlow.html
+* javadoc/org/opencv/video/FarnebackOpticalFlow.html
+* javadoc/org/opencv/video/KalmanFilter.html
+* javadoc/org/opencv/video/SparseOpticalFlow.html
+* javadoc/org/opencv/video/SparsePyrLKOpticalFlow.html
+* javadoc/org/opencv/video/VariationalRefinement.html
+* javadoc/org/opencv/video/Video.html
+* javadoc/org/opencv/video/package-frame.html
+* javadoc/org/opencv/video/package-summary.html
+* javadoc/org/opencv/video/package-tree.html
+* javadoc/org/opencv/videoio/
+* javadoc/org/opencv/videoio/VideoCapture.html
+* javadoc/org/opencv/videoio/VideoWriter.html
+* javadoc/org/opencv/videoio/Videoio.html
+* javadoc/org/opencv/videoio/package-frame.html
+* javadoc/org/opencv/videoio/package-summary.html
+* javadoc/org/opencv/videoio/package-tree.html
+* javadoc/overview-frame.html
+* javadoc/overview-summary.html
+* javadoc/overview-tree.html
+* javadoc/package-list
+* javadoc/script.js
+* javadoc/serialized-form.html
+* javadoc/stylesheet.css
+
+Moved Files:
+------------
+Android Gradle projects use a different directory structure than ADT
+Eclipse projects. Here's how the projects were restructured:
+
+* AndroidManifest.xml => opencv/src/main/AndroidManifest.xml
+* res/ => opencv/src/main/res/
+* src/ => opencv/src/main/java/
+* src/.DS_Store => opencv/src/main/resources/.DS_Store
+* src/org/.DS_Store => opencv/src/main/resources/org/.DS_Store
+* src/org/opencv/engine/OpenCVEngineInterface.aidl => opencv/src/main/aidl/org/opencv/engine/OpenCVEngineInterface.aidl
+
+Next Steps:
+-----------
+You can now build the project. The Gradle project needs network
+connectivity to download dependencies.
+
+Bugs:
+-----
+If for some reason your project does not build, and you determine that
+it is due to a bug or limitation of the Eclipse to Gradle importer,
+please file a bug at http://b.android.com with category
+Component-Tools.
+
+(This import summary is for your information only, and can be deleted
+after import once you are satisfied with the results.)
diff --git a/openCVLibrary3/build.gradle b/openCVLibrary3/build.gradle
new file mode 100644
index 00000000000..8a35485c55d
--- /dev/null
+++ b/openCVLibrary3/build.gradle
@@ -0,0 +1,20 @@
+apply plugin: 'com.android.library'
+android {
+ compileSdkVersion 23
+ buildToolsVersion "28.0.3"
+
+ defaultConfig {
+ minSdkVersion 8
+ targetSdkVersion 21
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+ }
+ }
+}
+
+dependencies {
+}
diff --git a/openCVLibrary3/lint.xml b/openCVLibrary3/lint.xml
new file mode 100644
index 00000000000..6a5c9c61900
--- /dev/null
+++ b/openCVLibrary3/lint.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/openCVLibrary3/src/main/AndroidManifest.xml b/openCVLibrary3/src/main/AndroidManifest.xml
new file mode 100644
index 00000000000..ce73c5ddc72
--- /dev/null
+++ b/openCVLibrary3/src/main/AndroidManifest.xml
@@ -0,0 +1,6 @@
+
+
+
diff --git a/openCVLibrary3/src/main/aidl/org/opencv/engine/OpenCVEngineInterface.aidl b/openCVLibrary3/src/main/aidl/org/opencv/engine/OpenCVEngineInterface.aidl
new file mode 100644
index 00000000000..21fe5f716ba
--- /dev/null
+++ b/openCVLibrary3/src/main/aidl/org/opencv/engine/OpenCVEngineInterface.aidl
@@ -0,0 +1,33 @@
+package org.opencv.engine;
+
+/**
+* Class provides a Java interface for OpenCV Engine Service. It's synchronous with native OpenCVEngine class.
+*/
+interface OpenCVEngineInterface
+{
+ /**
+ * @return Returns service version.
+ */
+ int getEngineVersion();
+
+ /**
+ * Finds an installed OpenCV library.
+ * @param OpenCV version.
+ * @return Returns path to OpenCV native libs or an empty string if OpenCV can not be found.
+ */
+ String getLibPathByVersion(String version);
+
+ /**
+ * Tries to install defined version of OpenCV from Google Play Market.
+ * @param OpenCV version.
+ * @return Returns true if installation was successful or OpenCV package has been already installed.
+ */
+ boolean installVersion(String version);
+
+ /**
+ * Returns list of libraries in loading order, separated by semicolon.
+ * @param OpenCV version.
+ * @return Returns names of OpenCV libraries, separated by semicolon.
+ */
+ String getLibraryList(String version);
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/AsyncServiceHelper.java b/openCVLibrary3/src/main/java/org/opencv/android/AsyncServiceHelper.java
new file mode 100644
index 00000000000..04a4ac62579
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/AsyncServiceHelper.java
@@ -0,0 +1,391 @@
+package org.opencv.android;
+
+import java.io.File;
+import java.util.StringTokenizer;
+
+import org.opencv.core.Core;
+import org.opencv.engine.OpenCVEngineInterface;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.net.Uri;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.util.Log;
+
+class AsyncServiceHelper
+{
+ public static boolean initOpenCV(String Version, final Context AppContext,
+ final LoaderCallbackInterface Callback)
+ {
+ AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext, Callback);
+ Intent intent = new Intent("org.opencv.engine.BIND");
+ intent.setPackage("org.opencv.engine");
+ if (AppContext.bindService(intent, helper.mServiceConnection, Context.BIND_AUTO_CREATE))
+ {
+ return true;
+ }
+ else
+ {
+ AppContext.unbindService(helper.mServiceConnection);
+ InstallService(AppContext, Callback);
+ return false;
+ }
+ }
+
+ protected AsyncServiceHelper(String Version, Context AppContext, LoaderCallbackInterface Callback)
+ {
+ mOpenCVersion = Version;
+ mUserAppCallback = Callback;
+ mAppContext = AppContext;
+ }
+
+ protected static final String TAG = "OpenCVManager/Helper";
+ protected static final int MINIMUM_ENGINE_VERSION = 2;
+ protected OpenCVEngineInterface mEngineService;
+ protected LoaderCallbackInterface mUserAppCallback;
+ protected String mOpenCVersion;
+ protected Context mAppContext;
+ protected static boolean mServiceInstallationProgress = false;
+ protected static boolean mLibraryInstallationProgress = false;
+
+ protected static boolean InstallServiceQuiet(Context context)
+ {
+ boolean result = true;
+ try
+ {
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(OPEN_CV_SERVICE_URL));
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(intent);
+ }
+ catch(Exception e)
+ {
+ result = false;
+ }
+
+ return result;
+ }
+
+ protected static void InstallService(final Context AppContext, final LoaderCallbackInterface Callback)
+ {
+ if (!mServiceInstallationProgress)
+ {
+ Log.d(TAG, "Request new service installation");
+ InstallCallbackInterface InstallQuery = new InstallCallbackInterface() {
+ private LoaderCallbackInterface mUserAppCallback = Callback;
+ public String getPackageName()
+ {
+ return "OpenCV Manager";
+ }
+ public void install() {
+ Log.d(TAG, "Trying to install OpenCV Manager via Google Play");
+
+ boolean result = InstallServiceQuiet(AppContext);
+ if (result)
+ {
+ mServiceInstallationProgress = true;
+ Log.d(TAG, "Package installation started");
+ }
+ else
+ {
+ Log.d(TAG, "OpenCV package was not installed!");
+ int Status = LoaderCallbackInterface.MARKET_ERROR;
+ Log.d(TAG, "Init finished with status " + Status);
+ Log.d(TAG, "Unbind from service");
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(Status);
+ }
+ }
+
+ public void cancel()
+ {
+ Log.d(TAG, "OpenCV library installation was canceled");
+ int Status = LoaderCallbackInterface.INSTALL_CANCELED;
+ Log.d(TAG, "Init finished with status " + Status);
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(Status);
+ }
+
+ public void wait_install()
+ {
+ Log.e(TAG, "Installation was not started! Nothing to wait!");
+ }
+ };
+
+ Callback.onPackageInstall(InstallCallbackInterface.NEW_INSTALLATION, InstallQuery);
+ }
+ else
+ {
+ Log.d(TAG, "Waiting current installation process");
+ InstallCallbackInterface WaitQuery = new InstallCallbackInterface() {
+ private LoaderCallbackInterface mUserAppCallback = Callback;
+ public String getPackageName()
+ {
+ return "OpenCV Manager";
+ }
+ public void install()
+ {
+ Log.e(TAG, "Nothing to install we just wait current installation");
+ }
+ public void cancel()
+ {
+ Log.d(TAG, "Waiting for OpenCV canceled by user");
+ mServiceInstallationProgress = false;
+ int Status = LoaderCallbackInterface.INSTALL_CANCELED;
+ Log.d(TAG, "Init finished with status " + Status);
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(Status);
+ }
+ public void wait_install()
+ {
+ InstallServiceQuiet(AppContext);
+ }
+ };
+
+ Callback.onPackageInstall(InstallCallbackInterface.INSTALLATION_PROGRESS, WaitQuery);
+ }
+ }
+
+ /**
+ * URL of OpenCV Manager page on Google Play Market.
+ */
+ protected static final String OPEN_CV_SERVICE_URL = "market://details?id=org.opencv.engine";
+
+ protected ServiceConnection mServiceConnection = new ServiceConnection()
+ {
+ public void onServiceConnected(ComponentName className, IBinder service)
+ {
+ Log.d(TAG, "Service connection created");
+ mEngineService = OpenCVEngineInterface.Stub.asInterface(service);
+ if (null == mEngineService)
+ {
+ Log.d(TAG, "OpenCV Manager Service connection fails. May be service was not installed?");
+ InstallService(mAppContext, mUserAppCallback);
+ }
+ else
+ {
+ mServiceInstallationProgress = false;
+ try
+ {
+ if (mEngineService.getEngineVersion() < MINIMUM_ENGINE_VERSION)
+ {
+ Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INCOMPATIBLE_MANAGER_VERSION);
+ Log.d(TAG, "Unbind from service");
+ mAppContext.unbindService(mServiceConnection);
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INCOMPATIBLE_MANAGER_VERSION);
+ return;
+ }
+
+ Log.d(TAG, "Trying to get library path");
+ String path = mEngineService.getLibPathByVersion(mOpenCVersion);
+ if ((null == path) || (path.length() == 0))
+ {
+ if (!mLibraryInstallationProgress)
+ {
+ InstallCallbackInterface InstallQuery = new InstallCallbackInterface() {
+ public String getPackageName()
+ {
+ return "OpenCV library";
+ }
+ public void install() {
+ Log.d(TAG, "Trying to install OpenCV lib via Google Play");
+ try
+ {
+ if (mEngineService.installVersion(mOpenCVersion))
+ {
+ mLibraryInstallationProgress = true;
+ Log.d(TAG, "Package installation started");
+ Log.d(TAG, "Unbind from service");
+ mAppContext.unbindService(mServiceConnection);
+ }
+ else
+ {
+ Log.d(TAG, "OpenCV package was not installed!");
+ Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.MARKET_ERROR);
+ Log.d(TAG, "Unbind from service");
+ mAppContext.unbindService(mServiceConnection);
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(LoaderCallbackInterface.MARKET_ERROR);
+ }
+ } catch (RemoteException e) {
+ e.printStackTrace();;
+ Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INIT_FAILED);
+ Log.d(TAG, "Unbind from service");
+ mAppContext.unbindService(mServiceConnection);
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INIT_FAILED);
+ }
+ }
+ public void cancel() {
+ Log.d(TAG, "OpenCV library installation was canceled");
+ Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INSTALL_CANCELED);
+ Log.d(TAG, "Unbind from service");
+ mAppContext.unbindService(mServiceConnection);
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INSTALL_CANCELED);
+ }
+ public void wait_install() {
+ Log.e(TAG, "Installation was not started! Nothing to wait!");
+ }
+ };
+
+ mUserAppCallback.onPackageInstall(InstallCallbackInterface.NEW_INSTALLATION, InstallQuery);
+ }
+ else
+ {
+ InstallCallbackInterface WaitQuery = new InstallCallbackInterface() {
+ public String getPackageName()
+ {
+ return "OpenCV library";
+ }
+
+ public void install() {
+ Log.e(TAG, "Nothing to install we just wait current installation");
+ }
+ public void cancel()
+ {
+ Log.d(TAG, "OpenCV library installation was canceled");
+ mLibraryInstallationProgress = false;
+ Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INSTALL_CANCELED);
+ Log.d(TAG, "Unbind from service");
+ mAppContext.unbindService(mServiceConnection);
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INSTALL_CANCELED);
+ }
+ public void wait_install() {
+ Log.d(TAG, "Waiting for current installation");
+ try
+ {
+ if (!mEngineService.installVersion(mOpenCVersion))
+ {
+ Log.d(TAG, "OpenCV package was not installed!");
+ Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.MARKET_ERROR);
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(LoaderCallbackInterface.MARKET_ERROR);
+ }
+ else
+ {
+ Log.d(TAG, "Wating for package installation");
+ }
+
+ Log.d(TAG, "Unbind from service");
+ mAppContext.unbindService(mServiceConnection);
+
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INIT_FAILED);
+ Log.d(TAG, "Unbind from service");
+ mAppContext.unbindService(mServiceConnection);
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INIT_FAILED);
+ }
+ }
+ };
+
+ mUserAppCallback.onPackageInstall(InstallCallbackInterface.INSTALLATION_PROGRESS, WaitQuery);
+ }
+ return;
+ }
+ else
+ {
+ Log.d(TAG, "Trying to get library list");
+ mLibraryInstallationProgress = false;
+ String libs = mEngineService.getLibraryList(mOpenCVersion);
+ Log.d(TAG, "Library list: \"" + libs + "\"");
+ Log.d(TAG, "First attempt to load libs");
+ int status;
+ if (initOpenCVLibs(path, libs))
+ {
+ Log.d(TAG, "First attempt to load libs is OK");
+ String eol = System.getProperty("line.separator");
+ for (String str : Core.getBuildInformation().split(eol))
+ Log.i(TAG, str);
+
+ status = LoaderCallbackInterface.SUCCESS;
+ }
+ else
+ {
+ Log.d(TAG, "First attempt to load libs fails");
+ status = LoaderCallbackInterface.INIT_FAILED;
+ }
+
+ Log.d(TAG, "Init finished with status " + status);
+ Log.d(TAG, "Unbind from service");
+ mAppContext.unbindService(mServiceConnection);
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(status);
+ }
+ }
+ catch (RemoteException e)
+ {
+ e.printStackTrace();
+ Log.d(TAG, "Init finished with status " + LoaderCallbackInterface.INIT_FAILED);
+ Log.d(TAG, "Unbind from service");
+ mAppContext.unbindService(mServiceConnection);
+ Log.d(TAG, "Calling using callback");
+ mUserAppCallback.onManagerConnected(LoaderCallbackInterface.INIT_FAILED);
+ }
+ }
+ }
+
+ public void onServiceDisconnected(ComponentName className)
+ {
+ mEngineService = null;
+ }
+ };
+
+ private boolean loadLibrary(String AbsPath)
+ {
+ boolean result = true;
+
+ Log.d(TAG, "Trying to load library " + AbsPath);
+ try
+ {
+ System.load(AbsPath);
+ Log.d(TAG, "OpenCV libs init was ok!");
+ }
+ catch(UnsatisfiedLinkError e)
+ {
+ Log.d(TAG, "Cannot load library \"" + AbsPath + "\"");
+ e.printStackTrace();
+ result = false;
+ }
+
+ return result;
+ }
+
+ private boolean initOpenCVLibs(String Path, String Libs)
+ {
+ Log.d(TAG, "Trying to init OpenCV libs");
+ if ((null != Path) && (Path.length() != 0))
+ {
+ boolean result = true;
+ if ((null != Libs) && (Libs.length() != 0))
+ {
+ Log.d(TAG, "Trying to load libs by dependency list");
+ StringTokenizer splitter = new StringTokenizer(Libs, ";");
+ while(splitter.hasMoreTokens())
+ {
+ String AbsLibraryPath = Path + File.separator + splitter.nextToken();
+ result &= loadLibrary(AbsLibraryPath);
+ }
+ }
+ else
+ {
+ // If the dependencies list is not defined or empty.
+ String AbsLibraryPath = Path + File.separator + "libopencv_java3.so";
+ result = loadLibrary(AbsLibraryPath);
+ }
+
+ return result;
+ }
+ else
+ {
+ Log.d(TAG, "Library path \"" + Path + "\" is empty");
+ return false;
+ }
+ }
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/BaseLoaderCallback.java b/openCVLibrary3/src/main/java/org/opencv/android/BaseLoaderCallback.java
new file mode 100644
index 00000000000..0b8aeedc6a2
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/BaseLoaderCallback.java
@@ -0,0 +1,141 @@
+package org.opencv.android;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
+import android.util.Log;
+
+/**
+ * Basic implementation of LoaderCallbackInterface.
+ */
+public abstract class BaseLoaderCallback implements LoaderCallbackInterface {
+
+ public BaseLoaderCallback(Context AppContext) {
+ mAppContext = AppContext;
+ }
+
+ public void onManagerConnected(int status)
+ {
+ switch (status)
+ {
+ /** OpenCV initialization was successful. **/
+ case LoaderCallbackInterface.SUCCESS:
+ {
+ /** Application must override this method to handle successful library initialization. **/
+ } break;
+ /** OpenCV loader can not start Google Play Market. **/
+ case LoaderCallbackInterface.MARKET_ERROR:
+ {
+ Log.e(TAG, "Package installation failed!");
+ AlertDialog MarketErrorMessage = new AlertDialog.Builder(mAppContext).create();
+ MarketErrorMessage.setTitle("OpenCV Manager");
+ MarketErrorMessage.setMessage("Package installation failed!");
+ MarketErrorMessage.setCancelable(false); // This blocks the 'BACK' button
+ MarketErrorMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ finish();
+ }
+ });
+ MarketErrorMessage.show();
+ } break;
+ /** Package installation has been canceled. **/
+ case LoaderCallbackInterface.INSTALL_CANCELED:
+ {
+ Log.d(TAG, "OpenCV library installation was canceled by user");
+ finish();
+ } break;
+ /** Application is incompatible with this version of OpenCV Manager. Possibly, a service update is required. **/
+ case LoaderCallbackInterface.INCOMPATIBLE_MANAGER_VERSION:
+ {
+ Log.d(TAG, "OpenCV Manager Service is uncompatible with this app!");
+ AlertDialog IncomatibilityMessage = new AlertDialog.Builder(mAppContext).create();
+ IncomatibilityMessage.setTitle("OpenCV Manager");
+ IncomatibilityMessage.setMessage("OpenCV Manager service is incompatible with this app. Try to update it via Google Play.");
+ IncomatibilityMessage.setCancelable(false); // This blocks the 'BACK' button
+ IncomatibilityMessage.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ finish();
+ }
+ });
+ IncomatibilityMessage.show();
+ } break;
+ /** Other status, i.e. INIT_FAILED. **/
+ default:
+ {
+ Log.e(TAG, "OpenCV loading failed!");
+ AlertDialog InitFailedDialog = new AlertDialog.Builder(mAppContext).create();
+ InitFailedDialog.setTitle("OpenCV error");
+ InitFailedDialog.setMessage("OpenCV was not initialised correctly. Application will be shut down");
+ InitFailedDialog.setCancelable(false); // This blocks the 'BACK' button
+ InitFailedDialog.setButton(AlertDialog.BUTTON_POSITIVE, "OK", new OnClickListener() {
+
+ public void onClick(DialogInterface dialog, int which) {
+ finish();
+ }
+ });
+
+ InitFailedDialog.show();
+ } break;
+ }
+ }
+
+ public void onPackageInstall(final int operation, final InstallCallbackInterface callback)
+ {
+ switch (operation)
+ {
+ case InstallCallbackInterface.NEW_INSTALLATION:
+ {
+ AlertDialog InstallMessage = new AlertDialog.Builder(mAppContext).create();
+ InstallMessage.setTitle("Package not found");
+ InstallMessage.setMessage(callback.getPackageName() + " package was not found! Try to install it?");
+ InstallMessage.setCancelable(false); // This blocks the 'BACK' button
+ InstallMessage.setButton(AlertDialog.BUTTON_POSITIVE, "Yes", new OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int which)
+ {
+ callback.install();
+ }
+ });
+
+ InstallMessage.setButton(AlertDialog.BUTTON_NEGATIVE, "No", new OnClickListener() {
+
+ public void onClick(DialogInterface dialog, int which)
+ {
+ callback.cancel();
+ }
+ });
+
+ InstallMessage.show();
+ } break;
+ case InstallCallbackInterface.INSTALLATION_PROGRESS:
+ {
+ AlertDialog WaitMessage = new AlertDialog.Builder(mAppContext).create();
+ WaitMessage.setTitle("OpenCV is not ready");
+ WaitMessage.setMessage("Installation is in progress. Wait or exit?");
+ WaitMessage.setCancelable(false); // This blocks the 'BACK' button
+ WaitMessage.setButton(AlertDialog.BUTTON_POSITIVE, "Wait", new OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ callback.wait_install();
+ }
+ });
+ WaitMessage.setButton(AlertDialog.BUTTON_NEGATIVE, "Exit", new OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ callback.cancel();
+ }
+ });
+
+ WaitMessage.show();
+ } break;
+ }
+ }
+
+ void finish()
+ {
+ ((Activity) mAppContext).finish();
+ }
+
+ protected Context mAppContext;
+ private final static String TAG = "OpenCVLoader/BaseLoaderCallback";
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/Camera2Renderer.java b/openCVLibrary3/src/main/java/org/opencv/android/Camera2Renderer.java
new file mode 100644
index 00000000000..408214057a9
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/Camera2Renderer.java
@@ -0,0 +1,302 @@
+package org.opencv.android;
+
+import java.util.Arrays;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.graphics.SurfaceTexture;
+import android.hardware.camera2.CameraAccessException;
+import android.hardware.camera2.CameraCaptureSession;
+import android.hardware.camera2.CameraCharacteristics;
+import android.hardware.camera2.CameraDevice;
+import android.hardware.camera2.CameraManager;
+import android.hardware.camera2.CaptureRequest;
+import android.hardware.camera2.params.StreamConfigurationMap;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.util.Log;
+import android.util.Size;
+import android.view.Surface;
+
+@TargetApi(21)
+public class Camera2Renderer extends CameraGLRendererBase {
+
+ protected final String LOGTAG = "Camera2Renderer";
+ private CameraDevice mCameraDevice;
+ private CameraCaptureSession mCaptureSession;
+ private CaptureRequest.Builder mPreviewRequestBuilder;
+ private String mCameraID;
+ private Size mPreviewSize = new Size(-1, -1);
+
+ private HandlerThread mBackgroundThread;
+ private Handler mBackgroundHandler;
+ private Semaphore mCameraOpenCloseLock = new Semaphore(1);
+
+ Camera2Renderer(CameraGLSurfaceView view) {
+ super(view);
+ }
+
+ @Override
+ protected void doStart() {
+ Log.d(LOGTAG, "doStart");
+ startBackgroundThread();
+ super.doStart();
+ }
+
+
+ @Override
+ protected void doStop() {
+ Log.d(LOGTAG, "doStop");
+ super.doStop();
+ stopBackgroundThread();
+ }
+
+ boolean cacPreviewSize(final int width, final int height) {
+ Log.i(LOGTAG, "cacPreviewSize: "+width+"x"+height);
+ if(mCameraID == null) {
+ Log.e(LOGTAG, "Camera isn't initialized!");
+ return false;
+ }
+ CameraManager manager = (CameraManager) mView.getContext()
+ .getSystemService(Context.CAMERA_SERVICE);
+ try {
+ CameraCharacteristics characteristics = manager
+ .getCameraCharacteristics(mCameraID);
+ StreamConfigurationMap map = characteristics
+ .get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
+ int bestWidth = 0, bestHeight = 0;
+ float aspect = (float)width / height;
+ for (Size psize : map.getOutputSizes(SurfaceTexture.class)) {
+ int w = psize.getWidth(), h = psize.getHeight();
+ Log.d(LOGTAG, "trying size: "+w+"x"+h);
+ if ( width >= w && height >= h &&
+ bestWidth <= w && bestHeight <= h &&
+ Math.abs(aspect - (float)w/h) < 0.2 ) {
+ bestWidth = w;
+ bestHeight = h;
+ }
+ }
+ Log.i(LOGTAG, "best size: "+bestWidth+"x"+bestHeight);
+ if( bestWidth == 0 || bestHeight == 0 ||
+ mPreviewSize.getWidth() == bestWidth &&
+ mPreviewSize.getHeight() == bestHeight )
+ return false;
+ else {
+ mPreviewSize = new Size(bestWidth, bestHeight);
+ return true;
+ }
+ } catch (CameraAccessException e) {
+ Log.e(LOGTAG, "cacPreviewSize - Camera Access Exception");
+ } catch (IllegalArgumentException e) {
+ Log.e(LOGTAG, "cacPreviewSize - Illegal Argument Exception");
+ } catch (SecurityException e) {
+ Log.e(LOGTAG, "cacPreviewSize - Security Exception");
+ }
+ return false;
+ }
+
+ @Override
+ protected void openCamera(int id) {
+ Log.i(LOGTAG, "openCamera");
+ CameraManager manager = (CameraManager) mView.getContext().getSystemService(Context.CAMERA_SERVICE);
+ try {
+ String camList[] = manager.getCameraIdList();
+ if(camList.length == 0) {
+ Log.e(LOGTAG, "Error: camera isn't detected.");
+ return;
+ }
+ if(id == CameraBridgeViewBase.CAMERA_ID_ANY) {
+ mCameraID = camList[0];
+ } else {
+ for (String cameraID : camList) {
+ CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraID);
+ if( id == CameraBridgeViewBase.CAMERA_ID_BACK &&
+ characteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_BACK ||
+ id == CameraBridgeViewBase.CAMERA_ID_FRONT &&
+ characteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT) {
+ mCameraID = cameraID;
+ break;
+ }
+ }
+ }
+ if(mCameraID != null) {
+ if (!mCameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) {
+ throw new RuntimeException(
+ "Time out waiting to lock camera opening.");
+ }
+ Log.i(LOGTAG, "Opening camera: " + mCameraID);
+ manager.openCamera(mCameraID, mStateCallback, mBackgroundHandler);
+ }
+ } catch (CameraAccessException e) {
+ Log.e(LOGTAG, "OpenCamera - Camera Access Exception");
+ } catch (IllegalArgumentException e) {
+ Log.e(LOGTAG, "OpenCamera - Illegal Argument Exception");
+ } catch (SecurityException e) {
+ Log.e(LOGTAG, "OpenCamera - Security Exception");
+ } catch (InterruptedException e) {
+ Log.e(LOGTAG, "OpenCamera - Interrupted Exception");
+ }
+ }
+
+ @Override
+ protected void closeCamera() {
+ Log.i(LOGTAG, "closeCamera");
+ try {
+ mCameraOpenCloseLock.acquire();
+ if (null != mCaptureSession) {
+ mCaptureSession.close();
+ mCaptureSession = null;
+ }
+ if (null != mCameraDevice) {
+ mCameraDevice.close();
+ mCameraDevice = null;
+ }
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Interrupted while trying to lock camera closing.", e);
+ } finally {
+ mCameraOpenCloseLock.release();
+ }
+ }
+
+ private final CameraDevice.StateCallback mStateCallback = new CameraDevice.StateCallback() {
+
+ @Override
+ public void onOpened(CameraDevice cameraDevice) {
+ mCameraDevice = cameraDevice;
+ mCameraOpenCloseLock.release();
+ createCameraPreviewSession();
+ }
+
+ @Override
+ public void onDisconnected(CameraDevice cameraDevice) {
+ cameraDevice.close();
+ mCameraDevice = null;
+ mCameraOpenCloseLock.release();
+ }
+
+ @Override
+ public void onError(CameraDevice cameraDevice, int error) {
+ cameraDevice.close();
+ mCameraDevice = null;
+ mCameraOpenCloseLock.release();
+ }
+
+ };
+
+ private void createCameraPreviewSession() {
+ int w=mPreviewSize.getWidth(), h=mPreviewSize.getHeight();
+ Log.i(LOGTAG, "createCameraPreviewSession("+w+"x"+h+")");
+ if(w<0 || h<0)
+ return;
+ try {
+ mCameraOpenCloseLock.acquire();
+ if (null == mCameraDevice) {
+ mCameraOpenCloseLock.release();
+ Log.e(LOGTAG, "createCameraPreviewSession: camera isn't opened");
+ return;
+ }
+ if (null != mCaptureSession) {
+ mCameraOpenCloseLock.release();
+ Log.e(LOGTAG, "createCameraPreviewSession: mCaptureSession is already started");
+ return;
+ }
+ if(null == mSTexture) {
+ mCameraOpenCloseLock.release();
+ Log.e(LOGTAG, "createCameraPreviewSession: preview SurfaceTexture is null");
+ return;
+ }
+ mSTexture.setDefaultBufferSize(w, h);
+
+ Surface surface = new Surface(mSTexture);
+
+ mPreviewRequestBuilder = mCameraDevice
+ .createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
+ mPreviewRequestBuilder.addTarget(surface);
+
+ mCameraDevice.createCaptureSession(Arrays.asList(surface),
+ new CameraCaptureSession.StateCallback() {
+ @Override
+ public void onConfigured( CameraCaptureSession cameraCaptureSession) {
+ mCaptureSession = cameraCaptureSession;
+ try {
+ mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
+ mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
+
+ mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(), null, mBackgroundHandler);
+ Log.i(LOGTAG, "CameraPreviewSession has been started");
+ } catch (CameraAccessException e) {
+ Log.e(LOGTAG, "createCaptureSession failed");
+ }
+ mCameraOpenCloseLock.release();
+ }
+
+ @Override
+ public void onConfigureFailed(
+ CameraCaptureSession cameraCaptureSession) {
+ Log.e(LOGTAG, "createCameraPreviewSession failed");
+ mCameraOpenCloseLock.release();
+ }
+ }, mBackgroundHandler);
+ } catch (CameraAccessException e) {
+ Log.e(LOGTAG, "createCameraPreviewSession");
+ } catch (InterruptedException e) {
+ throw new RuntimeException(
+ "Interrupted while createCameraPreviewSession", e);
+ }
+ finally {
+ //mCameraOpenCloseLock.release();
+ }
+ }
+
+ private void startBackgroundThread() {
+ Log.i(LOGTAG, "startBackgroundThread");
+ stopBackgroundThread();
+ mBackgroundThread = new HandlerThread("CameraBackground");
+ mBackgroundThread.start();
+ mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
+ }
+
+ private void stopBackgroundThread() {
+ Log.i(LOGTAG, "stopBackgroundThread");
+ if(mBackgroundThread == null)
+ return;
+ mBackgroundThread.quitSafely();
+ try {
+ mBackgroundThread.join();
+ mBackgroundThread = null;
+ mBackgroundHandler = null;
+ } catch (InterruptedException e) {
+ Log.e(LOGTAG, "stopBackgroundThread");
+ }
+ }
+
+ @Override
+ protected void setCameraPreviewSize(int width, int height) {
+ Log.i(LOGTAG, "setCameraPreviewSize("+width+"x"+height+")");
+ if(mMaxCameraWidth > 0 && mMaxCameraWidth < width) width = mMaxCameraWidth;
+ if(mMaxCameraHeight > 0 && mMaxCameraHeight < height) height = mMaxCameraHeight;
+ try {
+ mCameraOpenCloseLock.acquire();
+
+ boolean needReconfig = cacPreviewSize(width, height);
+ mCameraWidth = mPreviewSize.getWidth();
+ mCameraHeight = mPreviewSize.getHeight();
+
+ if( !needReconfig ) {
+ mCameraOpenCloseLock.release();
+ return;
+ }
+ if (null != mCaptureSession) {
+ Log.d(LOGTAG, "closing existing previewSession");
+ mCaptureSession.close();
+ mCaptureSession = null;
+ }
+ mCameraOpenCloseLock.release();
+ createCameraPreviewSession();
+ } catch (InterruptedException e) {
+ mCameraOpenCloseLock.release();
+ throw new RuntimeException("Interrupted while setCameraPreviewSize.", e);
+ }
+ }
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/CameraBridgeViewBase.java b/openCVLibrary3/src/main/java/org/opencv/android/CameraBridgeViewBase.java
new file mode 100644
index 00000000000..2cdaaac3092
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/CameraBridgeViewBase.java
@@ -0,0 +1,495 @@
+package org.opencv.android;
+
+import java.util.List;
+
+import org.opencv.BuildConfig;
+import org.opencv.R;
+import org.opencv.core.Mat;
+import org.opencv.core.Size;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.res.TypedArray;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Rect;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+
+/**
+ * This is a basic class, implementing the interaction with Camera and OpenCV library.
+ * The main responsibility of it - is to control when camera can be enabled, process the frame,
+ * call external listener to make any adjustments to the frame and then draw the resulting
+ * frame to the screen.
+ * The clients shall implement CvCameraViewListener.
+ */
+public abstract class CameraBridgeViewBase extends SurfaceView implements SurfaceHolder.Callback {
+
+ private static final String TAG = "CameraBridge";
+ private static final int MAX_UNSPECIFIED = -1;
+ private static final int STOPPED = 0;
+ private static final int STARTED = 1;
+
+ private int mState = STOPPED;
+ protected Bitmap mCacheBitmap;
+ protected CvCameraViewListener2 mListener;
+ private boolean mSurfaceExist;
+ private final Object mSyncObject = new Object();
+
+ protected int mFrameWidth;
+ protected int mFrameHeight;
+ protected int mMaxHeight;
+ protected int mMaxWidth;
+ protected float mScale = 0;
+ protected int mPreviewFormat = RGBA;
+ protected int mCameraIndex = CAMERA_ID_ANY;
+ protected boolean mEnabled;
+ protected FpsMeter mFpsMeter = null;
+
+ public static final int CAMERA_ID_ANY = -1;
+ public static final int CAMERA_ID_BACK = 99;
+ public static final int CAMERA_ID_FRONT = 98;
+ public static final int RGBA = 1;
+ public static final int GRAY = 2;
+
+ public CameraBridgeViewBase(Context context, int cameraId) {
+ super(context);
+ mCameraIndex = cameraId;
+ getHolder().addCallback(this);
+ mMaxWidth = MAX_UNSPECIFIED;
+ mMaxHeight = MAX_UNSPECIFIED;
+ }
+
+ public CameraBridgeViewBase(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ int count = attrs.getAttributeCount();
+ Log.d(TAG, "Attr count: " + Integer.valueOf(count));
+
+ TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
+ if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
+ enableFpsMeter();
+
+ mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);
+
+ getHolder().addCallback(this);
+ mMaxWidth = MAX_UNSPECIFIED;
+ mMaxHeight = MAX_UNSPECIFIED;
+ styledAttrs.recycle();
+ }
+
+ /**
+ * Sets the camera index
+ * @param cameraIndex new camera index
+ */
+ public void setCameraIndex(int cameraIndex) {
+ this.mCameraIndex = cameraIndex;
+ }
+
+ public interface CvCameraViewListener {
+ /**
+ * This method is invoked when camera preview has started. After this method is invoked
+ * the frames will start to be delivered to client via the onCameraFrame() callback.
+ * @param width - the width of the frames that will be delivered
+ * @param height - the height of the frames that will be delivered
+ */
+ public void onCameraViewStarted(int width, int height);
+
+ /**
+ * This method is invoked when camera preview has been stopped for some reason.
+ * No frames will be delivered via onCameraFrame() callback after this method is called.
+ */
+ public void onCameraViewStopped();
+
+ /**
+ * This method is invoked when delivery of the frame needs to be done.
+ * The returned values - is a modified frame which needs to be displayed on the screen.
+ * TODO: pass the parameters specifying the format of the frame (BPP, YUV or RGB and etc)
+ */
+ public Mat onCameraFrame(Mat inputFrame);
+ }
+
+ public interface CvCameraViewListener2 {
+ /**
+ * This method is invoked when camera preview has started. After this method is invoked
+ * the frames will start to be delivered to client via the onCameraFrame() callback.
+ * @param width - the width of the frames that will be delivered
+ * @param height - the height of the frames that will be delivered
+ */
+ public void onCameraViewStarted(int width, int height);
+
+ /**
+ * This method is invoked when camera preview has been stopped for some reason.
+ * No frames will be delivered via onCameraFrame() callback after this method is called.
+ */
+ public void onCameraViewStopped();
+
+ /**
+ * This method is invoked when delivery of the frame needs to be done.
+ * The returned values - is a modified frame which needs to be displayed on the screen.
+ * TODO: pass the parameters specifying the format of the frame (BPP, YUV or RGB and etc)
+ */
+ public Mat onCameraFrame(CvCameraViewFrame inputFrame);
+ };
+
+ protected class CvCameraViewListenerAdapter implements CvCameraViewListener2 {
+ public CvCameraViewListenerAdapter(CvCameraViewListener oldStypeListener) {
+ mOldStyleListener = oldStypeListener;
+ }
+
+ public void onCameraViewStarted(int width, int height) {
+ mOldStyleListener.onCameraViewStarted(width, height);
+ }
+
+ public void onCameraViewStopped() {
+ mOldStyleListener.onCameraViewStopped();
+ }
+
+ public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
+ Mat result = null;
+ switch (mPreviewFormat) {
+ case RGBA:
+ result = mOldStyleListener.onCameraFrame(inputFrame.rgba());
+ break;
+ case GRAY:
+ result = mOldStyleListener.onCameraFrame(inputFrame.gray());
+ break;
+ default:
+ Log.e(TAG, "Invalid frame format! Only RGBA and Gray Scale are supported!");
+ };
+
+ return result;
+ }
+
+ public void setFrameFormat(int format) {
+ mPreviewFormat = format;
+ }
+
+ private int mPreviewFormat = RGBA;
+ private CvCameraViewListener mOldStyleListener;
+ };
+
+ /**
+ * This class interface is abstract representation of single frame from camera for onCameraFrame callback
+ * Attention: Do not use objects, that represents this interface out of onCameraFrame callback!
+ */
+ public interface CvCameraViewFrame {
+
+ /**
+ * This method returns RGBA Mat with frame
+ */
+ public Mat rgba();
+
+ /**
+ * This method returns single channel gray scale Mat with frame
+ */
+ public Mat gray();
+ };
+
+ public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) {
+ Log.d(TAG, "call surfaceChanged event");
+ synchronized(mSyncObject) {
+ if (!mSurfaceExist) {
+ mSurfaceExist = true;
+ checkCurrentState();
+ } else {
+ /** Surface changed. We need to stop camera and restart with new parameters */
+ /* Pretend that old surface has been destroyed */
+ mSurfaceExist = false;
+ checkCurrentState();
+ /* Now use new surface. Say we have it now */
+ mSurfaceExist = true;
+ checkCurrentState();
+ }
+ }
+ }
+
+ public void surfaceCreated(SurfaceHolder holder) {
+ /* Do nothing. Wait until surfaceChanged delivered */
+ }
+
+ public void surfaceDestroyed(SurfaceHolder holder) {
+ synchronized(mSyncObject) {
+ mSurfaceExist = false;
+ checkCurrentState();
+ }
+ }
+
+ /**
+ * This method is provided for clients, so they can enable the camera connection.
+ * The actual onCameraViewStarted callback will be delivered only after both this method is called and surface is available
+ */
+ public void enableView() {
+ synchronized(mSyncObject) {
+ mEnabled = true;
+ checkCurrentState();
+ }
+ }
+
+ /**
+ * This method is provided for clients, so they can disable camera connection and stop
+ * the delivery of frames even though the surface view itself is not destroyed and still stays on the scren
+ */
+ public void disableView() {
+ synchronized(mSyncObject) {
+ mEnabled = false;
+ checkCurrentState();
+ }
+ }
+
+ /**
+ * This method enables label with fps value on the screen
+ */
+ public void enableFpsMeter() {
+ if (mFpsMeter == null) {
+ mFpsMeter = new FpsMeter();
+ mFpsMeter.setResolution(mFrameWidth, mFrameHeight);
+ }
+ }
+
+ public void disableFpsMeter() {
+ mFpsMeter = null;
+ }
+
+ /**
+ *
+ * @param listener
+ */
+
+ public void setCvCameraViewListener(CvCameraViewListener2 listener) {
+ mListener = listener;
+ }
+
+ public void setCvCameraViewListener(CvCameraViewListener listener) {
+ CvCameraViewListenerAdapter adapter = new CvCameraViewListenerAdapter(listener);
+ adapter.setFrameFormat(mPreviewFormat);
+ mListener = adapter;
+ }
+
+ /**
+ * This method sets the maximum size that camera frame is allowed to be. When selecting
+ * size - the biggest size which less or equal the size set will be selected.
+ * As an example - we set setMaxFrameSize(200,200) and we have 176x152 and 320x240 sizes. The
+ * preview frame will be selected with 176x152 size.
+ * This method is useful when need to restrict the size of preview frame for some reason (for example for video recording)
+ * @param maxWidth - the maximum width allowed for camera frame.
+ * @param maxHeight - the maximum height allowed for camera frame
+ */
+ public void setMaxFrameSize(int maxWidth, int maxHeight) {
+ mMaxWidth = maxWidth;
+ mMaxHeight = maxHeight;
+ }
+
+ public void SetCaptureFormat(int format)
+ {
+ mPreviewFormat = format;
+ if (mListener instanceof CvCameraViewListenerAdapter) {
+ CvCameraViewListenerAdapter adapter = (CvCameraViewListenerAdapter) mListener;
+ adapter.setFrameFormat(mPreviewFormat);
+ }
+ }
+
+ /**
+ * Called when mSyncObject lock is held
+ */
+ private void checkCurrentState() {
+ Log.d(TAG, "call checkCurrentState");
+ int targetState;
+
+ if (mEnabled && mSurfaceExist && getVisibility() == VISIBLE) {
+ targetState = STARTED;
+ } else {
+ targetState = STOPPED;
+ }
+
+ if (targetState != mState) {
+ /* The state change detected. Need to exit the current state and enter target state */
+ processExitState(mState);
+ mState = targetState;
+ processEnterState(mState);
+ }
+ }
+
+ private void processEnterState(int state) {
+ Log.d(TAG, "call processEnterState: " + state);
+ switch(state) {
+ case STARTED:
+ onEnterStartedState();
+ if (mListener != null) {
+ mListener.onCameraViewStarted(mFrameWidth, mFrameHeight);
+ }
+ break;
+ case STOPPED:
+ onEnterStoppedState();
+ if (mListener != null) {
+ mListener.onCameraViewStopped();
+ }
+ break;
+ };
+ }
+
+ private void processExitState(int state) {
+ Log.d(TAG, "call processExitState: " + state);
+ switch(state) {
+ case STARTED:
+ onExitStartedState();
+ break;
+ case STOPPED:
+ onExitStoppedState();
+ break;
+ };
+ }
+
+ private void onEnterStoppedState() {
+ /* nothing to do */
+ }
+
+ private void onExitStoppedState() {
+ /* nothing to do */
+ }
+
+ // NOTE: The order of bitmap constructor and camera connection is important for android 4.1.x
+ // Bitmap must be constructed before surface
+ private void onEnterStartedState() {
+ Log.d(TAG, "call onEnterStartedState");
+ /* Connect camera */
+ if (!connectCamera(getWidth(), getHeight())) {
+ AlertDialog ad = new AlertDialog.Builder(getContext()).create();
+ ad.setCancelable(false); // This blocks the 'BACK' button
+ ad.setMessage("It seems that you device does not support camera (or it is locked). Application will be closed.");
+ ad.setButton(DialogInterface.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ ((Activity) getContext()).finish();
+ }
+ });
+ ad.show();
+
+ }
+ }
+
+ private void onExitStartedState() {
+ disconnectCamera();
+ if (mCacheBitmap != null) {
+ mCacheBitmap.recycle();
+ }
+ }
+
+ /**
+ * This method shall be called by the subclasses when they have valid
+ * object and want it to be delivered to external client (via callback) and
+ * then displayed on the screen.
+ * @param frame - the current frame to be delivered
+ */
+ protected void deliverAndDrawFrame(CvCameraViewFrame frame) {
+ Mat modified;
+
+ if (mListener != null) {
+ modified = mListener.onCameraFrame(frame);
+ } else {
+ modified = frame.rgba();
+ }
+
+ boolean bmpValid = true;
+ if (modified != null) {
+ try {
+ Utils.matToBitmap(modified, mCacheBitmap);
+ } catch(Exception e) {
+ Log.e(TAG, "Mat type: " + modified);
+ Log.e(TAG, "Bitmap type: " + mCacheBitmap.getWidth() + "*" + mCacheBitmap.getHeight());
+ Log.e(TAG, "Utils.matToBitmap() throws an exception: " + e.getMessage());
+ bmpValid = false;
+ }
+ }
+
+ if (bmpValid && mCacheBitmap != null) {
+ Canvas canvas = getHolder().lockCanvas();
+ if (canvas != null) {
+ canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
+ if (BuildConfig.DEBUG)
+ Log.d(TAG, "mStretch value: " + mScale);
+
+ if (mScale != 0) {
+ canvas.drawBitmap(mCacheBitmap, new Rect(0,0,mCacheBitmap.getWidth(), mCacheBitmap.getHeight()),
+ new Rect((int)((canvas.getWidth() - mScale*mCacheBitmap.getWidth()) / 2),
+ (int)((canvas.getHeight() - mScale*mCacheBitmap.getHeight()) / 2),
+ (int)((canvas.getWidth() - mScale*mCacheBitmap.getWidth()) / 2 + mScale*mCacheBitmap.getWidth()),
+ (int)((canvas.getHeight() - mScale*mCacheBitmap.getHeight()) / 2 + mScale*mCacheBitmap.getHeight())), null);
+ } else {
+ canvas.drawBitmap(mCacheBitmap, new Rect(0,0,mCacheBitmap.getWidth(), mCacheBitmap.getHeight()),
+ new Rect((canvas.getWidth() - mCacheBitmap.getWidth()) / 2,
+ (canvas.getHeight() - mCacheBitmap.getHeight()) / 2,
+ (canvas.getWidth() - mCacheBitmap.getWidth()) / 2 + mCacheBitmap.getWidth(),
+ (canvas.getHeight() - mCacheBitmap.getHeight()) / 2 + mCacheBitmap.getHeight()), null);
+ }
+
+ if (mFpsMeter != null) {
+ mFpsMeter.measure();
+ mFpsMeter.draw(canvas, 20, 30);
+ }
+ getHolder().unlockCanvasAndPost(canvas);
+ }
+ }
+ }
+
+ /**
+ * This method is invoked shall perform concrete operation to initialize the camera.
+ * CONTRACT: as a result of this method variables mFrameWidth and mFrameHeight MUST be
+ * initialized with the size of the Camera frames that will be delivered to external processor.
+ * @param width - the width of this SurfaceView
+ * @param height - the height of this SurfaceView
+ */
+ protected abstract boolean connectCamera(int width, int height);
+
+ /**
+ * Disconnects and release the particular camera object being connected to this surface view.
+ * Called when syncObject lock is held
+ */
+ protected abstract void disconnectCamera();
+
+ // NOTE: On Android 4.1.x the function must be called before SurfaceTexture constructor!
+ protected void AllocateCache()
+ {
+ mCacheBitmap = Bitmap.createBitmap(mFrameWidth, mFrameHeight, Bitmap.Config.ARGB_8888);
+ }
+
+ public interface ListItemAccessor {
+ public int getWidth(Object obj);
+ public int getHeight(Object obj);
+ };
+
+ /**
+ * This helper method can be called by subclasses to select camera preview size.
+ * It goes over the list of the supported preview sizes and selects the maximum one which
+ * fits both values set via setMaxFrameSize() and surface frame allocated for this view
+ * @param supportedSizes
+ * @param surfaceWidth
+ * @param surfaceHeight
+ * @return optimal frame size
+ */
+ protected Size calculateCameraFrameSize(List> supportedSizes, ListItemAccessor accessor, int surfaceWidth, int surfaceHeight) {
+ int calcWidth = 0;
+ int calcHeight = 0;
+
+ int maxAllowedWidth = (mMaxWidth != MAX_UNSPECIFIED && mMaxWidth < surfaceWidth)? mMaxWidth : surfaceWidth;
+ int maxAllowedHeight = (mMaxHeight != MAX_UNSPECIFIED && mMaxHeight < surfaceHeight)? mMaxHeight : surfaceHeight;
+
+ for (Object size : supportedSizes) {
+ int width = accessor.getWidth(size);
+ int height = accessor.getHeight(size);
+
+ if (width <= maxAllowedWidth && height <= maxAllowedHeight) {
+ if (width >= calcWidth && height >= calcHeight) {
+ calcWidth = (int) width;
+ calcHeight = (int) height;
+ }
+ }
+ }
+
+ return new Size(calcWidth, calcHeight);
+ }
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/CameraGLRendererBase.java b/openCVLibrary3/src/main/java/org/opencv/android/CameraGLRendererBase.java
new file mode 100644
index 00000000000..60c37c304e2
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/CameraGLRendererBase.java
@@ -0,0 +1,440 @@
+package org.opencv.android;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.FloatBuffer;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import org.opencv.android.CameraGLSurfaceView.CameraTextureListener;
+
+import android.annotation.TargetApi;
+import android.graphics.SurfaceTexture;
+import android.opengl.GLES11Ext;
+import android.opengl.GLES20;
+import android.opengl.GLSurfaceView;
+import android.util.Log;
+import android.view.View;
+
+@TargetApi(15)
+public abstract class CameraGLRendererBase implements GLSurfaceView.Renderer, SurfaceTexture.OnFrameAvailableListener {
+
+ protected final String LOGTAG = "CameraGLRendererBase";
+
+ // shaders
+ private final String vss = ""
+ + "attribute vec2 vPosition;\n"
+ + "attribute vec2 vTexCoord;\n" + "varying vec2 texCoord;\n"
+ + "void main() {\n" + " texCoord = vTexCoord;\n"
+ + " gl_Position = vec4 ( vPosition.x, vPosition.y, 0.0, 1.0 );\n"
+ + "}";
+
+ private final String fssOES = ""
+ + "#extension GL_OES_EGL_image_external : require\n"
+ + "precision mediump float;\n"
+ + "uniform samplerExternalOES sTexture;\n"
+ + "varying vec2 texCoord;\n"
+ + "void main() {\n"
+ + " gl_FragColor = texture2D(sTexture,texCoord);\n" + "}";
+
+ private final String fss2D = ""
+ + "precision mediump float;\n"
+ + "uniform sampler2D sTexture;\n"
+ + "varying vec2 texCoord;\n"
+ + "void main() {\n"
+ + " gl_FragColor = texture2D(sTexture,texCoord);\n" + "}";
+
+ // coord-s
+ private final float vertices[] = {
+ -1, -1,
+ -1, 1,
+ 1, -1,
+ 1, 1 };
+ private final float texCoordOES[] = {
+ 0, 1,
+ 0, 0,
+ 1, 1,
+ 1, 0 };
+ private final float texCoord2D[] = {
+ 0, 0,
+ 0, 1,
+ 1, 0,
+ 1, 1 };
+
+ private int[] texCamera = {0}, texFBO = {0}, texDraw = {0};
+ private int[] FBO = {0};
+ private int progOES = -1, prog2D = -1;
+ private int vPosOES, vTCOES, vPos2D, vTC2D;
+
+ private FloatBuffer vert, texOES, tex2D;
+
+ protected int mCameraWidth = -1, mCameraHeight = -1;
+ protected int mFBOWidth = -1, mFBOHeight = -1;
+ protected int mMaxCameraWidth = -1, mMaxCameraHeight = -1;
+ protected int mCameraIndex = CameraBridgeViewBase.CAMERA_ID_ANY;
+
+ protected SurfaceTexture mSTexture;
+
+ protected boolean mHaveSurface = false;
+ protected boolean mHaveFBO = false;
+ protected boolean mUpdateST = false;
+ protected boolean mEnabled = true;
+ protected boolean mIsStarted = false;
+
+ protected CameraGLSurfaceView mView;
+
+ protected abstract void openCamera(int id);
+ protected abstract void closeCamera();
+ protected abstract void setCameraPreviewSize(int width, int height); // updates mCameraWidth & mCameraHeight
+
+ public CameraGLRendererBase(CameraGLSurfaceView view) {
+ mView = view;
+ int bytes = vertices.length * Float.SIZE / Byte.SIZE;
+ vert = ByteBuffer.allocateDirect(bytes).order(ByteOrder.nativeOrder()).asFloatBuffer();
+ texOES = ByteBuffer.allocateDirect(bytes).order(ByteOrder.nativeOrder()).asFloatBuffer();
+ tex2D = ByteBuffer.allocateDirect(bytes).order(ByteOrder.nativeOrder()).asFloatBuffer();
+ vert.put(vertices).position(0);
+ texOES.put(texCoordOES).position(0);
+ tex2D.put(texCoord2D).position(0);
+ }
+
+ @Override
+ public synchronized void onFrameAvailable(SurfaceTexture surfaceTexture) {
+ //Log.i(LOGTAG, "onFrameAvailable");
+ mUpdateST = true;
+ mView.requestRender();
+ }
+
+ @Override
+ public void onDrawFrame(GL10 gl) {
+ //Log.i(LOGTAG, "onDrawFrame start");
+
+ if (!mHaveFBO)
+ return;
+
+ synchronized(this) {
+ if (mUpdateST) {
+ mSTexture.updateTexImage();
+ mUpdateST = false;
+ }
+
+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
+
+ CameraTextureListener texListener = mView.getCameraTextureListener();
+ if(texListener != null) {
+ //Log.d(LOGTAG, "haveUserCallback");
+ // texCamera(OES) -> texFBO
+ drawTex(texCamera[0], true, FBO[0]);
+
+ // call user code (texFBO -> texDraw)
+ boolean modified = texListener.onCameraTexture(texFBO[0], texDraw[0], mCameraWidth, mCameraHeight);
+
+ if(modified) {
+ // texDraw -> screen
+ drawTex(texDraw[0], false, 0);
+ } else {
+ // texFBO -> screen
+ drawTex(texFBO[0], false, 0);
+ }
+ } else {
+ Log.d(LOGTAG, "texCamera(OES) -> screen");
+ // texCamera(OES) -> screen
+ drawTex(texCamera[0], true, 0);
+ }
+ //Log.i(LOGTAG, "onDrawFrame end");
+ }
+ }
+
+ @Override
+ public void onSurfaceChanged(GL10 gl, int surfaceWidth, int surfaceHeight) {
+ Log.i(LOGTAG, "onSurfaceChanged("+surfaceWidth+"x"+surfaceHeight+")");
+ mHaveSurface = true;
+ updateState();
+ setPreviewSize(surfaceWidth, surfaceHeight);
+ }
+
+ @Override
+ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+ Log.i(LOGTAG, "onSurfaceCreated");
+ initShaders();
+ }
+
+ private void initShaders() {
+ String strGLVersion = GLES20.glGetString(GLES20.GL_VERSION);
+ if (strGLVersion != null)
+ Log.i(LOGTAG, "OpenGL ES version: " + strGLVersion);
+
+ GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+
+ progOES = loadShader(vss, fssOES);
+ vPosOES = GLES20.glGetAttribLocation(progOES, "vPosition");
+ vTCOES = GLES20.glGetAttribLocation(progOES, "vTexCoord");
+ GLES20.glEnableVertexAttribArray(vPosOES);
+ GLES20.glEnableVertexAttribArray(vTCOES);
+
+ prog2D = loadShader(vss, fss2D);
+ vPos2D = GLES20.glGetAttribLocation(prog2D, "vPosition");
+ vTC2D = GLES20.glGetAttribLocation(prog2D, "vTexCoord");
+ GLES20.glEnableVertexAttribArray(vPos2D);
+ GLES20.glEnableVertexAttribArray(vTC2D);
+ }
+
+ private void initSurfaceTexture() {
+ Log.d(LOGTAG, "initSurfaceTexture");
+ deleteSurfaceTexture();
+ initTexOES(texCamera);
+ mSTexture = new SurfaceTexture(texCamera[0]);
+ mSTexture.setOnFrameAvailableListener(this);
+ }
+
+ private void deleteSurfaceTexture() {
+ Log.d(LOGTAG, "deleteSurfaceTexture");
+ if(mSTexture != null) {
+ mSTexture.release();
+ mSTexture = null;
+ deleteTex(texCamera);
+ }
+ }
+
+ private void initTexOES(int[] tex) {
+ if(tex.length == 1) {
+ GLES20.glGenTextures(1, tex, 0);
+ GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex[0]);
+ GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
+ GLES20.glTexParameteri(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
+ }
+ }
+
+ private static void deleteTex(int[] tex) {
+ if(tex.length == 1) {
+ GLES20.glDeleteTextures(1, tex, 0);
+ }
+ }
+
+ private static int loadShader(String vss, String fss) {
+ Log.d("CameraGLRendererBase", "loadShader");
+ int vshader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
+ GLES20.glShaderSource(vshader, vss);
+ GLES20.glCompileShader(vshader);
+ int[] status = new int[1];
+ GLES20.glGetShaderiv(vshader, GLES20.GL_COMPILE_STATUS, status, 0);
+ if (status[0] == 0) {
+ Log.e("CameraGLRendererBase", "Could not compile vertex shader: "+GLES20.glGetShaderInfoLog(vshader));
+ GLES20.glDeleteShader(vshader);
+ vshader = 0;
+ return 0;
+ }
+
+ int fshader = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
+ GLES20.glShaderSource(fshader, fss);
+ GLES20.glCompileShader(fshader);
+ GLES20.glGetShaderiv(fshader, GLES20.GL_COMPILE_STATUS, status, 0);
+ if (status[0] == 0) {
+ Log.e("CameraGLRendererBase", "Could not compile fragment shader:"+GLES20.glGetShaderInfoLog(fshader));
+ GLES20.glDeleteShader(vshader);
+ GLES20.glDeleteShader(fshader);
+ fshader = 0;
+ return 0;
+ }
+
+ int program = GLES20.glCreateProgram();
+ GLES20.glAttachShader(program, vshader);
+ GLES20.glAttachShader(program, fshader);
+ GLES20.glLinkProgram(program);
+ GLES20.glDeleteShader(vshader);
+ GLES20.glDeleteShader(fshader);
+ GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, status, 0);
+ if (status[0] == 0) {
+ Log.e("CameraGLRendererBase", "Could not link shader program: "+GLES20.glGetProgramInfoLog(program));
+ program = 0;
+ return 0;
+ }
+ GLES20.glValidateProgram(program);
+ GLES20.glGetProgramiv(program, GLES20.GL_VALIDATE_STATUS, status, 0);
+ if (status[0] == 0)
+ {
+ Log.e("CameraGLRendererBase", "Shader program validation error: "+GLES20.glGetProgramInfoLog(program));
+ GLES20.glDeleteProgram(program);
+ program = 0;
+ return 0;
+ }
+
+ Log.d("CameraGLRendererBase", "Shader program is built OK");
+
+ return program;
+ }
+
+ private void deleteFBO()
+ {
+ Log.d(LOGTAG, "deleteFBO("+mFBOWidth+"x"+mFBOHeight+")");
+ GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
+ GLES20.glDeleteFramebuffers(1, FBO, 0);
+
+ deleteTex(texFBO);
+ deleteTex(texDraw);
+ mFBOWidth = mFBOHeight = 0;
+ }
+
+ private void initFBO(int width, int height)
+ {
+ Log.d(LOGTAG, "initFBO("+width+"x"+height+")");
+
+ deleteFBO();
+
+ GLES20.glGenTextures(1, texDraw, 0);
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texDraw[0]);
+ GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
+
+ GLES20.glGenTextures(1, texFBO, 0);
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texFBO[0]);
+ GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
+
+ //int hFBO;
+ GLES20.glGenFramebuffers(1, FBO, 0);
+ GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, FBO[0]);
+ GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, texFBO[0], 0);
+ Log.d(LOGTAG, "initFBO error status: " + GLES20.glGetError());
+
+ int FBOstatus = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);
+ if (FBOstatus != GLES20.GL_FRAMEBUFFER_COMPLETE)
+ Log.e(LOGTAG, "initFBO failed, status: " + FBOstatus);
+
+ mFBOWidth = width;
+ mFBOHeight = height;
+ }
+
+ // draw texture to FBO or to screen if fbo == 0
+ private void drawTex(int tex, boolean isOES, int fbo)
+ {
+ GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo);
+
+ if(fbo == 0)
+ GLES20.glViewport(0, 0, mView.getWidth(), mView.getHeight());
+ else
+ GLES20.glViewport(0, 0, mFBOWidth, mFBOHeight);
+
+ GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
+
+ if(isOES) {
+ GLES20.glUseProgram(progOES);
+ GLES20.glVertexAttribPointer(vPosOES, 2, GLES20.GL_FLOAT, false, 4*2, vert);
+ GLES20.glVertexAttribPointer(vTCOES, 2, GLES20.GL_FLOAT, false, 4*2, texOES);
+ } else {
+ GLES20.glUseProgram(prog2D);
+ GLES20.glVertexAttribPointer(vPos2D, 2, GLES20.GL_FLOAT, false, 4*2, vert);
+ GLES20.glVertexAttribPointer(vTC2D, 2, GLES20.GL_FLOAT, false, 4*2, tex2D);
+ }
+
+ GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
+
+ if(isOES) {
+ GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex);
+ GLES20.glUniform1i(GLES20.glGetUniformLocation(progOES, "sTexture"), 0);
+ } else {
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex);
+ GLES20.glUniform1i(GLES20.glGetUniformLocation(prog2D, "sTexture"), 0);
+ }
+
+ GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
+ GLES20.glFlush();
+ }
+
+ public synchronized void enableView() {
+ Log.d(LOGTAG, "enableView");
+ mEnabled = true;
+ updateState();
+ }
+
+ public synchronized void disableView() {
+ Log.d(LOGTAG, "disableView");
+ mEnabled = false;
+ updateState();
+ }
+
+ protected void updateState() {
+ Log.d(LOGTAG, "updateState");
+ Log.d(LOGTAG, "mEnabled="+mEnabled+", mHaveSurface="+mHaveSurface);
+ boolean willStart = mEnabled && mHaveSurface && mView.getVisibility() == View.VISIBLE;
+ if (willStart != mIsStarted) {
+ if(willStart) doStart();
+ else doStop();
+ } else {
+ Log.d(LOGTAG, "keeping State unchanged");
+ }
+ Log.d(LOGTAG, "updateState end");
+ }
+
+ protected synchronized void doStart() {
+ Log.d(LOGTAG, "doStart");
+ initSurfaceTexture();
+ openCamera(mCameraIndex);
+ mIsStarted = true;
+ if(mCameraWidth>0 && mCameraHeight>0)
+ setPreviewSize(mCameraWidth, mCameraHeight); // start preview and call listener.onCameraViewStarted()
+ }
+
+
+ protected void doStop() {
+ Log.d(LOGTAG, "doStop");
+ synchronized(this) {
+ mUpdateST = false;
+ mIsStarted = false;
+ mHaveFBO = false;
+ closeCamera();
+ deleteSurfaceTexture();
+ }
+ CameraTextureListener listener = mView.getCameraTextureListener();
+ if(listener != null) listener.onCameraViewStopped();
+
+ }
+
+ protected void setPreviewSize(int width, int height) {
+ synchronized(this) {
+ mHaveFBO = false;
+ mCameraWidth = width;
+ mCameraHeight = height;
+ setCameraPreviewSize(width, height); // can change mCameraWidth & mCameraHeight
+ initFBO(mCameraWidth, mCameraHeight);
+ mHaveFBO = true;
+ }
+
+ CameraTextureListener listener = mView.getCameraTextureListener();
+ if(listener != null) listener.onCameraViewStarted(mCameraWidth, mCameraHeight);
+ }
+
+ public void setCameraIndex(int cameraIndex) {
+ disableView();
+ mCameraIndex = cameraIndex;
+ enableView();
+ }
+
+ public void setMaxCameraPreviewSize(int maxWidth, int maxHeight) {
+ disableView();
+ mMaxCameraWidth = maxWidth;
+ mMaxCameraHeight = maxHeight;
+ enableView();
+ }
+
+ public void onResume() {
+ Log.i(LOGTAG, "onResume");
+ }
+
+ public void onPause() {
+ Log.i(LOGTAG, "onPause");
+ mHaveSurface = false;
+ updateState();
+ mCameraWidth = mCameraHeight = -1;
+ }
+
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/CameraGLSurfaceView.java b/openCVLibrary3/src/main/java/org/opencv/android/CameraGLSurfaceView.java
new file mode 100644
index 00000000000..05f950b4713
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/CameraGLSurfaceView.java
@@ -0,0 +1,119 @@
+package org.opencv.android;
+
+import org.opencv.R;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.opengl.GLSurfaceView;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.SurfaceHolder;
+
+public class CameraGLSurfaceView extends GLSurfaceView {
+
+ private static final String LOGTAG = "CameraGLSurfaceView";
+
+ public interface CameraTextureListener {
+ /**
+ * This method is invoked when camera preview has started. After this method is invoked
+ * the frames will start to be delivered to client via the onCameraFrame() callback.
+ * @param width - the width of the frames that will be delivered
+ * @param height - the height of the frames that will be delivered
+ */
+ public void onCameraViewStarted(int width, int height);
+
+ /**
+ * This method is invoked when camera preview has been stopped for some reason.
+ * No frames will be delivered via onCameraFrame() callback after this method is called.
+ */
+ public void onCameraViewStopped();
+
+ /**
+ * This method is invoked when a new preview frame from Camera is ready.
+ * @param texIn - the OpenGL texture ID that contains frame in RGBA format
+ * @param texOut - the OpenGL texture ID that can be used to store modified frame image t display
+ * @param width - the width of the frame
+ * @param height - the height of the frame
+ * @return `true` if `texOut` should be displayed, `false` - to show `texIn`
+ */
+ public boolean onCameraTexture(int texIn, int texOut, int width, int height);
+ };
+
+ private CameraTextureListener mTexListener;
+ private CameraGLRendererBase mRenderer;
+
+ public CameraGLSurfaceView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
+ int cameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);
+ styledAttrs.recycle();
+
+ if(android.os.Build.VERSION.SDK_INT >= 21)
+ mRenderer = new Camera2Renderer(this);
+ else
+ mRenderer = new CameraRenderer(this);
+
+ setCameraIndex(cameraIndex);
+
+ setEGLContextClientVersion(2);
+ setRenderer(mRenderer);
+ setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
+ }
+
+ public void setCameraTextureListener(CameraTextureListener texListener)
+ {
+ mTexListener = texListener;
+ }
+
+ public CameraTextureListener getCameraTextureListener()
+ {
+ return mTexListener;
+ }
+
+ public void setCameraIndex(int cameraIndex) {
+ mRenderer.setCameraIndex(cameraIndex);
+ }
+
+ public void setMaxCameraPreviewSize(int maxWidth, int maxHeight) {
+ mRenderer.setMaxCameraPreviewSize(maxWidth, maxHeight);
+ }
+
+ @Override
+ public void surfaceCreated(SurfaceHolder holder) {
+ super.surfaceCreated(holder);
+ }
+
+ @Override
+ public void surfaceDestroyed(SurfaceHolder holder) {
+ mRenderer.mHaveSurface = false;
+ super.surfaceDestroyed(holder);
+ }
+
+ @Override
+ public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
+ super.surfaceChanged(holder, format, w, h);
+ }
+
+ @Override
+ public void onResume() {
+ Log.i(LOGTAG, "onResume");
+ super.onResume();
+ mRenderer.onResume();
+ }
+
+ @Override
+ public void onPause() {
+ Log.i(LOGTAG, "onPause");
+ mRenderer.onPause();
+ super.onPause();
+ }
+
+ public void enableView() {
+ mRenderer.enableView();
+ }
+
+ public void disableView() {
+ mRenderer.disableView();
+ }
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/CameraRenderer.java b/openCVLibrary3/src/main/java/org/opencv/android/CameraRenderer.java
new file mode 100644
index 00000000000..2d668ffa6e6
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/CameraRenderer.java
@@ -0,0 +1,166 @@
+package org.opencv.android;
+
+import java.io.IOException;
+import java.util.List;
+
+import android.annotation.TargetApi;
+import android.hardware.Camera;
+import android.hardware.Camera.Size;
+import android.os.Build;
+import android.util.Log;
+
+@TargetApi(15)
+@SuppressWarnings("deprecation")
+public class CameraRenderer extends CameraGLRendererBase {
+
+ public static final String LOGTAG = "CameraRenderer";
+
+ private Camera mCamera;
+ private boolean mPreviewStarted = false;
+
+ CameraRenderer(CameraGLSurfaceView view) {
+ super(view);
+ }
+
+ @Override
+ protected synchronized void closeCamera() {
+ Log.i(LOGTAG, "closeCamera");
+ if(mCamera != null) {
+ mCamera.stopPreview();
+ mPreviewStarted = false;
+ mCamera.release();
+ mCamera = null;
+ }
+ }
+
+ @Override
+ protected synchronized void openCamera(int id) {
+ Log.i(LOGTAG, "openCamera");
+ closeCamera();
+ if (id == CameraBridgeViewBase.CAMERA_ID_ANY) {
+ Log.d(LOGTAG, "Trying to open camera with old open()");
+ try {
+ mCamera = Camera.open();
+ }
+ catch (Exception e){
+ Log.e(LOGTAG, "Camera is not available (in use or does not exist): " + e.getLocalizedMessage());
+ }
+
+ if(mCamera == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
+ boolean connected = false;
+ for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
+ Log.d(LOGTAG, "Trying to open camera with new open(" + camIdx + ")");
+ try {
+ mCamera = Camera.open(camIdx);
+ connected = true;
+ } catch (RuntimeException e) {
+ Log.e(LOGTAG, "Camera #" + camIdx + "failed to open: " + e.getLocalizedMessage());
+ }
+ if (connected) break;
+ }
+ }
+ } else {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
+ int localCameraIndex = mCameraIndex;
+ if (mCameraIndex == CameraBridgeViewBase.CAMERA_ID_BACK) {
+ Log.i(LOGTAG, "Trying to open BACK camera");
+ Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
+ for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
+ Camera.getCameraInfo( camIdx, cameraInfo );
+ if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
+ localCameraIndex = camIdx;
+ break;
+ }
+ }
+ } else if (mCameraIndex == CameraBridgeViewBase.CAMERA_ID_FRONT) {
+ Log.i(LOGTAG, "Trying to open FRONT camera");
+ Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
+ for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
+ Camera.getCameraInfo( camIdx, cameraInfo );
+ if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
+ localCameraIndex = camIdx;
+ break;
+ }
+ }
+ }
+ if (localCameraIndex == CameraBridgeViewBase.CAMERA_ID_BACK) {
+ Log.e(LOGTAG, "Back camera not found!");
+ } else if (localCameraIndex == CameraBridgeViewBase.CAMERA_ID_FRONT) {
+ Log.e(LOGTAG, "Front camera not found!");
+ } else {
+ Log.d(LOGTAG, "Trying to open camera with new open(" + localCameraIndex + ")");
+ try {
+ mCamera = Camera.open(localCameraIndex);
+ } catch (RuntimeException e) {
+ Log.e(LOGTAG, "Camera #" + localCameraIndex + "failed to open: " + e.getLocalizedMessage());
+ }
+ }
+ }
+ }
+ if(mCamera == null) {
+ Log.e(LOGTAG, "Error: can't open camera");
+ return;
+ }
+ Camera.Parameters params = mCamera.getParameters();
+ List FocusModes = params.getSupportedFocusModes();
+ if (FocusModes != null && FocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO))
+ {
+ params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
+ }
+ mCamera.setParameters(params);
+
+ try {
+ mCamera.setPreviewTexture(mSTexture);
+ } catch (IOException ioe) {
+ Log.e(LOGTAG, "setPreviewTexture() failed: " + ioe.getMessage());
+ }
+ }
+
+ @Override
+ public synchronized void setCameraPreviewSize(int width, int height) {
+ Log.i(LOGTAG, "setCameraPreviewSize: "+width+"x"+height);
+ if(mCamera == null) {
+ Log.e(LOGTAG, "Camera isn't initialized!");
+ return;
+ }
+
+ if(mMaxCameraWidth > 0 && mMaxCameraWidth < width) width = mMaxCameraWidth;
+ if(mMaxCameraHeight > 0 && mMaxCameraHeight < height) height = mMaxCameraHeight;
+
+ Camera.Parameters param = mCamera.getParameters();
+ List psize = param.getSupportedPreviewSizes();
+ int bestWidth = 0, bestHeight = 0;
+ if (psize.size() > 0) {
+ float aspect = (float)width / height;
+ for (Size size : psize) {
+ int w = size.width, h = size.height;
+ Log.d(LOGTAG, "checking camera preview size: "+w+"x"+h);
+ if ( w <= width && h <= height &&
+ w >= bestWidth && h >= bestHeight &&
+ Math.abs(aspect - (float)w/h) < 0.2 ) {
+ bestWidth = w;
+ bestHeight = h;
+ }
+ }
+ if(bestWidth <= 0 || bestHeight <= 0) {
+ bestWidth = psize.get(0).width;
+ bestHeight = psize.get(0).height;
+ Log.e(LOGTAG, "Error: best size was not selected, using "+bestWidth+" x "+bestHeight);
+ } else {
+ Log.i(LOGTAG, "Selected best size: "+bestWidth+" x "+bestHeight);
+ }
+
+ if(mPreviewStarted) {
+ mCamera.stopPreview();
+ mPreviewStarted = false;
+ }
+ mCameraWidth = bestWidth;
+ mCameraHeight = bestHeight;
+ param.setPreviewSize(bestWidth, bestHeight);
+ }
+ param.set("orientation", "landscape");
+ mCamera.setParameters(param);
+ mCamera.startPreview();
+ mPreviewStarted = true;
+ }
+}
\ No newline at end of file
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/FpsMeter.java b/openCVLibrary3/src/main/java/org/opencv/android/FpsMeter.java
new file mode 100644
index 00000000000..88e826cf965
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/FpsMeter.java
@@ -0,0 +1,66 @@
+package org.opencv.android;
+
+import java.text.DecimalFormat;
+
+import org.opencv.core.Core;
+
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.util.Log;
+
+public class FpsMeter {
+ private static final String TAG = "FpsMeter";
+ private static final int STEP = 20;
+ private static final DecimalFormat FPS_FORMAT = new DecimalFormat("0.00");
+
+ private int mFramesCouner;
+ private double mFrequency;
+ private long mprevFrameTime;
+ private String mStrfps;
+ Paint mPaint;
+ boolean mIsInitialized = false;
+ int mWidth = 0;
+ int mHeight = 0;
+
+ public void init() {
+ mFramesCouner = 0;
+ mFrequency = Core.getTickFrequency();
+ mprevFrameTime = Core.getTickCount();
+ mStrfps = "";
+
+ mPaint = new Paint();
+ mPaint.setColor(Color.BLUE);
+ mPaint.setTextSize(20);
+ }
+
+ public void measure() {
+ if (!mIsInitialized) {
+ init();
+ mIsInitialized = true;
+ } else {
+ mFramesCouner++;
+ if (mFramesCouner % STEP == 0) {
+ long time = Core.getTickCount();
+ double fps = STEP * mFrequency / (time - mprevFrameTime);
+ mprevFrameTime = time;
+ if (mWidth != 0 && mHeight != 0)
+ mStrfps = FPS_FORMAT.format(fps) + " FPS@" + Integer.valueOf(mWidth) + "x" + Integer.valueOf(mHeight);
+ else
+ mStrfps = FPS_FORMAT.format(fps) + " FPS";
+ Log.i(TAG, mStrfps);
+ }
+ }
+ }
+
+ public void setResolution(int width, int height) {
+ mWidth = width;
+ mHeight = height;
+ }
+
+ public void draw(Canvas canvas, float offsetx, float offsety) {
+ Log.d(TAG, mStrfps);
+ canvas.drawText(mStrfps, offsetx, offsety, mPaint);
+ }
+
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/InstallCallbackInterface.java b/openCVLibrary3/src/main/java/org/opencv/android/InstallCallbackInterface.java
new file mode 100644
index 00000000000..f68027a7ba2
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/InstallCallbackInterface.java
@@ -0,0 +1,34 @@
+package org.opencv.android;
+
+/**
+ * Installation callback interface.
+ */
+public interface InstallCallbackInterface
+{
+ /**
+ * New package installation is required.
+ */
+ static final int NEW_INSTALLATION = 0;
+ /**
+ * Current package installation is in progress.
+ */
+ static final int INSTALLATION_PROGRESS = 1;
+
+ /**
+ * Target package name.
+ * @return Return target package name.
+ */
+ public String getPackageName();
+ /**
+ * Installation is approved.
+ */
+ public void install();
+ /**
+ * Installation is canceled.
+ */
+ public void cancel();
+ /**
+ * Wait for package installation.
+ */
+ public void wait_install();
+};
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/JavaCamera2View.java b/openCVLibrary3/src/main/java/org/opencv/android/JavaCamera2View.java
new file mode 100644
index 00000000000..2cf512f3215
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/JavaCamera2View.java
@@ -0,0 +1,374 @@
+package org.opencv.android;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.graphics.ImageFormat;
+import android.hardware.camera2.CameraAccessException;
+import android.hardware.camera2.CameraCaptureSession;
+import android.hardware.camera2.CameraCharacteristics;
+import android.hardware.camera2.CameraDevice;
+import android.hardware.camera2.CameraManager;
+import android.hardware.camera2.CaptureRequest;
+import android.hardware.camera2.params.StreamConfigurationMap;
+import android.media.Image;
+import android.media.ImageReader;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.Surface;
+import android.view.ViewGroup.LayoutParams;
+
+import org.opencv.core.CvType;
+import org.opencv.core.Mat;
+import org.opencv.imgproc.Imgproc;
+
+/**
+ * This class is an implementation of the Bridge View between OpenCV and Java Camera.
+ * This class relays on the functionality available in base class and only implements
+ * required functions:
+ * connectCamera - opens Java camera and sets the PreviewCallback to be delivered.
+ * disconnectCamera - closes the camera and stops preview.
+ * When frame is delivered via callback from Camera - it processed via OpenCV to be
+ * converted to RGBA32 and then passed to the external callback for modifications if required.
+ */
+
+@TargetApi(21)
+public class JavaCamera2View extends CameraBridgeViewBase {
+
+ private static final String LOGTAG = "JavaCamera2View";
+
+ private ImageReader mImageReader;
+ private int mPreviewFormat = ImageFormat.YUV_420_888;
+
+ private CameraDevice mCameraDevice;
+ private CameraCaptureSession mCaptureSession;
+ private CaptureRequest.Builder mPreviewRequestBuilder;
+ private String mCameraID;
+ private android.util.Size mPreviewSize = new android.util.Size(-1, -1);
+
+ private HandlerThread mBackgroundThread;
+ private Handler mBackgroundHandler;
+
+ public JavaCamera2View(Context context, int cameraId) {
+ super(context, cameraId);
+ }
+
+ public JavaCamera2View(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ private void startBackgroundThread() {
+ Log.i(LOGTAG, "startBackgroundThread");
+ stopBackgroundThread();
+ mBackgroundThread = new HandlerThread("OpenCVCameraBackground");
+ mBackgroundThread.start();
+ mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
+ }
+
+ private void stopBackgroundThread() {
+ Log.i(LOGTAG, "stopBackgroundThread");
+ if (mBackgroundThread == null)
+ return;
+ mBackgroundThread.quitSafely();
+ try {
+ mBackgroundThread.join();
+ mBackgroundThread = null;
+ mBackgroundHandler = null;
+ } catch (InterruptedException e) {
+ Log.e(LOGTAG, "stopBackgroundThread", e);
+ }
+ }
+
+ protected boolean initializeCamera() {
+ Log.i(LOGTAG, "initializeCamera");
+ CameraManager manager = (CameraManager) getContext().getSystemService(Context.CAMERA_SERVICE);
+ try {
+ String camList[] = manager.getCameraIdList();
+ if (camList.length == 0) {
+ Log.e(LOGTAG, "Error: camera isn't detected.");
+ return false;
+ }
+ if (mCameraIndex == CameraBridgeViewBase.CAMERA_ID_ANY) {
+ mCameraID = camList[0];
+ } else {
+ for (String cameraID : camList) {
+ CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraID);
+ if ((mCameraIndex == CameraBridgeViewBase.CAMERA_ID_BACK &&
+ characteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_BACK) ||
+ (mCameraIndex == CameraBridgeViewBase.CAMERA_ID_FRONT &&
+ characteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_FRONT)
+ ) {
+ mCameraID = cameraID;
+ break;
+ }
+ }
+ }
+ if (mCameraID != null) {
+ Log.i(LOGTAG, "Opening camera: " + mCameraID);
+ manager.openCamera(mCameraID, mStateCallback, mBackgroundHandler);
+ }
+ return true;
+ } catch (CameraAccessException e) {
+ Log.e(LOGTAG, "OpenCamera - Camera Access Exception", e);
+ } catch (IllegalArgumentException e) {
+ Log.e(LOGTAG, "OpenCamera - Illegal Argument Exception", e);
+ } catch (SecurityException e) {
+ Log.e(LOGTAG, "OpenCamera - Security Exception", e);
+ }
+ return false;
+ }
+
+ private final CameraDevice.StateCallback mStateCallback = new CameraDevice.StateCallback() {
+
+ @Override
+ public void onOpened(CameraDevice cameraDevice) {
+ mCameraDevice = cameraDevice;
+ createCameraPreviewSession();
+ }
+
+ @Override
+ public void onDisconnected(CameraDevice cameraDevice) {
+ cameraDevice.close();
+ mCameraDevice = null;
+ }
+
+ @Override
+ public void onError(CameraDevice cameraDevice, int error) {
+ cameraDevice.close();
+ mCameraDevice = null;
+ }
+
+ };
+
+ private void createCameraPreviewSession() {
+ final int w = mPreviewSize.getWidth(), h = mPreviewSize.getHeight();
+ Log.i(LOGTAG, "createCameraPreviewSession(" + w + "x" + h + ")");
+ if (w < 0 || h < 0)
+ return;
+ try {
+ if (null == mCameraDevice) {
+ Log.e(LOGTAG, "createCameraPreviewSession: camera isn't opened");
+ return;
+ }
+ if (null != mCaptureSession) {
+ Log.e(LOGTAG, "createCameraPreviewSession: mCaptureSession is already started");
+ return;
+ }
+
+ mImageReader = ImageReader.newInstance(w, h, mPreviewFormat, 2);
+ mImageReader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() {
+ @Override
+ public void onImageAvailable(ImageReader reader) {
+ Image image = reader.acquireLatestImage();
+ if (image == null)
+ return;
+
+ // sanity checks - 3 planes
+ Image.Plane[] planes = image.getPlanes();
+ assert (planes.length == 3);
+ assert (image.getFormat() == mPreviewFormat);
+
+ // see also https://developer.android.com/reference/android/graphics/ImageFormat.html#YUV_420_888
+ // Y plane (0) non-interleaved => stride == 1; U/V plane interleaved => stride == 2
+ assert (planes[0].getPixelStride() == 1);
+ assert (planes[1].getPixelStride() == 2);
+ assert (planes[2].getPixelStride() == 2);
+
+ ByteBuffer y_plane = planes[0].getBuffer();
+ ByteBuffer uv_plane = planes[1].getBuffer();
+ Mat y_mat = new Mat(h, w, CvType.CV_8UC1, y_plane);
+ Mat uv_mat = new Mat(h / 2, w / 2, CvType.CV_8UC2, uv_plane);
+ JavaCamera2Frame tempFrame = new JavaCamera2Frame(y_mat, uv_mat, w, h);
+ deliverAndDrawFrame(tempFrame);
+ tempFrame.release();
+ image.close();
+ }
+ }, mBackgroundHandler);
+ Surface surface = mImageReader.getSurface();
+
+ mPreviewRequestBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
+ mPreviewRequestBuilder.addTarget(surface);
+
+ mCameraDevice.createCaptureSession(Arrays.asList(surface),
+ new CameraCaptureSession.StateCallback() {
+ @Override
+ public void onConfigured(CameraCaptureSession cameraCaptureSession) {
+ Log.i(LOGTAG, "createCaptureSession::onConfigured");
+ if (null == mCameraDevice) {
+ return; // camera is already closed
+ }
+ mCaptureSession = cameraCaptureSession;
+ try {
+ mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,
+ CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
+ mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE,
+ CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
+
+ mCaptureSession.setRepeatingRequest(mPreviewRequestBuilder.build(), null, mBackgroundHandler);
+ Log.i(LOGTAG, "CameraPreviewSession has been started");
+ } catch (Exception e) {
+ Log.e(LOGTAG, "createCaptureSession failed", e);
+ }
+ }
+
+ @Override
+ public void onConfigureFailed(CameraCaptureSession cameraCaptureSession) {
+ Log.e(LOGTAG, "createCameraPreviewSession failed");
+ }
+ },
+ null
+ );
+ } catch (CameraAccessException e) {
+ Log.e(LOGTAG, "createCameraPreviewSession", e);
+ }
+ }
+
+ @Override
+ protected void disconnectCamera() {
+ Log.i(LOGTAG, "closeCamera");
+ try {
+ CameraDevice c = mCameraDevice;
+ mCameraDevice = null;
+ if (null != mCaptureSession) {
+ mCaptureSession.close();
+ mCaptureSession = null;
+ }
+ if (null != c) {
+ c.close();
+ }
+ if (null != mImageReader) {
+ mImageReader.close();
+ mImageReader = null;
+ }
+ } finally {
+ stopBackgroundThread();
+ }
+ }
+
+ boolean calcPreviewSize(final int width, final int height) {
+ Log.i(LOGTAG, "calcPreviewSize: " + width + "x" + height);
+ if (mCameraID == null) {
+ Log.e(LOGTAG, "Camera isn't initialized!");
+ return false;
+ }
+ CameraManager manager = (CameraManager) getContext().getSystemService(Context.CAMERA_SERVICE);
+ try {
+ CameraCharacteristics characteristics = manager.getCameraCharacteristics(mCameraID);
+ StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
+ int bestWidth = 0, bestHeight = 0;
+ float aspect = (float) width / height;
+ android.util.Size[] sizes = map.getOutputSizes(ImageReader.class);
+ bestWidth = sizes[0].getWidth();
+ bestHeight = sizes[0].getHeight();
+ for (android.util.Size sz : sizes) {
+ int w = sz.getWidth(), h = sz.getHeight();
+ Log.d(LOGTAG, "trying size: " + w + "x" + h);
+ if (width >= w && height >= h && bestWidth <= w && bestHeight <= h
+ && Math.abs(aspect - (float) w / h) < 0.2) {
+ bestWidth = w;
+ bestHeight = h;
+ }
+ }
+ Log.i(LOGTAG, "best size: " + bestWidth + "x" + bestHeight);
+ assert(!(bestWidth == 0 || bestHeight == 0));
+ if (mPreviewSize.getWidth() == bestWidth && mPreviewSize.getHeight() == bestHeight)
+ return false;
+ else {
+ mPreviewSize = new android.util.Size(bestWidth, bestHeight);
+ return true;
+ }
+ } catch (CameraAccessException e) {
+ Log.e(LOGTAG, "calcPreviewSize - Camera Access Exception", e);
+ } catch (IllegalArgumentException e) {
+ Log.e(LOGTAG, "calcPreviewSize - Illegal Argument Exception", e);
+ } catch (SecurityException e) {
+ Log.e(LOGTAG, "calcPreviewSize - Security Exception", e);
+ }
+ return false;
+ }
+
+ @Override
+ protected boolean connectCamera(int width, int height) {
+ Log.i(LOGTAG, "setCameraPreviewSize(" + width + "x" + height + ")");
+ startBackgroundThread();
+ initializeCamera();
+ try {
+ boolean needReconfig = calcPreviewSize(width, height);
+ mFrameWidth = mPreviewSize.getWidth();
+ mFrameHeight = mPreviewSize.getHeight();
+
+ if ((getLayoutParams().width == LayoutParams.MATCH_PARENT) && (getLayoutParams().height == LayoutParams.MATCH_PARENT))
+ mScale = Math.min(((float)height)/mFrameHeight, ((float)width)/mFrameWidth);
+ else
+ mScale = 0;
+
+ AllocateCache();
+
+ if (needReconfig) {
+ if (null != mCaptureSession) {
+ Log.d(LOGTAG, "closing existing previewSession");
+ mCaptureSession.close();
+ mCaptureSession = null;
+ }
+ createCameraPreviewSession();
+ }
+ } catch (RuntimeException e) {
+ throw new RuntimeException("Interrupted while setCameraPreviewSize.", e);
+ }
+ return true;
+ }
+
+ private class JavaCamera2Frame implements CvCameraViewFrame {
+ @Override
+ public Mat gray() {
+ return mYuvFrameData.submat(0, mHeight, 0, mWidth);
+ }
+
+ @Override
+ public Mat rgba() {
+ if (mPreviewFormat == ImageFormat.NV21)
+ Imgproc.cvtColor(mYuvFrameData, mRgba, Imgproc.COLOR_YUV2RGBA_NV21, 4);
+ else if (mPreviewFormat == ImageFormat.YV12)
+ Imgproc.cvtColor(mYuvFrameData, mRgba, Imgproc.COLOR_YUV2RGB_I420, 4); // COLOR_YUV2RGBA_YV12 produces inverted colors
+ else if (mPreviewFormat == ImageFormat.YUV_420_888) {
+ assert (mUVFrameData != null);
+ Imgproc.cvtColorTwoPlane(mYuvFrameData, mUVFrameData, mRgba, Imgproc.COLOR_YUV2RGBA_NV21);
+ } else
+ throw new IllegalArgumentException("Preview Format can be NV21 or YV12");
+
+ return mRgba;
+ }
+
+ public JavaCamera2Frame(Mat Yuv420sp, int width, int height) {
+ super();
+ mWidth = width;
+ mHeight = height;
+ mYuvFrameData = Yuv420sp;
+ mUVFrameData = null;
+ mRgba = new Mat();
+ }
+
+ public JavaCamera2Frame(Mat Y, Mat UV, int width, int height) {
+ super();
+ mWidth = width;
+ mHeight = height;
+ mYuvFrameData = Y;
+ mUVFrameData = UV;
+ mRgba = new Mat();
+ }
+
+ public void release() {
+ mRgba.release();
+ }
+
+ private Mat mYuvFrameData;
+ private Mat mUVFrameData;
+ private Mat mRgba;
+ private int mWidth;
+ private int mHeight;
+ };
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/JavaCameraView.java b/openCVLibrary3/src/main/java/org/opencv/android/JavaCameraView.java
new file mode 100644
index 00000000000..a7c72e43f00
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/JavaCameraView.java
@@ -0,0 +1,379 @@
+package org.opencv.android;
+
+import java.util.List;
+
+import android.content.Context;
+import android.graphics.ImageFormat;
+import android.graphics.SurfaceTexture;
+import android.hardware.Camera;
+import android.hardware.Camera.PreviewCallback;
+import android.os.Build;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.ViewGroup.LayoutParams;
+
+import org.opencv.BuildConfig;
+import org.opencv.core.CvType;
+import org.opencv.core.Mat;
+import org.opencv.core.Size;
+import org.opencv.imgproc.Imgproc;
+
+/**
+ * This class is an implementation of the Bridge View between OpenCV and Java Camera.
+ * This class relays on the functionality available in base class and only implements
+ * required functions:
+ * connectCamera - opens Java camera and sets the PreviewCallback to be delivered.
+ * disconnectCamera - closes the camera and stops preview.
+ * When frame is delivered via callback from Camera - it processed via OpenCV to be
+ * converted to RGBA32 and then passed to the external callback for modifications if required.
+ */
+public class JavaCameraView extends CameraBridgeViewBase implements PreviewCallback {
+
+ private static final int MAGIC_TEXTURE_ID = 10;
+ private static final String TAG = "JavaCameraView";
+
+ private byte mBuffer[];
+ private Mat[] mFrameChain;
+ private int mChainIdx = 0;
+ private Thread mThread;
+ private boolean mStopThread;
+
+ protected Camera mCamera;
+ protected JavaCameraFrame[] mCameraFrame;
+ private SurfaceTexture mSurfaceTexture;
+ private int mPreviewFormat = ImageFormat.NV21;
+
+ public static class JavaCameraSizeAccessor implements ListItemAccessor {
+
+ @Override
+ public int getWidth(Object obj) {
+ Camera.Size size = (Camera.Size) obj;
+ return size.width;
+ }
+
+ @Override
+ public int getHeight(Object obj) {
+ Camera.Size size = (Camera.Size) obj;
+ return size.height;
+ }
+ }
+
+ public JavaCameraView(Context context, int cameraId) {
+ super(context, cameraId);
+ }
+
+ public JavaCameraView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ protected boolean initializeCamera(int width, int height) {
+ Log.d(TAG, "Initialize java camera");
+ boolean result = true;
+ synchronized (this) {
+ mCamera = null;
+
+ if (mCameraIndex == CAMERA_ID_ANY) {
+ Log.d(TAG, "Trying to open camera with old open()");
+ try {
+ mCamera = Camera.open();
+ }
+ catch (Exception e){
+ Log.e(TAG, "Camera is not available (in use or does not exist): " + e.getLocalizedMessage());
+ }
+
+ if(mCamera == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
+ boolean connected = false;
+ for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
+ Log.d(TAG, "Trying to open camera with new open(" + Integer.valueOf(camIdx) + ")");
+ try {
+ mCamera = Camera.open(camIdx);
+ connected = true;
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Camera #" + camIdx + "failed to open: " + e.getLocalizedMessage());
+ }
+ if (connected) break;
+ }
+ }
+ } else {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
+ int localCameraIndex = mCameraIndex;
+ if (mCameraIndex == CAMERA_ID_BACK) {
+ Log.i(TAG, "Trying to open back camera");
+ Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
+ for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
+ Camera.getCameraInfo( camIdx, cameraInfo );
+ if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
+ localCameraIndex = camIdx;
+ break;
+ }
+ }
+ } else if (mCameraIndex == CAMERA_ID_FRONT) {
+ Log.i(TAG, "Trying to open front camera");
+ Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
+ for (int camIdx = 0; camIdx < Camera.getNumberOfCameras(); ++camIdx) {
+ Camera.getCameraInfo( camIdx, cameraInfo );
+ if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
+ localCameraIndex = camIdx;
+ break;
+ }
+ }
+ }
+ if (localCameraIndex == CAMERA_ID_BACK) {
+ Log.e(TAG, "Back camera not found!");
+ } else if (localCameraIndex == CAMERA_ID_FRONT) {
+ Log.e(TAG, "Front camera not found!");
+ } else {
+ Log.d(TAG, "Trying to open camera with new open(" + Integer.valueOf(localCameraIndex) + ")");
+ try {
+ mCamera = Camera.open(localCameraIndex);
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Camera #" + localCameraIndex + "failed to open: " + e.getLocalizedMessage());
+ }
+ }
+ }
+ }
+
+ if (mCamera == null)
+ return false;
+
+ /* Now set camera parameters */
+ try {
+ Camera.Parameters params = mCamera.getParameters();
+ Log.d(TAG, "getSupportedPreviewSizes()");
+ List sizes = params.getSupportedPreviewSizes();
+
+ if (sizes != null) {
+ /* Select the size that fits surface considering maximum size allowed */
+ Size frameSize = calculateCameraFrameSize(sizes, new JavaCameraSizeAccessor(), width, height);
+
+ /* Image format NV21 causes issues in the Android emulators */
+ if (Build.FINGERPRINT.startsWith("generic")
+ || Build.FINGERPRINT.startsWith("unknown")
+ || Build.MODEL.contains("google_sdk")
+ || Build.MODEL.contains("Emulator")
+ || Build.MODEL.contains("Android SDK built for x86")
+ || Build.MANUFACTURER.contains("Genymotion")
+ || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
+ || "google_sdk".equals(Build.PRODUCT))
+ params.setPreviewFormat(ImageFormat.YV12); // "generic" or "android" = android emulator
+ else
+ params.setPreviewFormat(ImageFormat.NV21);
+
+ mPreviewFormat = params.getPreviewFormat();
+
+ Log.d(TAG, "Set preview size to " + Integer.valueOf((int)frameSize.width) + "x" + Integer.valueOf((int)frameSize.height));
+ params.setPreviewSize((int)frameSize.width, (int)frameSize.height);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && !android.os.Build.MODEL.equals("GT-I9100"))
+ params.setRecordingHint(true);
+
+ List FocusModes = params.getSupportedFocusModes();
+ if (FocusModes != null && FocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO))
+ {
+ params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
+ }
+
+ mCamera.setParameters(params);
+ params = mCamera.getParameters();
+
+ mFrameWidth = params.getPreviewSize().width;
+ mFrameHeight = params.getPreviewSize().height;
+
+ if ((getLayoutParams().width == LayoutParams.MATCH_PARENT) && (getLayoutParams().height == LayoutParams.MATCH_PARENT))
+ mScale = Math.min(((float)height)/mFrameHeight, ((float)width)/mFrameWidth);
+ else
+ mScale = 0;
+
+ if (mFpsMeter != null) {
+ mFpsMeter.setResolution(mFrameWidth, mFrameHeight);
+ }
+
+ int size = mFrameWidth * mFrameHeight;
+ size = size * ImageFormat.getBitsPerPixel(params.getPreviewFormat()) / 8;
+ mBuffer = new byte[size];
+
+ mCamera.addCallbackBuffer(mBuffer);
+ mCamera.setPreviewCallbackWithBuffer(this);
+
+ mFrameChain = new Mat[2];
+ mFrameChain[0] = new Mat(mFrameHeight + (mFrameHeight/2), mFrameWidth, CvType.CV_8UC1);
+ mFrameChain[1] = new Mat(mFrameHeight + (mFrameHeight/2), mFrameWidth, CvType.CV_8UC1);
+
+ AllocateCache();
+
+ mCameraFrame = new JavaCameraFrame[2];
+ mCameraFrame[0] = new JavaCameraFrame(mFrameChain[0], mFrameWidth, mFrameHeight);
+ mCameraFrame[1] = new JavaCameraFrame(mFrameChain[1], mFrameWidth, mFrameHeight);
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ mSurfaceTexture = new SurfaceTexture(MAGIC_TEXTURE_ID);
+ mCamera.setPreviewTexture(mSurfaceTexture);
+ } else
+ mCamera.setPreviewDisplay(null);
+
+ /* Finally we are ready to start the preview */
+ Log.d(TAG, "startPreview");
+ mCamera.startPreview();
+ }
+ else
+ result = false;
+ } catch (Exception e) {
+ result = false;
+ e.printStackTrace();
+ }
+ }
+
+ return result;
+ }
+
+ protected void releaseCamera() {
+ synchronized (this) {
+ if (mCamera != null) {
+ mCamera.stopPreview();
+ mCamera.setPreviewCallback(null);
+
+ mCamera.release();
+ }
+ mCamera = null;
+ if (mFrameChain != null) {
+ mFrameChain[0].release();
+ mFrameChain[1].release();
+ }
+ if (mCameraFrame != null) {
+ mCameraFrame[0].release();
+ mCameraFrame[1].release();
+ }
+ }
+ }
+
+ private boolean mCameraFrameReady = false;
+
+ @Override
+ protected boolean connectCamera(int width, int height) {
+
+ /* 1. We need to instantiate camera
+ * 2. We need to start thread which will be getting frames
+ */
+ /* First step - initialize camera connection */
+ Log.d(TAG, "Connecting to camera");
+ if (!initializeCamera(width, height))
+ return false;
+
+ mCameraFrameReady = false;
+
+ /* now we can start update thread */
+ Log.d(TAG, "Starting processing thread");
+ mStopThread = false;
+ mThread = new Thread(new CameraWorker());
+ mThread.start();
+
+ return true;
+ }
+
+ @Override
+ protected void disconnectCamera() {
+ /* 1. We need to stop thread which updating the frames
+ * 2. Stop camera and release it
+ */
+ Log.d(TAG, "Disconnecting from camera");
+ try {
+ mStopThread = true;
+ Log.d(TAG, "Notify thread");
+ synchronized (this) {
+ this.notify();
+ }
+ Log.d(TAG, "Waiting for thread");
+ if (mThread != null)
+ mThread.join();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } finally {
+ mThread = null;
+ }
+
+ /* Now release camera */
+ releaseCamera();
+
+ mCameraFrameReady = false;
+ }
+
+ @Override
+ public void onPreviewFrame(byte[] frame, Camera arg1) {
+ if (BuildConfig.DEBUG)
+ Log.d(TAG, "Preview Frame received. Frame size: " + frame.length);
+ synchronized (this) {
+ mFrameChain[mChainIdx].put(0, 0, frame);
+ mCameraFrameReady = true;
+ this.notify();
+ }
+ if (mCamera != null)
+ mCamera.addCallbackBuffer(mBuffer);
+ }
+
+ private class JavaCameraFrame implements CvCameraViewFrame {
+ @Override
+ public Mat gray() {
+ return mYuvFrameData.submat(0, mHeight, 0, mWidth);
+ }
+
+ @Override
+ public Mat rgba() {
+ if (mPreviewFormat == ImageFormat.NV21)
+ Imgproc.cvtColor(mYuvFrameData, mRgba, Imgproc.COLOR_YUV2RGBA_NV21, 4);
+ else if (mPreviewFormat == ImageFormat.YV12)
+ Imgproc.cvtColor(mYuvFrameData, mRgba, Imgproc.COLOR_YUV2RGB_I420, 4); // COLOR_YUV2RGBA_YV12 produces inverted colors
+ else
+ throw new IllegalArgumentException("Preview Format can be NV21 or YV12");
+
+ return mRgba;
+ }
+
+ public JavaCameraFrame(Mat Yuv420sp, int width, int height) {
+ super();
+ mWidth = width;
+ mHeight = height;
+ mYuvFrameData = Yuv420sp;
+ mRgba = new Mat();
+ }
+
+ public void release() {
+ mRgba.release();
+ }
+
+ private Mat mYuvFrameData;
+ private Mat mRgba;
+ private int mWidth;
+ private int mHeight;
+ };
+
+ private class CameraWorker implements Runnable {
+
+ @Override
+ public void run() {
+ do {
+ boolean hasFrame = false;
+ synchronized (JavaCameraView.this) {
+ try {
+ while (!mCameraFrameReady && !mStopThread) {
+ JavaCameraView.this.wait();
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ if (mCameraFrameReady)
+ {
+ mChainIdx = 1 - mChainIdx;
+ mCameraFrameReady = false;
+ hasFrame = true;
+ }
+ }
+
+ if (!mStopThread && hasFrame) {
+ if (!mFrameChain[1 - mChainIdx].empty())
+ deliverAndDrawFrame(mCameraFrame[1 - mChainIdx]);
+ }
+ } while (!mStopThread);
+ Log.d(TAG, "Finish processing thread");
+ }
+ }
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/LoaderCallbackInterface.java b/openCVLibrary3/src/main/java/org/opencv/android/LoaderCallbackInterface.java
new file mode 100644
index 00000000000..a941e8377b6
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/LoaderCallbackInterface.java
@@ -0,0 +1,40 @@
+package org.opencv.android;
+
+/**
+ * Interface for callback object in case of asynchronous initialization of OpenCV.
+ */
+public interface LoaderCallbackInterface
+{
+ /**
+ * OpenCV initialization finished successfully.
+ */
+ static final int SUCCESS = 0;
+ /**
+ * Google Play Market cannot be invoked.
+ */
+ static final int MARKET_ERROR = 2;
+ /**
+ * OpenCV library installation has been canceled by the user.
+ */
+ static final int INSTALL_CANCELED = 3;
+ /**
+ * This version of OpenCV Manager Service is incompatible with the app. Possibly, a service update is required.
+ */
+ static final int INCOMPATIBLE_MANAGER_VERSION = 4;
+ /**
+ * OpenCV library initialization has failed.
+ */
+ static final int INIT_FAILED = 0xff;
+
+ /**
+ * Callback method, called after OpenCV library initialization.
+ * @param status status of initialization (see initialization status constants).
+ */
+ public void onManagerConnected(int status);
+
+ /**
+ * Callback method, called in case the package installation is needed.
+ * @param callback answer object with approve and cancel methods and the package description.
+ */
+ public void onPackageInstall(final int operation, InstallCallbackInterface callback);
+};
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/OpenCVLoader.java b/openCVLibrary3/src/main/java/org/opencv/android/OpenCVLoader.java
new file mode 100644
index 00000000000..27932505dda
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/OpenCVLoader.java
@@ -0,0 +1,132 @@
+package org.opencv.android;
+
+import android.content.Context;
+
+/**
+ * Helper class provides common initialization methods for OpenCV library.
+ */
+public class OpenCVLoader
+{
+ /**
+ * OpenCV Library version 2.4.2.
+ */
+ public static final String OPENCV_VERSION_2_4_2 = "2.4.2";
+
+ /**
+ * OpenCV Library version 2.4.3.
+ */
+ public static final String OPENCV_VERSION_2_4_3 = "2.4.3";
+
+ /**
+ * OpenCV Library version 2.4.4.
+ */
+ public static final String OPENCV_VERSION_2_4_4 = "2.4.4";
+
+ /**
+ * OpenCV Library version 2.4.5.
+ */
+ public static final String OPENCV_VERSION_2_4_5 = "2.4.5";
+
+ /**
+ * OpenCV Library version 2.4.6.
+ */
+ public static final String OPENCV_VERSION_2_4_6 = "2.4.6";
+
+ /**
+ * OpenCV Library version 2.4.7.
+ */
+ public static final String OPENCV_VERSION_2_4_7 = "2.4.7";
+
+ /**
+ * OpenCV Library version 2.4.8.
+ */
+ public static final String OPENCV_VERSION_2_4_8 = "2.4.8";
+
+ /**
+ * OpenCV Library version 2.4.9.
+ */
+ public static final String OPENCV_VERSION_2_4_9 = "2.4.9";
+
+ /**
+ * OpenCV Library version 2.4.10.
+ */
+ public static final String OPENCV_VERSION_2_4_10 = "2.4.10";
+
+ /**
+ * OpenCV Library version 2.4.11.
+ */
+ public static final String OPENCV_VERSION_2_4_11 = "2.4.11";
+
+ /**
+ * OpenCV Library version 2.4.12.
+ */
+ public static final String OPENCV_VERSION_2_4_12 = "2.4.12";
+
+ /**
+ * OpenCV Library version 2.4.13.
+ */
+ public static final String OPENCV_VERSION_2_4_13 = "2.4.13";
+
+ /**
+ * OpenCV Library version 3.0.0.
+ */
+ public static final String OPENCV_VERSION_3_0_0 = "3.0.0";
+
+ /**
+ * OpenCV Library version 3.1.0.
+ */
+ public static final String OPENCV_VERSION_3_1_0 = "3.1.0";
+
+ /**
+ * OpenCV Library version 3.2.0.
+ */
+ public static final String OPENCV_VERSION_3_2_0 = "3.2.0";
+
+ /**
+ * OpenCV Library version 3.3.0.
+ */
+ public static final String OPENCV_VERSION_3_3_0 = "3.3.0";
+
+ /**
+ * OpenCV Library version 3.4.0.
+ */
+ public static final String OPENCV_VERSION_3_4_0 = "3.4.0";
+
+ /**
+ * Current OpenCV Library version
+ */
+ public static final String OPENCV_VERSION = "3.4.3";
+
+
+ /**
+ * Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
+ * @return Returns true is initialization of OpenCV was successful.
+ */
+ public static boolean initDebug()
+ {
+ return StaticHelper.initOpenCV(false);
+ }
+
+ /**
+ * Loads and initializes OpenCV library from current application package. Roughly, it's an analog of system.loadLibrary("opencv_java").
+ * @param InitCuda load and initialize CUDA runtime libraries.
+ * @return Returns true is initialization of OpenCV was successful.
+ */
+ public static boolean initDebug(boolean InitCuda)
+ {
+ return StaticHelper.initOpenCV(InitCuda);
+ }
+
+ /**
+ * Loads and initializes OpenCV library using OpenCV Engine service.
+ * @param Version OpenCV library version.
+ * @param AppContext application context for connecting to the service.
+ * @param Callback object, that implements LoaderCallbackInterface for handling the connection status.
+ * @return Returns true if initialization of OpenCV is successful.
+ */
+ public static boolean initAsync(String Version, Context AppContext,
+ LoaderCallbackInterface Callback)
+ {
+ return AsyncServiceHelper.initOpenCV(Version, AppContext, Callback);
+ }
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/StaticHelper.java b/openCVLibrary3/src/main/java/org/opencv/android/StaticHelper.java
new file mode 100644
index 00000000000..f670d933e6d
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/StaticHelper.java
@@ -0,0 +1,104 @@
+package org.opencv.android;
+
+import org.opencv.core.Core;
+
+import java.util.StringTokenizer;
+import android.util.Log;
+
+class StaticHelper {
+
+ public static boolean initOpenCV(boolean InitCuda)
+ {
+ boolean result;
+ String libs = "";
+
+ if(InitCuda)
+ {
+ loadLibrary("cudart");
+ loadLibrary("nppc");
+ loadLibrary("nppi");
+ loadLibrary("npps");
+ loadLibrary("cufft");
+ loadLibrary("cublas");
+ }
+
+ Log.d(TAG, "Trying to get library list");
+
+ try
+ {
+ System.loadLibrary("opencv_info");
+ libs = getLibraryList();
+ }
+ catch(UnsatisfiedLinkError e)
+ {
+ Log.e(TAG, "OpenCV error: Cannot load info library for OpenCV");
+ }
+
+ Log.d(TAG, "Library list: \"" + libs + "\"");
+ Log.d(TAG, "First attempt to load libs");
+ if (initOpenCVLibs(libs))
+ {
+ Log.d(TAG, "First attempt to load libs is OK");
+ String eol = System.getProperty("line.separator");
+ for (String str : Core.getBuildInformation().split(eol))
+ Log.i(TAG, str);
+
+ result = true;
+ }
+ else
+ {
+ Log.d(TAG, "First attempt to load libs fails");
+ result = false;
+ }
+
+ return result;
+ }
+
+ private static boolean loadLibrary(String Name)
+ {
+ boolean result = true;
+
+ Log.d(TAG, "Trying to load library " + Name);
+ try
+ {
+ System.loadLibrary(Name);
+ Log.d(TAG, "Library " + Name + " loaded");
+ }
+ catch(UnsatisfiedLinkError e)
+ {
+ Log.d(TAG, "Cannot load library \"" + Name + "\"");
+ e.printStackTrace();
+ result = false;
+ }
+
+ return result;
+ }
+
+ private static boolean initOpenCVLibs(String Libs)
+ {
+ Log.d(TAG, "Trying to init OpenCV libs");
+
+ boolean result = true;
+
+ if ((null != Libs) && (Libs.length() != 0))
+ {
+ Log.d(TAG, "Trying to load libs by dependency list");
+ StringTokenizer splitter = new StringTokenizer(Libs, ";");
+ while(splitter.hasMoreTokens())
+ {
+ result &= loadLibrary(splitter.nextToken());
+ }
+ }
+ else
+ {
+ // If dependencies list is not defined or empty.
+ result = loadLibrary("opencv_java3");
+ }
+
+ return result;
+ }
+
+ private static final String TAG = "OpenCV/StaticHelper";
+
+ private static native String getLibraryList();
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/android/Utils.java b/openCVLibrary3/src/main/java/org/opencv/android/Utils.java
new file mode 100644
index 00000000000..404c986da80
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/android/Utils.java
@@ -0,0 +1,139 @@
+package org.opencv.android;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+
+import org.opencv.core.CvException;
+import org.opencv.core.CvType;
+import org.opencv.core.Mat;
+import org.opencv.imgcodecs.Imgcodecs;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class Utils {
+
+ public static String exportResource(Context context, int resourceId) {
+ return exportResource(context, resourceId, "OpenCV_data");
+ }
+
+ public static String exportResource(Context context, int resourceId, String dirname) {
+ String fullname = context.getResources().getString(resourceId);
+ String resName = fullname.substring(fullname.lastIndexOf("/") + 1);
+ try {
+ InputStream is = context.getResources().openRawResource(resourceId);
+ File resDir = context.getDir(dirname, Context.MODE_PRIVATE);
+ File resFile = new File(resDir, resName);
+
+ FileOutputStream os = new FileOutputStream(resFile);
+
+ byte[] buffer = new byte[4096];
+ int bytesRead;
+ while ((bytesRead = is.read(buffer)) != -1) {
+ os.write(buffer, 0, bytesRead);
+ }
+ is.close();
+ os.close();
+
+ return resFile.getAbsolutePath();
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new CvException("Failed to export resource " + resName
+ + ". Exception thrown: " + e);
+ }
+ }
+
+ public static Mat loadResource(Context context, int resourceId) throws IOException
+ {
+ return loadResource(context, resourceId, -1);
+ }
+
+ public static Mat loadResource(Context context, int resourceId, int flags) throws IOException
+ {
+ InputStream is = context.getResources().openRawResource(resourceId);
+ ByteArrayOutputStream os = new ByteArrayOutputStream(is.available());
+
+ byte[] buffer = new byte[4096];
+ int bytesRead;
+ while ((bytesRead = is.read(buffer)) != -1) {
+ os.write(buffer, 0, bytesRead);
+ }
+ is.close();
+
+ Mat encoded = new Mat(1, os.size(), CvType.CV_8U);
+ encoded.put(0, 0, os.toByteArray());
+ os.close();
+
+ Mat decoded = Imgcodecs.imdecode(encoded, flags);
+ encoded.release();
+
+ return decoded;
+ }
+
+ /**
+ * Converts Android Bitmap to OpenCV Mat.
+ *
+ * This function converts an Android Bitmap image to the OpenCV Mat.
+ *
'ARGB_8888' and 'RGB_565' input Bitmap formats are supported.
+ *
The output Mat is always created of the same size as the input Bitmap and of the 'CV_8UC4' type,
+ * it keeps the image in RGBA format.
+ *
This function throws an exception if the conversion fails.
+ * @param bmp is a valid input Bitmap object of the type 'ARGB_8888' or 'RGB_565'.
+ * @param mat is a valid output Mat object, it will be reallocated if needed, so it may be empty.
+ * @param unPremultiplyAlpha is a flag, that determines, whether the bitmap needs to be converted from alpha premultiplied format (like Android keeps 'ARGB_8888' ones) to regular one; this flag is ignored for 'RGB_565' bitmaps.
+ */
+ public static void bitmapToMat(Bitmap bmp, Mat mat, boolean unPremultiplyAlpha) {
+ if (bmp == null)
+ throw new java.lang.IllegalArgumentException("bmp == null");
+ if (mat == null)
+ throw new java.lang.IllegalArgumentException("mat == null");
+ nBitmapToMat2(bmp, mat.nativeObj, unPremultiplyAlpha);
+ }
+
+ /**
+ * Short form of the bitmapToMat(bmp, mat, unPremultiplyAlpha=false).
+ * @param bmp is a valid input Bitmap object of the type 'ARGB_8888' or 'RGB_565'.
+ * @param mat is a valid output Mat object, it will be reallocated if needed, so Mat may be empty.
+ */
+ public static void bitmapToMat(Bitmap bmp, Mat mat) {
+ bitmapToMat(bmp, mat, false);
+ }
+
+
+ /**
+ * Converts OpenCV Mat to Android Bitmap.
+ *
+ *
This function converts an image in the OpenCV Mat representation to the Android Bitmap.
+ *
The input Mat object has to be of the types 'CV_8UC1' (gray-scale), 'CV_8UC3' (RGB) or 'CV_8UC4' (RGBA).
+ *
The output Bitmap object has to be of the same size as the input Mat and of the types 'ARGB_8888' or 'RGB_565'.
+ *
This function throws an exception if the conversion fails.
+ *
+ * @param mat is a valid input Mat object of types 'CV_8UC1', 'CV_8UC3' or 'CV_8UC4'.
+ * @param bmp is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.
+ * @param premultiplyAlpha is a flag, that determines, whether the Mat needs to be converted to alpha premultiplied format (like Android keeps 'ARGB_8888' bitmaps); the flag is ignored for 'RGB_565' bitmaps.
+ */
+ public static void matToBitmap(Mat mat, Bitmap bmp, boolean premultiplyAlpha) {
+ if (mat == null)
+ throw new java.lang.IllegalArgumentException("mat == null");
+ if (bmp == null)
+ throw new java.lang.IllegalArgumentException("bmp == null");
+ nMatToBitmap2(mat.nativeObj, bmp, premultiplyAlpha);
+ }
+
+ /**
+ * Short form of the matToBitmap(mat, bmp, premultiplyAlpha=false)
+ * @param mat is a valid input Mat object of the types 'CV_8UC1', 'CV_8UC3' or 'CV_8UC4'.
+ * @param bmp is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.
+ */
+ public static void matToBitmap(Mat mat, Bitmap bmp) {
+ matToBitmap(mat, bmp, false);
+ }
+
+
+ private static native void nBitmapToMat2(Bitmap b, long m_addr, boolean unPremultiplyAlpha);
+
+ private static native void nMatToBitmap2(long m_addr, Bitmap b, boolean premultiplyAlpha);
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/calib3d/Calib3d.java b/openCVLibrary3/src/main/java/org/opencv/calib3d/Calib3d.java
new file mode 100644
index 00000000000..72668419a13
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/calib3d/Calib3d.java
@@ -0,0 +1,2233 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.calib3d;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfDouble;
+import org.opencv.core.MatOfPoint2f;
+import org.opencv.core.MatOfPoint3f;
+import org.opencv.core.Point;
+import org.opencv.core.Rect;
+import org.opencv.core.Size;
+import org.opencv.core.TermCriteria;
+import org.opencv.utils.Converters;
+
+// C++: class Calib3d
+//javadoc: Calib3d
+
+public class Calib3d {
+
+ public static final int
+ CALIB_USE_INTRINSIC_GUESS = 1,
+ CALIB_RECOMPUTE_EXTRINSIC = 2,
+ CALIB_CHECK_COND = 4,
+ CALIB_FIX_SKEW = 8,
+ CALIB_FIX_K1 = 16,
+ CALIB_FIX_K2 = 32,
+ CALIB_FIX_K3 = 64,
+ CALIB_FIX_K4 = 128,
+ CALIB_FIX_INTRINSIC = 256,
+ CV_ITERATIVE = 0,
+ CV_EPNP = 1,
+ CV_P3P = 2,
+ CV_DLS = 3,
+ LMEDS = 4,
+ RANSAC = 8,
+ RHO = 16,
+ SOLVEPNP_ITERATIVE = 0,
+ SOLVEPNP_EPNP = 1,
+ SOLVEPNP_P3P = 2,
+ SOLVEPNP_DLS = 3,
+ SOLVEPNP_UPNP = 4,
+ SOLVEPNP_AP3P = 5,
+ SOLVEPNP_MAX_COUNT = 5+1,
+ CALIB_CB_ADAPTIVE_THRESH = 1,
+ CALIB_CB_NORMALIZE_IMAGE = 2,
+ CALIB_CB_FILTER_QUADS = 4,
+ CALIB_CB_FAST_CHECK = 8,
+ CALIB_CB_SYMMETRIC_GRID = 1,
+ CALIB_CB_ASYMMETRIC_GRID = 2,
+ CALIB_CB_CLUSTERING = 4,
+ CALIB_FIX_ASPECT_RATIO = 0x00002,
+ CALIB_FIX_PRINCIPAL_POINT = 0x00004,
+ CALIB_ZERO_TANGENT_DIST = 0x00008,
+ CALIB_FIX_FOCAL_LENGTH = 0x00010,
+ CALIB_FIX_K5 = 0x01000,
+ CALIB_FIX_K6 = 0x02000,
+ CALIB_RATIONAL_MODEL = 0x04000,
+ CALIB_THIN_PRISM_MODEL = 0x08000,
+ CALIB_FIX_S1_S2_S3_S4 = 0x10000,
+ CALIB_TILTED_MODEL = 0x40000,
+ CALIB_FIX_TAUX_TAUY = 0x80000,
+ CALIB_USE_QR = 0x100000,
+ CALIB_FIX_TANGENT_DIST = 0x200000,
+ CALIB_SAME_FOCAL_LENGTH = 0x00200,
+ CALIB_ZERO_DISPARITY = 0x00400,
+ CALIB_USE_LU = (1 << 17),
+ CALIB_USE_EXTRINSIC_GUESS = (1 << 22),
+ FM_7POINT = 1,
+ FM_8POINT = 2,
+ FM_LMEDS = 4,
+ FM_RANSAC = 8,
+ fisheye_CALIB_USE_INTRINSIC_GUESS = 1 << 0,
+ fisheye_CALIB_RECOMPUTE_EXTRINSIC = 1 << 1,
+ fisheye_CALIB_CHECK_COND = 1 << 2,
+ fisheye_CALIB_FIX_SKEW = 1 << 3,
+ fisheye_CALIB_FIX_K1 = 1 << 4,
+ fisheye_CALIB_FIX_K2 = 1 << 5,
+ fisheye_CALIB_FIX_K3 = 1 << 6,
+ fisheye_CALIB_FIX_K4 = 1 << 7,
+ fisheye_CALIB_FIX_INTRINSIC = 1 << 8,
+ fisheye_CALIB_FIX_PRINCIPAL_POINT = 1 << 9;
+
+
+ //
+ // C++: Mat cv::estimateAffine2D(Mat from, Mat to, Mat& inliers = Mat(), int method = RANSAC, double ransacReprojThreshold = 3, size_t maxIters = 2000, double confidence = 0.99, size_t refineIters = 10)
+ //
+
+ //javadoc: estimateAffine2D(from, to, inliers, method, ransacReprojThreshold, maxIters, confidence, refineIters)
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters, double confidence, long refineIters)
+ {
+
+ Mat retVal = new Mat(estimateAffine2D_0(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters, confidence, refineIters));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffine2D(from, to, inliers, method, ransacReprojThreshold, maxIters, confidence)
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters, double confidence)
+ {
+
+ Mat retVal = new Mat(estimateAffine2D_1(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters, confidence));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffine2D(from, to, inliers, method, ransacReprojThreshold, maxIters)
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters)
+ {
+
+ Mat retVal = new Mat(estimateAffine2D_2(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffine2D(from, to, inliers, method, ransacReprojThreshold)
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold)
+ {
+
+ Mat retVal = new Mat(estimateAffine2D_3(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffine2D(from, to, inliers, method)
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers, int method)
+ {
+
+ Mat retVal = new Mat(estimateAffine2D_4(from.nativeObj, to.nativeObj, inliers.nativeObj, method));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffine2D(from, to, inliers)
+ public static Mat estimateAffine2D(Mat from, Mat to, Mat inliers)
+ {
+
+ Mat retVal = new Mat(estimateAffine2D_5(from.nativeObj, to.nativeObj, inliers.nativeObj));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffine2D(from, to)
+ public static Mat estimateAffine2D(Mat from, Mat to)
+ {
+
+ Mat retVal = new Mat(estimateAffine2D_6(from.nativeObj, to.nativeObj));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Mat cv::estimateAffinePartial2D(Mat from, Mat to, Mat& inliers = Mat(), int method = RANSAC, double ransacReprojThreshold = 3, size_t maxIters = 2000, double confidence = 0.99, size_t refineIters = 10)
+ //
+
+ //javadoc: estimateAffinePartial2D(from, to, inliers, method, ransacReprojThreshold, maxIters, confidence, refineIters)
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters, double confidence, long refineIters)
+ {
+
+ Mat retVal = new Mat(estimateAffinePartial2D_0(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters, confidence, refineIters));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffinePartial2D(from, to, inliers, method, ransacReprojThreshold, maxIters, confidence)
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters, double confidence)
+ {
+
+ Mat retVal = new Mat(estimateAffinePartial2D_1(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters, confidence));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffinePartial2D(from, to, inliers, method, ransacReprojThreshold, maxIters)
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold, long maxIters)
+ {
+
+ Mat retVal = new Mat(estimateAffinePartial2D_2(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold, maxIters));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffinePartial2D(from, to, inliers, method, ransacReprojThreshold)
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers, int method, double ransacReprojThreshold)
+ {
+
+ Mat retVal = new Mat(estimateAffinePartial2D_3(from.nativeObj, to.nativeObj, inliers.nativeObj, method, ransacReprojThreshold));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffinePartial2D(from, to, inliers, method)
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers, int method)
+ {
+
+ Mat retVal = new Mat(estimateAffinePartial2D_4(from.nativeObj, to.nativeObj, inliers.nativeObj, method));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffinePartial2D(from, to, inliers)
+ public static Mat estimateAffinePartial2D(Mat from, Mat to, Mat inliers)
+ {
+
+ Mat retVal = new Mat(estimateAffinePartial2D_5(from.nativeObj, to.nativeObj, inliers.nativeObj));
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffinePartial2D(from, to)
+ public static Mat estimateAffinePartial2D(Mat from, Mat to)
+ {
+
+ Mat retVal = new Mat(estimateAffinePartial2D_6(from.nativeObj, to.nativeObj));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Mat cv::findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method = RANSAC, double prob = 0.999, double threshold = 1.0, Mat& mask = Mat())
+ //
+
+ //javadoc: findEssentialMat(points1, points2, cameraMatrix, method, prob, threshold, mask)
+ public static Mat findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method, double prob, double threshold, Mat mask)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_0(points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, method, prob, threshold, mask.nativeObj));
+
+ return retVal;
+ }
+
+ //javadoc: findEssentialMat(points1, points2, cameraMatrix, method, prob, threshold)
+ public static Mat findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method, double prob, double threshold)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_1(points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, method, prob, threshold));
+
+ return retVal;
+ }
+
+ //javadoc: findEssentialMat(points1, points2, cameraMatrix, method, prob)
+ public static Mat findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method, double prob)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_2(points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, method, prob));
+
+ return retVal;
+ }
+
+ //javadoc: findEssentialMat(points1, points2, cameraMatrix, method)
+ public static Mat findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_3(points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, method));
+
+ return retVal;
+ }
+
+ //javadoc: findEssentialMat(points1, points2, cameraMatrix)
+ public static Mat findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_4(points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Mat cv::findEssentialMat(Mat points1, Mat points2, double focal = 1.0, Point2d pp = Point2d(0, 0), int method = RANSAC, double prob = 0.999, double threshold = 1.0, Mat& mask = Mat())
+ //
+
+ //javadoc: findEssentialMat(points1, points2, focal, pp, method, prob, threshold, mask)
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal, Point pp, int method, double prob, double threshold, Mat mask)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_5(points1.nativeObj, points2.nativeObj, focal, pp.x, pp.y, method, prob, threshold, mask.nativeObj));
+
+ return retVal;
+ }
+
+ //javadoc: findEssentialMat(points1, points2, focal, pp, method, prob, threshold)
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal, Point pp, int method, double prob, double threshold)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_6(points1.nativeObj, points2.nativeObj, focal, pp.x, pp.y, method, prob, threshold));
+
+ return retVal;
+ }
+
+ //javadoc: findEssentialMat(points1, points2, focal, pp, method, prob)
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal, Point pp, int method, double prob)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_7(points1.nativeObj, points2.nativeObj, focal, pp.x, pp.y, method, prob));
+
+ return retVal;
+ }
+
+ //javadoc: findEssentialMat(points1, points2, focal, pp, method)
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal, Point pp, int method)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_8(points1.nativeObj, points2.nativeObj, focal, pp.x, pp.y, method));
+
+ return retVal;
+ }
+
+ //javadoc: findEssentialMat(points1, points2, focal, pp)
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal, Point pp)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_9(points1.nativeObj, points2.nativeObj, focal, pp.x, pp.y));
+
+ return retVal;
+ }
+
+ //javadoc: findEssentialMat(points1, points2, focal)
+ public static Mat findEssentialMat(Mat points1, Mat points2, double focal)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_10(points1.nativeObj, points2.nativeObj, focal));
+
+ return retVal;
+ }
+
+ //javadoc: findEssentialMat(points1, points2)
+ public static Mat findEssentialMat(Mat points1, Mat points2)
+ {
+
+ Mat retVal = new Mat(findEssentialMat_11(points1.nativeObj, points2.nativeObj));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Mat cv::findFundamentalMat(vector_Point2f points1, vector_Point2f points2, int method = FM_RANSAC, double ransacReprojThreshold = 3., double confidence = 0.99, Mat& mask = Mat())
+ //
+
+ //javadoc: findFundamentalMat(points1, points2, method, ransacReprojThreshold, confidence, mask)
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2, int method, double ransacReprojThreshold, double confidence, Mat mask)
+ {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ Mat retVal = new Mat(findFundamentalMat_0(points1_mat.nativeObj, points2_mat.nativeObj, method, ransacReprojThreshold, confidence, mask.nativeObj));
+
+ return retVal;
+ }
+
+ //javadoc: findFundamentalMat(points1, points2, method, ransacReprojThreshold, confidence)
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2, int method, double ransacReprojThreshold, double confidence)
+ {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ Mat retVal = new Mat(findFundamentalMat_1(points1_mat.nativeObj, points2_mat.nativeObj, method, ransacReprojThreshold, confidence));
+
+ return retVal;
+ }
+
+ //javadoc: findFundamentalMat(points1, points2, method, ransacReprojThreshold)
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2, int method, double ransacReprojThreshold)
+ {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ Mat retVal = new Mat(findFundamentalMat_2(points1_mat.nativeObj, points2_mat.nativeObj, method, ransacReprojThreshold));
+
+ return retVal;
+ }
+
+ //javadoc: findFundamentalMat(points1, points2, method)
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2, int method)
+ {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ Mat retVal = new Mat(findFundamentalMat_3(points1_mat.nativeObj, points2_mat.nativeObj, method));
+
+ return retVal;
+ }
+
+ //javadoc: findFundamentalMat(points1, points2)
+ public static Mat findFundamentalMat(MatOfPoint2f points1, MatOfPoint2f points2)
+ {
+ Mat points1_mat = points1;
+ Mat points2_mat = points2;
+ Mat retVal = new Mat(findFundamentalMat_4(points1_mat.nativeObj, points2_mat.nativeObj));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Mat cv::findHomography(vector_Point2f srcPoints, vector_Point2f dstPoints, int method = 0, double ransacReprojThreshold = 3, Mat& mask = Mat(), int maxIters = 2000, double confidence = 0.995)
+ //
+
+ //javadoc: findHomography(srcPoints, dstPoints, method, ransacReprojThreshold, mask, maxIters, confidence)
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints, int method, double ransacReprojThreshold, Mat mask, int maxIters, double confidence)
+ {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ Mat retVal = new Mat(findHomography_0(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj, method, ransacReprojThreshold, mask.nativeObj, maxIters, confidence));
+
+ return retVal;
+ }
+
+ //javadoc: findHomography(srcPoints, dstPoints, method, ransacReprojThreshold, mask, maxIters)
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints, int method, double ransacReprojThreshold, Mat mask, int maxIters)
+ {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ Mat retVal = new Mat(findHomography_1(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj, method, ransacReprojThreshold, mask.nativeObj, maxIters));
+
+ return retVal;
+ }
+
+ //javadoc: findHomography(srcPoints, dstPoints, method, ransacReprojThreshold, mask)
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints, int method, double ransacReprojThreshold, Mat mask)
+ {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ Mat retVal = new Mat(findHomography_2(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj, method, ransacReprojThreshold, mask.nativeObj));
+
+ return retVal;
+ }
+
+ //javadoc: findHomography(srcPoints, dstPoints, method, ransacReprojThreshold)
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints, int method, double ransacReprojThreshold)
+ {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ Mat retVal = new Mat(findHomography_3(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj, method, ransacReprojThreshold));
+
+ return retVal;
+ }
+
+ //javadoc: findHomography(srcPoints, dstPoints, method)
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints, int method)
+ {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ Mat retVal = new Mat(findHomography_4(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj, method));
+
+ return retVal;
+ }
+
+ //javadoc: findHomography(srcPoints, dstPoints)
+ public static Mat findHomography(MatOfPoint2f srcPoints, MatOfPoint2f dstPoints)
+ {
+ Mat srcPoints_mat = srcPoints;
+ Mat dstPoints_mat = dstPoints;
+ Mat retVal = new Mat(findHomography_5(srcPoints_mat.nativeObj, dstPoints_mat.nativeObj));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Mat cv::getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Size newImgSize = Size(), Rect* validPixROI = 0, bool centerPrincipalPoint = false)
+ //
+
+ //javadoc: getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha, newImgSize, validPixROI, centerPrincipalPoint)
+ public static Mat getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Size newImgSize, Rect validPixROI, boolean centerPrincipalPoint)
+ {
+ double[] validPixROI_out = new double[4];
+ Mat retVal = new Mat(getOptimalNewCameraMatrix_0(cameraMatrix.nativeObj, distCoeffs.nativeObj, imageSize.width, imageSize.height, alpha, newImgSize.width, newImgSize.height, validPixROI_out, centerPrincipalPoint));
+ if(validPixROI!=null){ validPixROI.x = (int)validPixROI_out[0]; validPixROI.y = (int)validPixROI_out[1]; validPixROI.width = (int)validPixROI_out[2]; validPixROI.height = (int)validPixROI_out[3]; }
+ return retVal;
+ }
+
+ //javadoc: getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha, newImgSize, validPixROI)
+ public static Mat getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Size newImgSize, Rect validPixROI)
+ {
+ double[] validPixROI_out = new double[4];
+ Mat retVal = new Mat(getOptimalNewCameraMatrix_1(cameraMatrix.nativeObj, distCoeffs.nativeObj, imageSize.width, imageSize.height, alpha, newImgSize.width, newImgSize.height, validPixROI_out));
+ if(validPixROI!=null){ validPixROI.x = (int)validPixROI_out[0]; validPixROI.y = (int)validPixROI_out[1]; validPixROI.width = (int)validPixROI_out[2]; validPixROI.height = (int)validPixROI_out[3]; }
+ return retVal;
+ }
+
+ //javadoc: getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha, newImgSize)
+ public static Mat getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Size newImgSize)
+ {
+
+ Mat retVal = new Mat(getOptimalNewCameraMatrix_2(cameraMatrix.nativeObj, distCoeffs.nativeObj, imageSize.width, imageSize.height, alpha, newImgSize.width, newImgSize.height));
+
+ return retVal;
+ }
+
+ //javadoc: getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, alpha)
+ public static Mat getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha)
+ {
+
+ Mat retVal = new Mat(getOptimalNewCameraMatrix_3(cameraMatrix.nativeObj, distCoeffs.nativeObj, imageSize.width, imageSize.height, alpha));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Mat cv::initCameraMatrix2D(vector_vector_Point3f objectPoints, vector_vector_Point2f imagePoints, Size imageSize, double aspectRatio = 1.0)
+ //
+
+ //javadoc: initCameraMatrix2D(objectPoints, imagePoints, imageSize, aspectRatio)
+ public static Mat initCameraMatrix2D(List objectPoints, List imagePoints, Size imageSize, double aspectRatio)
+ {
+ List objectPoints_tmplm = new ArrayList((objectPoints != null) ? objectPoints.size() : 0);
+ Mat objectPoints_mat = Converters.vector_vector_Point3f_to_Mat(objectPoints, objectPoints_tmplm);
+ List imagePoints_tmplm = new ArrayList((imagePoints != null) ? imagePoints.size() : 0);
+ Mat imagePoints_mat = Converters.vector_vector_Point2f_to_Mat(imagePoints, imagePoints_tmplm);
+ Mat retVal = new Mat(initCameraMatrix2D_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, aspectRatio));
+
+ return retVal;
+ }
+
+ //javadoc: initCameraMatrix2D(objectPoints, imagePoints, imageSize)
+ public static Mat initCameraMatrix2D(List objectPoints, List imagePoints, Size imageSize)
+ {
+ List objectPoints_tmplm = new ArrayList((objectPoints != null) ? objectPoints.size() : 0);
+ Mat objectPoints_mat = Converters.vector_vector_Point3f_to_Mat(objectPoints, objectPoints_tmplm);
+ List imagePoints_tmplm = new ArrayList((imagePoints != null) ? imagePoints.size() : 0);
+ Mat imagePoints_mat = Converters.vector_vector_Point2f_to_Mat(imagePoints, imagePoints_tmplm);
+ Mat retVal = new Mat(initCameraMatrix2D_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Rect cv::getValidDisparityROI(Rect roi1, Rect roi2, int minDisparity, int numberOfDisparities, int SADWindowSize)
+ //
+
+ //javadoc: getValidDisparityROI(roi1, roi2, minDisparity, numberOfDisparities, SADWindowSize)
+ public static Rect getValidDisparityROI(Rect roi1, Rect roi2, int minDisparity, int numberOfDisparities, int SADWindowSize)
+ {
+
+ Rect retVal = new Rect(getValidDisparityROI_0(roi1.x, roi1.y, roi1.width, roi1.height, roi2.x, roi2.y, roi2.width, roi2.height, minDisparity, numberOfDisparities, SADWindowSize));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Vec3d cv::RQDecomp3x3(Mat src, Mat& mtxR, Mat& mtxQ, Mat& Qx = Mat(), Mat& Qy = Mat(), Mat& Qz = Mat())
+ //
+
+ //javadoc: RQDecomp3x3(src, mtxR, mtxQ, Qx, Qy, Qz)
+ public static double[] RQDecomp3x3(Mat src, Mat mtxR, Mat mtxQ, Mat Qx, Mat Qy, Mat Qz)
+ {
+
+ double[] retVal = RQDecomp3x3_0(src.nativeObj, mtxR.nativeObj, mtxQ.nativeObj, Qx.nativeObj, Qy.nativeObj, Qz.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: RQDecomp3x3(src, mtxR, mtxQ, Qx, Qy)
+ public static double[] RQDecomp3x3(Mat src, Mat mtxR, Mat mtxQ, Mat Qx, Mat Qy)
+ {
+
+ double[] retVal = RQDecomp3x3_1(src.nativeObj, mtxR.nativeObj, mtxQ.nativeObj, Qx.nativeObj, Qy.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: RQDecomp3x3(src, mtxR, mtxQ, Qx)
+ public static double[] RQDecomp3x3(Mat src, Mat mtxR, Mat mtxQ, Mat Qx)
+ {
+
+ double[] retVal = RQDecomp3x3_2(src.nativeObj, mtxR.nativeObj, mtxQ.nativeObj, Qx.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: RQDecomp3x3(src, mtxR, mtxQ)
+ public static double[] RQDecomp3x3(Mat src, Mat mtxR, Mat mtxQ)
+ {
+
+ double[] retVal = RQDecomp3x3_3(src.nativeObj, mtxR.nativeObj, mtxQ.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: bool cv::findChessboardCorners(Mat image, Size patternSize, vector_Point2f& corners, int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE)
+ //
+
+ //javadoc: findChessboardCorners(image, patternSize, corners, flags)
+ public static boolean findChessboardCorners(Mat image, Size patternSize, MatOfPoint2f corners, int flags)
+ {
+ Mat corners_mat = corners;
+ boolean retVal = findChessboardCorners_0(image.nativeObj, patternSize.width, patternSize.height, corners_mat.nativeObj, flags);
+
+ return retVal;
+ }
+
+ //javadoc: findChessboardCorners(image, patternSize, corners)
+ public static boolean findChessboardCorners(Mat image, Size patternSize, MatOfPoint2f corners)
+ {
+ Mat corners_mat = corners;
+ boolean retVal = findChessboardCorners_1(image.nativeObj, patternSize.width, patternSize.height, corners_mat.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: bool cv::findCirclesGrid(Mat image, Size patternSize, Mat& centers, int flags, Ptr_FeatureDetector blobDetector, CirclesGridFinderParameters parameters)
+ //
+
+ // Unknown type 'Ptr_FeatureDetector' (I), skipping the function
+
+
+ //
+ // C++: bool cv::findCirclesGrid(Mat image, Size patternSize, Mat& centers, int flags = CALIB_CB_SYMMETRIC_GRID, Ptr_FeatureDetector blobDetector = SimpleBlobDetector::create())
+ //
+
+ //javadoc: findCirclesGrid(image, patternSize, centers, flags)
+ public static boolean findCirclesGrid(Mat image, Size patternSize, Mat centers, int flags)
+ {
+
+ boolean retVal = findCirclesGrid_0(image.nativeObj, patternSize.width, patternSize.height, centers.nativeObj, flags);
+
+ return retVal;
+ }
+
+ //javadoc: findCirclesGrid(image, patternSize, centers)
+ public static boolean findCirclesGrid(Mat image, Size patternSize, Mat centers)
+ {
+
+ boolean retVal = findCirclesGrid_2(image.nativeObj, patternSize.width, patternSize.height, centers.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: bool cv::findCirclesGrid2(Mat image, Size patternSize, Mat& centers, int flags, Ptr_FeatureDetector blobDetector, CirclesGridFinderParameters2 parameters)
+ //
+
+ // Unknown type 'Ptr_FeatureDetector' (I), skipping the function
+
+
+ //
+ // C++: bool cv::solvePnP(vector_Point3f objectPoints, vector_Point2f imagePoints, Mat cameraMatrix, vector_double distCoeffs, Mat& rvec, Mat& tvec, bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE)
+ //
+
+ //javadoc: solvePnP(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, flags)
+ public static boolean solvePnP(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int flags)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ boolean retVal = solvePnP_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, flags);
+
+ return retVal;
+ }
+
+ //javadoc: solvePnP(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess)
+ public static boolean solvePnP(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ boolean retVal = solvePnP_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess);
+
+ return retVal;
+ }
+
+ //javadoc: solvePnP(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec)
+ public static boolean solvePnP(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ boolean retVal = solvePnP_2(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: bool cv::solvePnPRansac(vector_Point3f objectPoints, vector_Point2f imagePoints, Mat cameraMatrix, vector_double distCoeffs, Mat& rvec, Mat& tvec, bool useExtrinsicGuess = false, int iterationsCount = 100, float reprojectionError = 8.0, double confidence = 0.99, Mat& inliers = Mat(), int flags = SOLVEPNP_ITERATIVE)
+ //
+
+ //javadoc: solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, iterationsCount, reprojectionError, confidence, inliers, flags)
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, Mat inliers, int flags)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ boolean retVal = solvePnPRansac_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, iterationsCount, reprojectionError, confidence, inliers.nativeObj, flags);
+
+ return retVal;
+ }
+
+ //javadoc: solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, iterationsCount, reprojectionError, confidence, inliers)
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, Mat inliers)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ boolean retVal = solvePnPRansac_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, iterationsCount, reprojectionError, confidence, inliers.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, iterationsCount, reprojectionError, confidence)
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ boolean retVal = solvePnPRansac_2(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, iterationsCount, reprojectionError, confidence);
+
+ return retVal;
+ }
+
+ //javadoc: solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, iterationsCount, reprojectionError)
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ boolean retVal = solvePnPRansac_3(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, iterationsCount, reprojectionError);
+
+ return retVal;
+ }
+
+ //javadoc: solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, iterationsCount)
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess, int iterationsCount)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ boolean retVal = solvePnPRansac_4(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess, iterationsCount);
+
+ return retVal;
+ }
+
+ //javadoc: solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess)
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec, boolean useExtrinsicGuess)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ boolean retVal = solvePnPRansac_5(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, useExtrinsicGuess);
+
+ return retVal;
+ }
+
+ //javadoc: solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec)
+ public static boolean solvePnPRansac(MatOfPoint3f objectPoints, MatOfPoint2f imagePoints, Mat cameraMatrix, MatOfDouble distCoeffs, Mat rvec, Mat tvec)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat imagePoints_mat = imagePoints;
+ Mat distCoeffs_mat = distCoeffs;
+ boolean retVal = solvePnPRansac_6(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, rvec.nativeObj, tvec.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: bool cv::stereoRectifyUncalibrated(Mat points1, Mat points2, Mat F, Size imgSize, Mat& H1, Mat& H2, double threshold = 5)
+ //
+
+ //javadoc: stereoRectifyUncalibrated(points1, points2, F, imgSize, H1, H2, threshold)
+ public static boolean stereoRectifyUncalibrated(Mat points1, Mat points2, Mat F, Size imgSize, Mat H1, Mat H2, double threshold)
+ {
+
+ boolean retVal = stereoRectifyUncalibrated_0(points1.nativeObj, points2.nativeObj, F.nativeObj, imgSize.width, imgSize.height, H1.nativeObj, H2.nativeObj, threshold);
+
+ return retVal;
+ }
+
+ //javadoc: stereoRectifyUncalibrated(points1, points2, F, imgSize, H1, H2)
+ public static boolean stereoRectifyUncalibrated(Mat points1, Mat points2, Mat F, Size imgSize, Mat H1, Mat H2)
+ {
+
+ boolean retVal = stereoRectifyUncalibrated_1(points1.nativeObj, points2.nativeObj, F.nativeObj, imgSize.width, imgSize.height, H1.nativeObj, H2.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::calibrateCamera(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, Mat& stdDeviationsIntrinsics, Mat& stdDeviationsExtrinsics, Mat& perViewErrors, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
+ //
+
+ //javadoc: calibrateCameraExtended(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, stdDeviationsIntrinsics, stdDeviationsExtrinsics, perViewErrors, flags, criteria)
+ public static double calibrateCameraExtended(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, Mat stdDeviationsIntrinsics, Mat stdDeviationsExtrinsics, Mat perViewErrors, int flags, TermCriteria criteria)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCameraExtended_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, stdDeviationsIntrinsics.nativeObj, stdDeviationsExtrinsics.nativeObj, perViewErrors.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ //javadoc: calibrateCameraExtended(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, stdDeviationsIntrinsics, stdDeviationsExtrinsics, perViewErrors, flags)
+ public static double calibrateCameraExtended(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, Mat stdDeviationsIntrinsics, Mat stdDeviationsExtrinsics, Mat perViewErrors, int flags)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCameraExtended_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, stdDeviationsIntrinsics.nativeObj, stdDeviationsExtrinsics.nativeObj, perViewErrors.nativeObj, flags);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ //javadoc: calibrateCameraExtended(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, stdDeviationsIntrinsics, stdDeviationsExtrinsics, perViewErrors)
+ public static double calibrateCameraExtended(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, Mat stdDeviationsIntrinsics, Mat stdDeviationsExtrinsics, Mat perViewErrors)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCameraExtended_2(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, stdDeviationsIntrinsics.nativeObj, stdDeviationsExtrinsics.nativeObj, perViewErrors.nativeObj);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::calibrateCamera(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
+ //
+
+ //javadoc: calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, flags, criteria)
+ public static double calibrateCamera(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, int flags, TermCriteria criteria)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCamera_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ //javadoc: calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, flags)
+ public static double calibrateCamera(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, int flags)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCamera_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, flags);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ //javadoc: calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs)
+ public static double calibrateCamera(List objectPoints, List imagePoints, Size imageSize, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = calibrateCamera_2(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, imageSize.width, imageSize.height, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::sampsonDistance(Mat pt1, Mat pt2, Mat F)
+ //
+
+ //javadoc: sampsonDistance(pt1, pt2, F)
+ public static double sampsonDistance(Mat pt1, Mat pt2, Mat F)
+ {
+
+ double retVal = sampsonDistance_0(pt1.nativeObj, pt2.nativeObj, F.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& cameraMatrix1, Mat& distCoeffs1, Mat& cameraMatrix2, Mat& distCoeffs2, Size imageSize, Mat& R, Mat& T, Mat& E, Mat& F, Mat& perViewErrors, int flags = CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
+ //
+
+ //javadoc: stereoCalibrateExtended(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, E, F, perViewErrors, flags, criteria)
+ public static double stereoCalibrateExtended(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, Mat perViewErrors, int flags, TermCriteria criteria)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ double retVal = stereoCalibrateExtended_0(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj, perViewErrors.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+
+ return retVal;
+ }
+
+ //javadoc: stereoCalibrateExtended(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, E, F, perViewErrors, flags)
+ public static double stereoCalibrateExtended(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, Mat perViewErrors, int flags)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ double retVal = stereoCalibrateExtended_1(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj, perViewErrors.nativeObj, flags);
+
+ return retVal;
+ }
+
+ //javadoc: stereoCalibrateExtended(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, E, F, perViewErrors)
+ public static double stereoCalibrateExtended(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, Mat perViewErrors)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ double retVal = stereoCalibrateExtended_2(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj, perViewErrors.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& cameraMatrix1, Mat& distCoeffs1, Mat& cameraMatrix2, Mat& distCoeffs2, Size imageSize, Mat& R, Mat& T, Mat& E, Mat& F, int flags = CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
+ //
+
+ //javadoc: stereoCalibrate(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, E, F, flags, criteria)
+ public static double stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, int flags, TermCriteria criteria)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ double retVal = stereoCalibrate_0(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+
+ return retVal;
+ }
+
+ //javadoc: stereoCalibrate(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, E, F, flags)
+ public static double stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F, int flags)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ double retVal = stereoCalibrate_1(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj, flags);
+
+ return retVal;
+ }
+
+ //javadoc: stereoCalibrate(objectPoints, imagePoints1, imagePoints2, cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, E, F)
+ public static double stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat E, Mat F)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ double retVal = stereoCalibrate_2(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, E.nativeObj, F.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::fisheye::calibrate(vector_Mat objectPoints, vector_Mat imagePoints, Size image_size, Mat& K, Mat& D, vector_Mat& rvecs, vector_Mat& tvecs, int flags = 0, TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON))
+ //
+
+ //javadoc: fisheye_calibrate(objectPoints, imagePoints, image_size, K, D, rvecs, tvecs, flags, criteria)
+ public static double fisheye_calibrate(List objectPoints, List imagePoints, Size image_size, Mat K, Mat D, List rvecs, List tvecs, int flags, TermCriteria criteria)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = fisheye_calibrate_0(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, image_size.width, image_size.height, K.nativeObj, D.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ //javadoc: fisheye_calibrate(objectPoints, imagePoints, image_size, K, D, rvecs, tvecs, flags)
+ public static double fisheye_calibrate(List objectPoints, List imagePoints, Size image_size, Mat K, Mat D, List rvecs, List tvecs, int flags)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = fisheye_calibrate_1(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, image_size.width, image_size.height, K.nativeObj, D.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, flags);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+ //javadoc: fisheye_calibrate(objectPoints, imagePoints, image_size, K, D, rvecs, tvecs)
+ public static double fisheye_calibrate(List objectPoints, List imagePoints, Size image_size, Mat K, Mat D, List rvecs, List tvecs)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints_mat = Converters.vector_Mat_to_Mat(imagePoints);
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ double retVal = fisheye_calibrate_2(objectPoints_mat.nativeObj, imagePoints_mat.nativeObj, image_size.width, image_size.height, K.nativeObj, D.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::fisheye::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& K1, Mat& D1, Mat& K2, Mat& D2, Size imageSize, Mat& R, Mat& T, int flags = fisheye::CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON))
+ //
+
+ //javadoc: fisheye_stereoCalibrate(objectPoints, imagePoints1, imagePoints2, K1, D1, K2, D2, imageSize, R, T, flags, criteria)
+ public static double fisheye_stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat T, int flags, TermCriteria criteria)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ double retVal = fisheye_stereoCalibrate_0(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, flags, criteria.type, criteria.maxCount, criteria.epsilon);
+
+ return retVal;
+ }
+
+ //javadoc: fisheye_stereoCalibrate(objectPoints, imagePoints1, imagePoints2, K1, D1, K2, D2, imageSize, R, T, flags)
+ public static double fisheye_stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat T, int flags)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ double retVal = fisheye_stereoCalibrate_1(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, flags);
+
+ return retVal;
+ }
+
+ //javadoc: fisheye_stereoCalibrate(objectPoints, imagePoints1, imagePoints2, K1, D1, K2, D2, imageSize, R, T)
+ public static double fisheye_stereoCalibrate(List objectPoints, List imagePoints1, List imagePoints2, Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat T)
+ {
+ Mat objectPoints_mat = Converters.vector_Mat_to_Mat(objectPoints);
+ Mat imagePoints1_mat = Converters.vector_Mat_to_Mat(imagePoints1);
+ Mat imagePoints2_mat = Converters.vector_Mat_to_Mat(imagePoints2);
+ double retVal = fisheye_stereoCalibrate_2(objectPoints_mat.nativeObj, imagePoints1_mat.nativeObj, imagePoints2_mat.nativeObj, K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: float cv::rectify3Collinear(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Mat cameraMatrix3, Mat distCoeffs3, vector_Mat imgpt1, vector_Mat imgpt3, Size imageSize, Mat R12, Mat T12, Mat R13, Mat T13, Mat& R1, Mat& R2, Mat& R3, Mat& P1, Mat& P2, Mat& P3, Mat& Q, double alpha, Size newImgSize, Rect* roi1, Rect* roi2, int flags)
+ //
+
+ //javadoc: rectify3Collinear(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, cameraMatrix3, distCoeffs3, imgpt1, imgpt3, imageSize, R12, T12, R13, T13, R1, R2, R3, P1, P2, P3, Q, alpha, newImgSize, roi1, roi2, flags)
+ public static float rectify3Collinear(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Mat cameraMatrix3, Mat distCoeffs3, List imgpt1, List imgpt3, Size imageSize, Mat R12, Mat T12, Mat R13, Mat T13, Mat R1, Mat R2, Mat R3, Mat P1, Mat P2, Mat P3, Mat Q, double alpha, Size newImgSize, Rect roi1, Rect roi2, int flags)
+ {
+ Mat imgpt1_mat = Converters.vector_Mat_to_Mat(imgpt1);
+ Mat imgpt3_mat = Converters.vector_Mat_to_Mat(imgpt3);
+ double[] roi1_out = new double[4];
+ double[] roi2_out = new double[4];
+ float retVal = rectify3Collinear_0(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, cameraMatrix3.nativeObj, distCoeffs3.nativeObj, imgpt1_mat.nativeObj, imgpt3_mat.nativeObj, imageSize.width, imageSize.height, R12.nativeObj, T12.nativeObj, R13.nativeObj, T13.nativeObj, R1.nativeObj, R2.nativeObj, R3.nativeObj, P1.nativeObj, P2.nativeObj, P3.nativeObj, Q.nativeObj, alpha, newImgSize.width, newImgSize.height, roi1_out, roi2_out, flags);
+ if(roi1!=null){ roi1.x = (int)roi1_out[0]; roi1.y = (int)roi1_out[1]; roi1.width = (int)roi1_out[2]; roi1.height = (int)roi1_out[3]; }
+ if(roi2!=null){ roi2.x = (int)roi2_out[0]; roi2.y = (int)roi2_out[1]; roi2.width = (int)roi2_out[2]; roi2.height = (int)roi2_out[3]; }
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::decomposeHomographyMat(Mat H, Mat K, vector_Mat& rotations, vector_Mat& translations, vector_Mat& normals)
+ //
+
+ //javadoc: decomposeHomographyMat(H, K, rotations, translations, normals)
+ public static int decomposeHomographyMat(Mat H, Mat K, List rotations, List translations, List normals)
+ {
+ Mat rotations_mat = new Mat();
+ Mat translations_mat = new Mat();
+ Mat normals_mat = new Mat();
+ int retVal = decomposeHomographyMat_0(H.nativeObj, K.nativeObj, rotations_mat.nativeObj, translations_mat.nativeObj, normals_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(rotations_mat, rotations);
+ rotations_mat.release();
+ Converters.Mat_to_vector_Mat(translations_mat, translations);
+ translations_mat.release();
+ Converters.Mat_to_vector_Mat(normals_mat, normals);
+ normals_mat.release();
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::estimateAffine3D(Mat src, Mat dst, Mat& out, Mat& inliers, double ransacThreshold = 3, double confidence = 0.99)
+ //
+
+ //javadoc: estimateAffine3D(src, dst, out, inliers, ransacThreshold, confidence)
+ public static int estimateAffine3D(Mat src, Mat dst, Mat out, Mat inliers, double ransacThreshold, double confidence)
+ {
+
+ int retVal = estimateAffine3D_0(src.nativeObj, dst.nativeObj, out.nativeObj, inliers.nativeObj, ransacThreshold, confidence);
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffine3D(src, dst, out, inliers, ransacThreshold)
+ public static int estimateAffine3D(Mat src, Mat dst, Mat out, Mat inliers, double ransacThreshold)
+ {
+
+ int retVal = estimateAffine3D_1(src.nativeObj, dst.nativeObj, out.nativeObj, inliers.nativeObj, ransacThreshold);
+
+ return retVal;
+ }
+
+ //javadoc: estimateAffine3D(src, dst, out, inliers)
+ public static int estimateAffine3D(Mat src, Mat dst, Mat out, Mat inliers)
+ {
+
+ int retVal = estimateAffine3D_2(src.nativeObj, dst.nativeObj, out.nativeObj, inliers.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat& R, Mat& t, double focal = 1.0, Point2d pp = Point2d(0, 0), Mat& mask = Mat())
+ //
+
+ //javadoc: recoverPose(E, points1, points2, R, t, focal, pp, mask)
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat R, Mat t, double focal, Point pp, Mat mask)
+ {
+
+ int retVal = recoverPose_0(E.nativeObj, points1.nativeObj, points2.nativeObj, R.nativeObj, t.nativeObj, focal, pp.x, pp.y, mask.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: recoverPose(E, points1, points2, R, t, focal, pp)
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat R, Mat t, double focal, Point pp)
+ {
+
+ int retVal = recoverPose_1(E.nativeObj, points1.nativeObj, points2.nativeObj, R.nativeObj, t.nativeObj, focal, pp.x, pp.y);
+
+ return retVal;
+ }
+
+ //javadoc: recoverPose(E, points1, points2, R, t, focal)
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat R, Mat t, double focal)
+ {
+
+ int retVal = recoverPose_2(E.nativeObj, points1.nativeObj, points2.nativeObj, R.nativeObj, t.nativeObj, focal);
+
+ return retVal;
+ }
+
+ //javadoc: recoverPose(E, points1, points2, R, t)
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat R, Mat t)
+ {
+
+ int retVal = recoverPose_3(E.nativeObj, points1.nativeObj, points2.nativeObj, R.nativeObj, t.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat& R, Mat& t, Mat& mask = Mat())
+ //
+
+ //javadoc: recoverPose(E, points1, points2, cameraMatrix, R, t, mask)
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat R, Mat t, Mat mask)
+ {
+
+ int retVal = recoverPose_4(E.nativeObj, points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, R.nativeObj, t.nativeObj, mask.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: recoverPose(E, points1, points2, cameraMatrix, R, t)
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat R, Mat t)
+ {
+
+ int retVal = recoverPose_5(E.nativeObj, points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, R.nativeObj, t.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat& R, Mat& t, double distanceThresh, Mat& mask = Mat(), Mat& triangulatedPoints = Mat())
+ //
+
+ //javadoc: recoverPose(E, points1, points2, cameraMatrix, R, t, distanceThresh, mask, triangulatedPoints)
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat R, Mat t, double distanceThresh, Mat mask, Mat triangulatedPoints)
+ {
+
+ int retVal = recoverPose_6(E.nativeObj, points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, R.nativeObj, t.nativeObj, distanceThresh, mask.nativeObj, triangulatedPoints.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: recoverPose(E, points1, points2, cameraMatrix, R, t, distanceThresh, mask)
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat R, Mat t, double distanceThresh, Mat mask)
+ {
+
+ int retVal = recoverPose_7(E.nativeObj, points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, R.nativeObj, t.nativeObj, distanceThresh, mask.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: recoverPose(E, points1, points2, cameraMatrix, R, t, distanceThresh)
+ public static int recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat R, Mat t, double distanceThresh)
+ {
+
+ int retVal = recoverPose_8(E.nativeObj, points1.nativeObj, points2.nativeObj, cameraMatrix.nativeObj, R.nativeObj, t.nativeObj, distanceThresh);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::solveP3P(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, int flags)
+ //
+
+ //javadoc: solveP3P(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvecs, tvecs, flags)
+ public static int solveP3P(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, List rvecs, List tvecs, int flags)
+ {
+ Mat rvecs_mat = new Mat();
+ Mat tvecs_mat = new Mat();
+ int retVal = solveP3P_0(objectPoints.nativeObj, imagePoints.nativeObj, cameraMatrix.nativeObj, distCoeffs.nativeObj, rvecs_mat.nativeObj, tvecs_mat.nativeObj, flags);
+ Converters.Mat_to_vector_Mat(rvecs_mat, rvecs);
+ rvecs_mat.release();
+ Converters.Mat_to_vector_Mat(tvecs_mat, tvecs);
+ tvecs_mat.release();
+ return retVal;
+ }
+
+
+ //
+ // C++: void cv::Rodrigues(Mat src, Mat& dst, Mat& jacobian = Mat())
+ //
+
+ //javadoc: Rodrigues(src, dst, jacobian)
+ public static void Rodrigues(Mat src, Mat dst, Mat jacobian)
+ {
+
+ Rodrigues_0(src.nativeObj, dst.nativeObj, jacobian.nativeObj);
+
+ return;
+ }
+
+ //javadoc: Rodrigues(src, dst)
+ public static void Rodrigues(Mat src, Mat dst)
+ {
+
+ Rodrigues_1(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::calibrationMatrixValues(Mat cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, double& fovx, double& fovy, double& focalLength, Point2d& principalPoint, double& aspectRatio)
+ //
+
+ //javadoc: calibrationMatrixValues(cameraMatrix, imageSize, apertureWidth, apertureHeight, fovx, fovy, focalLength, principalPoint, aspectRatio)
+ public static void calibrationMatrixValues(Mat cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, double[] fovx, double[] fovy, double[] focalLength, Point principalPoint, double[] aspectRatio)
+ {
+ double[] fovx_out = new double[1];
+ double[] fovy_out = new double[1];
+ double[] focalLength_out = new double[1];
+ double[] principalPoint_out = new double[2];
+ double[] aspectRatio_out = new double[1];
+ calibrationMatrixValues_0(cameraMatrix.nativeObj, imageSize.width, imageSize.height, apertureWidth, apertureHeight, fovx_out, fovy_out, focalLength_out, principalPoint_out, aspectRatio_out);
+ if(fovx!=null) fovx[0] = (double)fovx_out[0];
+ if(fovy!=null) fovy[0] = (double)fovy_out[0];
+ if(focalLength!=null) focalLength[0] = (double)focalLength_out[0];
+ if(principalPoint!=null){ principalPoint.x = principalPoint_out[0]; principalPoint.y = principalPoint_out[1]; }
+ if(aspectRatio!=null) aspectRatio[0] = (double)aspectRatio_out[0];
+ return;
+ }
+
+
+ //
+ // C++: void cv::composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat& rvec3, Mat& tvec3, Mat& dr3dr1 = Mat(), Mat& dr3dt1 = Mat(), Mat& dr3dr2 = Mat(), Mat& dr3dt2 = Mat(), Mat& dt3dr1 = Mat(), Mat& dt3dt1 = Mat(), Mat& dt3dr2 = Mat(), Mat& dt3dt2 = Mat())
+ //
+
+ //javadoc: composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1, dt3dr2, dt3dt2)
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2, Mat dr3dt2, Mat dt3dr1, Mat dt3dt1, Mat dt3dr2, Mat dt3dt2)
+ {
+
+ composeRT_0(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj, dr3dt2.nativeObj, dt3dr1.nativeObj, dt3dt1.nativeObj, dt3dr2.nativeObj, dt3dt2.nativeObj);
+
+ return;
+ }
+
+ //javadoc: composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1, dt3dr2)
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2, Mat dr3dt2, Mat dt3dr1, Mat dt3dt1, Mat dt3dr2)
+ {
+
+ composeRT_1(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj, dr3dt2.nativeObj, dt3dr1.nativeObj, dt3dt1.nativeObj, dt3dr2.nativeObj);
+
+ return;
+ }
+
+ //javadoc: composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1, dt3dt1)
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2, Mat dr3dt2, Mat dt3dr1, Mat dt3dt1)
+ {
+
+ composeRT_2(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj, dr3dt2.nativeObj, dt3dr1.nativeObj, dt3dt1.nativeObj);
+
+ return;
+ }
+
+ //javadoc: composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3, dr3dr1, dr3dt1, dr3dr2, dr3dt2, dt3dr1)
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2, Mat dr3dt2, Mat dt3dr1)
+ {
+
+ composeRT_3(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj, dr3dt2.nativeObj, dt3dr1.nativeObj);
+
+ return;
+ }
+
+ //javadoc: composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3, dr3dr1, dr3dt1, dr3dr2, dr3dt2)
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2, Mat dr3dt2)
+ {
+
+ composeRT_4(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj, dr3dt2.nativeObj);
+
+ return;
+ }
+
+ //javadoc: composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3, dr3dr1, dr3dt1, dr3dr2)
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1, Mat dr3dr2)
+ {
+
+ composeRT_5(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj, dr3dr2.nativeObj);
+
+ return;
+ }
+
+ //javadoc: composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3, dr3dr1, dr3dt1)
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1, Mat dr3dt1)
+ {
+
+ composeRT_6(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj, dr3dt1.nativeObj);
+
+ return;
+ }
+
+ //javadoc: composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3, dr3dr1)
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3, Mat dr3dr1)
+ {
+
+ composeRT_7(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj, dr3dr1.nativeObj);
+
+ return;
+ }
+
+ //javadoc: composeRT(rvec1, tvec1, rvec2, tvec2, rvec3, tvec3)
+ public static void composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat rvec3, Mat tvec3)
+ {
+
+ composeRT_8(rvec1.nativeObj, tvec1.nativeObj, rvec2.nativeObj, tvec2.nativeObj, rvec3.nativeObj, tvec3.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::computeCorrespondEpilines(Mat points, int whichImage, Mat F, Mat& lines)
+ //
+
+ //javadoc: computeCorrespondEpilines(points, whichImage, F, lines)
+ public static void computeCorrespondEpilines(Mat points, int whichImage, Mat F, Mat lines)
+ {
+
+ computeCorrespondEpilines_0(points.nativeObj, whichImage, F.nativeObj, lines.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::convertPointsFromHomogeneous(Mat src, Mat& dst)
+ //
+
+ //javadoc: convertPointsFromHomogeneous(src, dst)
+ public static void convertPointsFromHomogeneous(Mat src, Mat dst)
+ {
+
+ convertPointsFromHomogeneous_0(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::convertPointsToHomogeneous(Mat src, Mat& dst)
+ //
+
+ //javadoc: convertPointsToHomogeneous(src, dst)
+ public static void convertPointsToHomogeneous(Mat src, Mat dst)
+ {
+
+ convertPointsToHomogeneous_0(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::correctMatches(Mat F, Mat points1, Mat points2, Mat& newPoints1, Mat& newPoints2)
+ //
+
+ //javadoc: correctMatches(F, points1, points2, newPoints1, newPoints2)
+ public static void correctMatches(Mat F, Mat points1, Mat points2, Mat newPoints1, Mat newPoints2)
+ {
+
+ correctMatches_0(F.nativeObj, points1.nativeObj, points2.nativeObj, newPoints1.nativeObj, newPoints2.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::decomposeEssentialMat(Mat E, Mat& R1, Mat& R2, Mat& t)
+ //
+
+ //javadoc: decomposeEssentialMat(E, R1, R2, t)
+ public static void decomposeEssentialMat(Mat E, Mat R1, Mat R2, Mat t)
+ {
+
+ decomposeEssentialMat_0(E.nativeObj, R1.nativeObj, R2.nativeObj, t.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::decomposeProjectionMatrix(Mat projMatrix, Mat& cameraMatrix, Mat& rotMatrix, Mat& transVect, Mat& rotMatrixX = Mat(), Mat& rotMatrixY = Mat(), Mat& rotMatrixZ = Mat(), Mat& eulerAngles = Mat())
+ //
+
+ //javadoc: decomposeProjectionMatrix(projMatrix, cameraMatrix, rotMatrix, transVect, rotMatrixX, rotMatrixY, rotMatrixZ, eulerAngles)
+ public static void decomposeProjectionMatrix(Mat projMatrix, Mat cameraMatrix, Mat rotMatrix, Mat transVect, Mat rotMatrixX, Mat rotMatrixY, Mat rotMatrixZ, Mat eulerAngles)
+ {
+
+ decomposeProjectionMatrix_0(projMatrix.nativeObj, cameraMatrix.nativeObj, rotMatrix.nativeObj, transVect.nativeObj, rotMatrixX.nativeObj, rotMatrixY.nativeObj, rotMatrixZ.nativeObj, eulerAngles.nativeObj);
+
+ return;
+ }
+
+ //javadoc: decomposeProjectionMatrix(projMatrix, cameraMatrix, rotMatrix, transVect, rotMatrixX, rotMatrixY, rotMatrixZ)
+ public static void decomposeProjectionMatrix(Mat projMatrix, Mat cameraMatrix, Mat rotMatrix, Mat transVect, Mat rotMatrixX, Mat rotMatrixY, Mat rotMatrixZ)
+ {
+
+ decomposeProjectionMatrix_1(projMatrix.nativeObj, cameraMatrix.nativeObj, rotMatrix.nativeObj, transVect.nativeObj, rotMatrixX.nativeObj, rotMatrixY.nativeObj, rotMatrixZ.nativeObj);
+
+ return;
+ }
+
+ //javadoc: decomposeProjectionMatrix(projMatrix, cameraMatrix, rotMatrix, transVect, rotMatrixX, rotMatrixY)
+ public static void decomposeProjectionMatrix(Mat projMatrix, Mat cameraMatrix, Mat rotMatrix, Mat transVect, Mat rotMatrixX, Mat rotMatrixY)
+ {
+
+ decomposeProjectionMatrix_2(projMatrix.nativeObj, cameraMatrix.nativeObj, rotMatrix.nativeObj, transVect.nativeObj, rotMatrixX.nativeObj, rotMatrixY.nativeObj);
+
+ return;
+ }
+
+ //javadoc: decomposeProjectionMatrix(projMatrix, cameraMatrix, rotMatrix, transVect, rotMatrixX)
+ public static void decomposeProjectionMatrix(Mat projMatrix, Mat cameraMatrix, Mat rotMatrix, Mat transVect, Mat rotMatrixX)
+ {
+
+ decomposeProjectionMatrix_3(projMatrix.nativeObj, cameraMatrix.nativeObj, rotMatrix.nativeObj, transVect.nativeObj, rotMatrixX.nativeObj);
+
+ return;
+ }
+
+ //javadoc: decomposeProjectionMatrix(projMatrix, cameraMatrix, rotMatrix, transVect)
+ public static void decomposeProjectionMatrix(Mat projMatrix, Mat cameraMatrix, Mat rotMatrix, Mat transVect)
+ {
+
+ decomposeProjectionMatrix_4(projMatrix.nativeObj, cameraMatrix.nativeObj, rotMatrix.nativeObj, transVect.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::drawChessboardCorners(Mat& image, Size patternSize, vector_Point2f corners, bool patternWasFound)
+ //
+
+ //javadoc: drawChessboardCorners(image, patternSize, corners, patternWasFound)
+ public static void drawChessboardCorners(Mat image, Size patternSize, MatOfPoint2f corners, boolean patternWasFound)
+ {
+ Mat corners_mat = corners;
+ drawChessboardCorners_0(image.nativeObj, patternSize.width, patternSize.height, corners_mat.nativeObj, patternWasFound);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::filterHomographyDecompByVisibleRefpoints(vector_Mat rotations, vector_Mat normals, Mat beforePoints, Mat afterPoints, Mat& possibleSolutions, Mat pointsMask = Mat())
+ //
+
+ //javadoc: filterHomographyDecompByVisibleRefpoints(rotations, normals, beforePoints, afterPoints, possibleSolutions, pointsMask)
+ public static void filterHomographyDecompByVisibleRefpoints(List rotations, List normals, Mat beforePoints, Mat afterPoints, Mat possibleSolutions, Mat pointsMask)
+ {
+ Mat rotations_mat = Converters.vector_Mat_to_Mat(rotations);
+ Mat normals_mat = Converters.vector_Mat_to_Mat(normals);
+ filterHomographyDecompByVisibleRefpoints_0(rotations_mat.nativeObj, normals_mat.nativeObj, beforePoints.nativeObj, afterPoints.nativeObj, possibleSolutions.nativeObj, pointsMask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: filterHomographyDecompByVisibleRefpoints(rotations, normals, beforePoints, afterPoints, possibleSolutions)
+ public static void filterHomographyDecompByVisibleRefpoints(List rotations, List normals, Mat beforePoints, Mat afterPoints, Mat possibleSolutions)
+ {
+ Mat rotations_mat = Converters.vector_Mat_to_Mat(rotations);
+ Mat normals_mat = Converters.vector_Mat_to_Mat(normals);
+ filterHomographyDecompByVisibleRefpoints_1(rotations_mat.nativeObj, normals_mat.nativeObj, beforePoints.nativeObj, afterPoints.nativeObj, possibleSolutions.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::filterSpeckles(Mat& img, double newVal, int maxSpeckleSize, double maxDiff, Mat& buf = Mat())
+ //
+
+ //javadoc: filterSpeckles(img, newVal, maxSpeckleSize, maxDiff, buf)
+ public static void filterSpeckles(Mat img, double newVal, int maxSpeckleSize, double maxDiff, Mat buf)
+ {
+
+ filterSpeckles_0(img.nativeObj, newVal, maxSpeckleSize, maxDiff, buf.nativeObj);
+
+ return;
+ }
+
+ //javadoc: filterSpeckles(img, newVal, maxSpeckleSize, maxDiff)
+ public static void filterSpeckles(Mat img, double newVal, int maxSpeckleSize, double maxDiff)
+ {
+
+ filterSpeckles_1(img.nativeObj, newVal, maxSpeckleSize, maxDiff);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::matMulDeriv(Mat A, Mat B, Mat& dABdA, Mat& dABdB)
+ //
+
+ //javadoc: matMulDeriv(A, B, dABdA, dABdB)
+ public static void matMulDeriv(Mat A, Mat B, Mat dABdA, Mat dABdB)
+ {
+
+ matMulDeriv_0(A.nativeObj, B.nativeObj, dABdA.nativeObj, dABdB.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::projectPoints(vector_Point3f objectPoints, Mat rvec, Mat tvec, Mat cameraMatrix, vector_double distCoeffs, vector_Point2f& imagePoints, Mat& jacobian = Mat(), double aspectRatio = 0)
+ //
+
+ //javadoc: projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs, imagePoints, jacobian, aspectRatio)
+ public static void projectPoints(MatOfPoint3f objectPoints, Mat rvec, Mat tvec, Mat cameraMatrix, MatOfDouble distCoeffs, MatOfPoint2f imagePoints, Mat jacobian, double aspectRatio)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat distCoeffs_mat = distCoeffs;
+ Mat imagePoints_mat = imagePoints;
+ projectPoints_0(objectPoints_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, imagePoints_mat.nativeObj, jacobian.nativeObj, aspectRatio);
+
+ return;
+ }
+
+ //javadoc: projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs, imagePoints, jacobian)
+ public static void projectPoints(MatOfPoint3f objectPoints, Mat rvec, Mat tvec, Mat cameraMatrix, MatOfDouble distCoeffs, MatOfPoint2f imagePoints, Mat jacobian)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat distCoeffs_mat = distCoeffs;
+ Mat imagePoints_mat = imagePoints;
+ projectPoints_1(objectPoints_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, imagePoints_mat.nativeObj, jacobian.nativeObj);
+
+ return;
+ }
+
+ //javadoc: projectPoints(objectPoints, rvec, tvec, cameraMatrix, distCoeffs, imagePoints)
+ public static void projectPoints(MatOfPoint3f objectPoints, Mat rvec, Mat tvec, Mat cameraMatrix, MatOfDouble distCoeffs, MatOfPoint2f imagePoints)
+ {
+ Mat objectPoints_mat = objectPoints;
+ Mat distCoeffs_mat = distCoeffs;
+ Mat imagePoints_mat = imagePoints;
+ projectPoints_2(objectPoints_mat.nativeObj, rvec.nativeObj, tvec.nativeObj, cameraMatrix.nativeObj, distCoeffs_mat.nativeObj, imagePoints_mat.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::reprojectImageTo3D(Mat disparity, Mat& _3dImage, Mat Q, bool handleMissingValues = false, int ddepth = -1)
+ //
+
+ //javadoc: reprojectImageTo3D(disparity, _3dImage, Q, handleMissingValues, ddepth)
+ public static void reprojectImageTo3D(Mat disparity, Mat _3dImage, Mat Q, boolean handleMissingValues, int ddepth)
+ {
+
+ reprojectImageTo3D_0(disparity.nativeObj, _3dImage.nativeObj, Q.nativeObj, handleMissingValues, ddepth);
+
+ return;
+ }
+
+ //javadoc: reprojectImageTo3D(disparity, _3dImage, Q, handleMissingValues)
+ public static void reprojectImageTo3D(Mat disparity, Mat _3dImage, Mat Q, boolean handleMissingValues)
+ {
+
+ reprojectImageTo3D_1(disparity.nativeObj, _3dImage.nativeObj, Q.nativeObj, handleMissingValues);
+
+ return;
+ }
+
+ //javadoc: reprojectImageTo3D(disparity, _3dImage, Q)
+ public static void reprojectImageTo3D(Mat disparity, Mat _3dImage, Mat Q)
+ {
+
+ reprojectImageTo3D_2(disparity.nativeObj, _3dImage.nativeObj, Q.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q, int flags = CALIB_ZERO_DISPARITY, double alpha = -1, Size newImageSize = Size(), Rect* validPixROI1 = 0, Rect* validPixROI2 = 0)
+ //
+
+ //javadoc: stereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, R1, R2, P1, P2, Q, flags, alpha, newImageSize, validPixROI1, validPixROI2)
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, double alpha, Size newImageSize, Rect validPixROI1, Rect validPixROI2)
+ {
+ double[] validPixROI1_out = new double[4];
+ double[] validPixROI2_out = new double[4];
+ stereoRectify_0(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, alpha, newImageSize.width, newImageSize.height, validPixROI1_out, validPixROI2_out);
+ if(validPixROI1!=null){ validPixROI1.x = (int)validPixROI1_out[0]; validPixROI1.y = (int)validPixROI1_out[1]; validPixROI1.width = (int)validPixROI1_out[2]; validPixROI1.height = (int)validPixROI1_out[3]; }
+ if(validPixROI2!=null){ validPixROI2.x = (int)validPixROI2_out[0]; validPixROI2.y = (int)validPixROI2_out[1]; validPixROI2.width = (int)validPixROI2_out[2]; validPixROI2.height = (int)validPixROI2_out[3]; }
+ return;
+ }
+
+ //javadoc: stereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, R1, R2, P1, P2, Q, flags, alpha, newImageSize, validPixROI1)
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, double alpha, Size newImageSize, Rect validPixROI1)
+ {
+ double[] validPixROI1_out = new double[4];
+ stereoRectify_1(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, alpha, newImageSize.width, newImageSize.height, validPixROI1_out);
+ if(validPixROI1!=null){ validPixROI1.x = (int)validPixROI1_out[0]; validPixROI1.y = (int)validPixROI1_out[1]; validPixROI1.width = (int)validPixROI1_out[2]; validPixROI1.height = (int)validPixROI1_out[3]; }
+ return;
+ }
+
+ //javadoc: stereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, R1, R2, P1, P2, Q, flags, alpha, newImageSize)
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, double alpha, Size newImageSize)
+ {
+
+ stereoRectify_2(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, alpha, newImageSize.width, newImageSize.height);
+
+ return;
+ }
+
+ //javadoc: stereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, R1, R2, P1, P2, Q, flags, alpha)
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, double alpha)
+ {
+
+ stereoRectify_3(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, alpha);
+
+ return;
+ }
+
+ //javadoc: stereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, R1, R2, P1, P2, Q, flags)
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags)
+ {
+
+ stereoRectify_4(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags);
+
+ return;
+ }
+
+ //javadoc: stereoRectify(cameraMatrix1, distCoeffs1, cameraMatrix2, distCoeffs2, imageSize, R, T, R1, R2, P1, P2, Q)
+ public static void stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q)
+ {
+
+ stereoRectify_5(cameraMatrix1.nativeObj, distCoeffs1.nativeObj, cameraMatrix2.nativeObj, distCoeffs2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, T.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::triangulatePoints(Mat projMatr1, Mat projMatr2, Mat projPoints1, Mat projPoints2, Mat& points4D)
+ //
+
+ //javadoc: triangulatePoints(projMatr1, projMatr2, projPoints1, projPoints2, points4D)
+ public static void triangulatePoints(Mat projMatr1, Mat projMatr2, Mat projPoints1, Mat projPoints2, Mat points4D)
+ {
+
+ triangulatePoints_0(projMatr1.nativeObj, projMatr2.nativeObj, projPoints1.nativeObj, projPoints2.nativeObj, points4D.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::validateDisparity(Mat& disparity, Mat cost, int minDisparity, int numberOfDisparities, int disp12MaxDisp = 1)
+ //
+
+ //javadoc: validateDisparity(disparity, cost, minDisparity, numberOfDisparities, disp12MaxDisp)
+ public static void validateDisparity(Mat disparity, Mat cost, int minDisparity, int numberOfDisparities, int disp12MaxDisp)
+ {
+
+ validateDisparity_0(disparity.nativeObj, cost.nativeObj, minDisparity, numberOfDisparities, disp12MaxDisp);
+
+ return;
+ }
+
+ //javadoc: validateDisparity(disparity, cost, minDisparity, numberOfDisparities)
+ public static void validateDisparity(Mat disparity, Mat cost, int minDisparity, int numberOfDisparities)
+ {
+
+ validateDisparity_1(disparity.nativeObj, cost.nativeObj, minDisparity, numberOfDisparities);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::fisheye::distortPoints(Mat undistorted, Mat& distorted, Mat K, Mat D, double alpha = 0)
+ //
+
+ //javadoc: fisheye_distortPoints(undistorted, distorted, K, D, alpha)
+ public static void fisheye_distortPoints(Mat undistorted, Mat distorted, Mat K, Mat D, double alpha)
+ {
+
+ fisheye_distortPoints_0(undistorted.nativeObj, distorted.nativeObj, K.nativeObj, D.nativeObj, alpha);
+
+ return;
+ }
+
+ //javadoc: fisheye_distortPoints(undistorted, distorted, K, D)
+ public static void fisheye_distortPoints(Mat undistorted, Mat distorted, Mat K, Mat D)
+ {
+
+ fisheye_distortPoints_1(undistorted.nativeObj, distorted.nativeObj, K.nativeObj, D.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat& P, double balance = 0.0, Size new_size = Size(), double fov_scale = 1.0)
+ //
+
+ //javadoc: fisheye_estimateNewCameraMatrixForUndistortRectify(K, D, image_size, R, P, balance, new_size, fov_scale)
+ public static void fisheye_estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat P, double balance, Size new_size, double fov_scale)
+ {
+
+ fisheye_estimateNewCameraMatrixForUndistortRectify_0(K.nativeObj, D.nativeObj, image_size.width, image_size.height, R.nativeObj, P.nativeObj, balance, new_size.width, new_size.height, fov_scale);
+
+ return;
+ }
+
+ //javadoc: fisheye_estimateNewCameraMatrixForUndistortRectify(K, D, image_size, R, P, balance, new_size)
+ public static void fisheye_estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat P, double balance, Size new_size)
+ {
+
+ fisheye_estimateNewCameraMatrixForUndistortRectify_1(K.nativeObj, D.nativeObj, image_size.width, image_size.height, R.nativeObj, P.nativeObj, balance, new_size.width, new_size.height);
+
+ return;
+ }
+
+ //javadoc: fisheye_estimateNewCameraMatrixForUndistortRectify(K, D, image_size, R, P, balance)
+ public static void fisheye_estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat P, double balance)
+ {
+
+ fisheye_estimateNewCameraMatrixForUndistortRectify_2(K.nativeObj, D.nativeObj, image_size.width, image_size.height, R.nativeObj, P.nativeObj, balance);
+
+ return;
+ }
+
+ //javadoc: fisheye_estimateNewCameraMatrixForUndistortRectify(K, D, image_size, R, P)
+ public static void fisheye_estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat P)
+ {
+
+ fisheye_estimateNewCameraMatrixForUndistortRectify_3(K.nativeObj, D.nativeObj, image_size.width, image_size.height, R.nativeObj, P.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::fisheye::initUndistortRectifyMap(Mat K, Mat D, Mat R, Mat P, Size size, int m1type, Mat& map1, Mat& map2)
+ //
+
+ //javadoc: fisheye_initUndistortRectifyMap(K, D, R, P, size, m1type, map1, map2)
+ public static void fisheye_initUndistortRectifyMap(Mat K, Mat D, Mat R, Mat P, Size size, int m1type, Mat map1, Mat map2)
+ {
+
+ fisheye_initUndistortRectifyMap_0(K.nativeObj, D.nativeObj, R.nativeObj, P.nativeObj, size.width, size.height, m1type, map1.nativeObj, map2.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::fisheye::projectPoints(Mat objectPoints, Mat& imagePoints, Mat rvec, Mat tvec, Mat K, Mat D, double alpha = 0, Mat& jacobian = Mat())
+ //
+
+ //javadoc: fisheye_projectPoints(objectPoints, imagePoints, rvec, tvec, K, D, alpha, jacobian)
+ public static void fisheye_projectPoints(Mat objectPoints, Mat imagePoints, Mat rvec, Mat tvec, Mat K, Mat D, double alpha, Mat jacobian)
+ {
+
+ fisheye_projectPoints_0(objectPoints.nativeObj, imagePoints.nativeObj, rvec.nativeObj, tvec.nativeObj, K.nativeObj, D.nativeObj, alpha, jacobian.nativeObj);
+
+ return;
+ }
+
+ //javadoc: fisheye_projectPoints(objectPoints, imagePoints, rvec, tvec, K, D, alpha)
+ public static void fisheye_projectPoints(Mat objectPoints, Mat imagePoints, Mat rvec, Mat tvec, Mat K, Mat D, double alpha)
+ {
+
+ fisheye_projectPoints_1(objectPoints.nativeObj, imagePoints.nativeObj, rvec.nativeObj, tvec.nativeObj, K.nativeObj, D.nativeObj, alpha);
+
+ return;
+ }
+
+ //javadoc: fisheye_projectPoints(objectPoints, imagePoints, rvec, tvec, K, D)
+ public static void fisheye_projectPoints(Mat objectPoints, Mat imagePoints, Mat rvec, Mat tvec, Mat K, Mat D)
+ {
+
+ fisheye_projectPoints_2(objectPoints.nativeObj, imagePoints.nativeObj, rvec.nativeObj, tvec.nativeObj, K.nativeObj, D.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::fisheye::stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q, int flags, Size newImageSize = Size(), double balance = 0.0, double fov_scale = 1.0)
+ //
+
+ //javadoc: fisheye_stereoRectify(K1, D1, K2, D2, imageSize, R, tvec, R1, R2, P1, P2, Q, flags, newImageSize, balance, fov_scale)
+ public static void fisheye_stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, Size newImageSize, double balance, double fov_scale)
+ {
+
+ fisheye_stereoRectify_0(K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, tvec.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, newImageSize.width, newImageSize.height, balance, fov_scale);
+
+ return;
+ }
+
+ //javadoc: fisheye_stereoRectify(K1, D1, K2, D2, imageSize, R, tvec, R1, R2, P1, P2, Q, flags, newImageSize, balance)
+ public static void fisheye_stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, Size newImageSize, double balance)
+ {
+
+ fisheye_stereoRectify_1(K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, tvec.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, newImageSize.width, newImageSize.height, balance);
+
+ return;
+ }
+
+ //javadoc: fisheye_stereoRectify(K1, D1, K2, D2, imageSize, R, tvec, R1, R2, P1, P2, Q, flags, newImageSize)
+ public static void fisheye_stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags, Size newImageSize)
+ {
+
+ fisheye_stereoRectify_2(K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, tvec.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags, newImageSize.width, newImageSize.height);
+
+ return;
+ }
+
+ //javadoc: fisheye_stereoRectify(K1, D1, K2, D2, imageSize, R, tvec, R1, R2, P1, P2, Q, flags)
+ public static void fisheye_stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat R1, Mat R2, Mat P1, Mat P2, Mat Q, int flags)
+ {
+
+ fisheye_stereoRectify_3(K1.nativeObj, D1.nativeObj, K2.nativeObj, D2.nativeObj, imageSize.width, imageSize.height, R.nativeObj, tvec.nativeObj, R1.nativeObj, R2.nativeObj, P1.nativeObj, P2.nativeObj, Q.nativeObj, flags);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::fisheye::undistortImage(Mat distorted, Mat& undistorted, Mat K, Mat D, Mat Knew = cv::Mat(), Size new_size = Size())
+ //
+
+ //javadoc: fisheye_undistortImage(distorted, undistorted, K, D, Knew, new_size)
+ public static void fisheye_undistortImage(Mat distorted, Mat undistorted, Mat K, Mat D, Mat Knew, Size new_size)
+ {
+
+ fisheye_undistortImage_0(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj, Knew.nativeObj, new_size.width, new_size.height);
+
+ return;
+ }
+
+ //javadoc: fisheye_undistortImage(distorted, undistorted, K, D, Knew)
+ public static void fisheye_undistortImage(Mat distorted, Mat undistorted, Mat K, Mat D, Mat Knew)
+ {
+
+ fisheye_undistortImage_1(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj, Knew.nativeObj);
+
+ return;
+ }
+
+ //javadoc: fisheye_undistortImage(distorted, undistorted, K, D)
+ public static void fisheye_undistortImage(Mat distorted, Mat undistorted, Mat K, Mat D)
+ {
+
+ fisheye_undistortImage_2(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::fisheye::undistortPoints(Mat distorted, Mat& undistorted, Mat K, Mat D, Mat R = Mat(), Mat P = Mat())
+ //
+
+ //javadoc: fisheye_undistortPoints(distorted, undistorted, K, D, R, P)
+ public static void fisheye_undistortPoints(Mat distorted, Mat undistorted, Mat K, Mat D, Mat R, Mat P)
+ {
+
+ fisheye_undistortPoints_0(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj, R.nativeObj, P.nativeObj);
+
+ return;
+ }
+
+ //javadoc: fisheye_undistortPoints(distorted, undistorted, K, D, R)
+ public static void fisheye_undistortPoints(Mat distorted, Mat undistorted, Mat K, Mat D, Mat R)
+ {
+
+ fisheye_undistortPoints_1(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj, R.nativeObj);
+
+ return;
+ }
+
+ //javadoc: fisheye_undistortPoints(distorted, undistorted, K, D)
+ public static void fisheye_undistortPoints(Mat distorted, Mat undistorted, Mat K, Mat D)
+ {
+
+ fisheye_undistortPoints_2(distorted.nativeObj, undistorted.nativeObj, K.nativeObj, D.nativeObj);
+
+ return;
+ }
+
+
+
+
+ // C++: Mat cv::estimateAffine2D(Mat from, Mat to, Mat& inliers = Mat(), int method = RANSAC, double ransacReprojThreshold = 3, size_t maxIters = 2000, double confidence = 0.99, size_t refineIters = 10)
+ private static native long estimateAffine2D_0(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters, double confidence, long refineIters);
+ private static native long estimateAffine2D_1(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters, double confidence);
+ private static native long estimateAffine2D_2(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters);
+ private static native long estimateAffine2D_3(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold);
+ private static native long estimateAffine2D_4(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method);
+ private static native long estimateAffine2D_5(long from_nativeObj, long to_nativeObj, long inliers_nativeObj);
+ private static native long estimateAffine2D_6(long from_nativeObj, long to_nativeObj);
+
+ // C++: Mat cv::estimateAffinePartial2D(Mat from, Mat to, Mat& inliers = Mat(), int method = RANSAC, double ransacReprojThreshold = 3, size_t maxIters = 2000, double confidence = 0.99, size_t refineIters = 10)
+ private static native long estimateAffinePartial2D_0(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters, double confidence, long refineIters);
+ private static native long estimateAffinePartial2D_1(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters, double confidence);
+ private static native long estimateAffinePartial2D_2(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold, long maxIters);
+ private static native long estimateAffinePartial2D_3(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method, double ransacReprojThreshold);
+ private static native long estimateAffinePartial2D_4(long from_nativeObj, long to_nativeObj, long inliers_nativeObj, int method);
+ private static native long estimateAffinePartial2D_5(long from_nativeObj, long to_nativeObj, long inliers_nativeObj);
+ private static native long estimateAffinePartial2D_6(long from_nativeObj, long to_nativeObj);
+
+ // C++: Mat cv::findEssentialMat(Mat points1, Mat points2, Mat cameraMatrix, int method = RANSAC, double prob = 0.999, double threshold = 1.0, Mat& mask = Mat())
+ private static native long findEssentialMat_0(long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, int method, double prob, double threshold, long mask_nativeObj);
+ private static native long findEssentialMat_1(long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, int method, double prob, double threshold);
+ private static native long findEssentialMat_2(long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, int method, double prob);
+ private static native long findEssentialMat_3(long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, int method);
+ private static native long findEssentialMat_4(long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj);
+
+ // C++: Mat cv::findEssentialMat(Mat points1, Mat points2, double focal = 1.0, Point2d pp = Point2d(0, 0), int method = RANSAC, double prob = 0.999, double threshold = 1.0, Mat& mask = Mat())
+ private static native long findEssentialMat_5(long points1_nativeObj, long points2_nativeObj, double focal, double pp_x, double pp_y, int method, double prob, double threshold, long mask_nativeObj);
+ private static native long findEssentialMat_6(long points1_nativeObj, long points2_nativeObj, double focal, double pp_x, double pp_y, int method, double prob, double threshold);
+ private static native long findEssentialMat_7(long points1_nativeObj, long points2_nativeObj, double focal, double pp_x, double pp_y, int method, double prob);
+ private static native long findEssentialMat_8(long points1_nativeObj, long points2_nativeObj, double focal, double pp_x, double pp_y, int method);
+ private static native long findEssentialMat_9(long points1_nativeObj, long points2_nativeObj, double focal, double pp_x, double pp_y);
+ private static native long findEssentialMat_10(long points1_nativeObj, long points2_nativeObj, double focal);
+ private static native long findEssentialMat_11(long points1_nativeObj, long points2_nativeObj);
+
+ // C++: Mat cv::findFundamentalMat(vector_Point2f points1, vector_Point2f points2, int method = FM_RANSAC, double ransacReprojThreshold = 3., double confidence = 0.99, Mat& mask = Mat())
+ private static native long findFundamentalMat_0(long points1_mat_nativeObj, long points2_mat_nativeObj, int method, double ransacReprojThreshold, double confidence, long mask_nativeObj);
+ private static native long findFundamentalMat_1(long points1_mat_nativeObj, long points2_mat_nativeObj, int method, double ransacReprojThreshold, double confidence);
+ private static native long findFundamentalMat_2(long points1_mat_nativeObj, long points2_mat_nativeObj, int method, double ransacReprojThreshold);
+ private static native long findFundamentalMat_3(long points1_mat_nativeObj, long points2_mat_nativeObj, int method);
+ private static native long findFundamentalMat_4(long points1_mat_nativeObj, long points2_mat_nativeObj);
+
+ // C++: Mat cv::findHomography(vector_Point2f srcPoints, vector_Point2f dstPoints, int method = 0, double ransacReprojThreshold = 3, Mat& mask = Mat(), int maxIters = 2000, double confidence = 0.995)
+ private static native long findHomography_0(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj, int method, double ransacReprojThreshold, long mask_nativeObj, int maxIters, double confidence);
+ private static native long findHomography_1(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj, int method, double ransacReprojThreshold, long mask_nativeObj, int maxIters);
+ private static native long findHomography_2(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj, int method, double ransacReprojThreshold, long mask_nativeObj);
+ private static native long findHomography_3(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj, int method, double ransacReprojThreshold);
+ private static native long findHomography_4(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj, int method);
+ private static native long findHomography_5(long srcPoints_mat_nativeObj, long dstPoints_mat_nativeObj);
+
+ // C++: Mat cv::getOptimalNewCameraMatrix(Mat cameraMatrix, Mat distCoeffs, Size imageSize, double alpha, Size newImgSize = Size(), Rect* validPixROI = 0, bool centerPrincipalPoint = false)
+ private static native long getOptimalNewCameraMatrix_0(long cameraMatrix_nativeObj, long distCoeffs_nativeObj, double imageSize_width, double imageSize_height, double alpha, double newImgSize_width, double newImgSize_height, double[] validPixROI_out, boolean centerPrincipalPoint);
+ private static native long getOptimalNewCameraMatrix_1(long cameraMatrix_nativeObj, long distCoeffs_nativeObj, double imageSize_width, double imageSize_height, double alpha, double newImgSize_width, double newImgSize_height, double[] validPixROI_out);
+ private static native long getOptimalNewCameraMatrix_2(long cameraMatrix_nativeObj, long distCoeffs_nativeObj, double imageSize_width, double imageSize_height, double alpha, double newImgSize_width, double newImgSize_height);
+ private static native long getOptimalNewCameraMatrix_3(long cameraMatrix_nativeObj, long distCoeffs_nativeObj, double imageSize_width, double imageSize_height, double alpha);
+
+ // C++: Mat cv::initCameraMatrix2D(vector_vector_Point3f objectPoints, vector_vector_Point2f imagePoints, Size imageSize, double aspectRatio = 1.0)
+ private static native long initCameraMatrix2D_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, double aspectRatio);
+ private static native long initCameraMatrix2D_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height);
+
+ // C++: Rect cv::getValidDisparityROI(Rect roi1, Rect roi2, int minDisparity, int numberOfDisparities, int SADWindowSize)
+ private static native double[] getValidDisparityROI_0(int roi1_x, int roi1_y, int roi1_width, int roi1_height, int roi2_x, int roi2_y, int roi2_width, int roi2_height, int minDisparity, int numberOfDisparities, int SADWindowSize);
+
+ // C++: Vec3d cv::RQDecomp3x3(Mat src, Mat& mtxR, Mat& mtxQ, Mat& Qx = Mat(), Mat& Qy = Mat(), Mat& Qz = Mat())
+ private static native double[] RQDecomp3x3_0(long src_nativeObj, long mtxR_nativeObj, long mtxQ_nativeObj, long Qx_nativeObj, long Qy_nativeObj, long Qz_nativeObj);
+ private static native double[] RQDecomp3x3_1(long src_nativeObj, long mtxR_nativeObj, long mtxQ_nativeObj, long Qx_nativeObj, long Qy_nativeObj);
+ private static native double[] RQDecomp3x3_2(long src_nativeObj, long mtxR_nativeObj, long mtxQ_nativeObj, long Qx_nativeObj);
+ private static native double[] RQDecomp3x3_3(long src_nativeObj, long mtxR_nativeObj, long mtxQ_nativeObj);
+
+ // C++: bool cv::findChessboardCorners(Mat image, Size patternSize, vector_Point2f& corners, int flags = CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE)
+ private static native boolean findChessboardCorners_0(long image_nativeObj, double patternSize_width, double patternSize_height, long corners_mat_nativeObj, int flags);
+ private static native boolean findChessboardCorners_1(long image_nativeObj, double patternSize_width, double patternSize_height, long corners_mat_nativeObj);
+
+ // C++: bool cv::findCirclesGrid(Mat image, Size patternSize, Mat& centers, int flags = CALIB_CB_SYMMETRIC_GRID, Ptr_FeatureDetector blobDetector = SimpleBlobDetector::create())
+ private static native boolean findCirclesGrid_0(long image_nativeObj, double patternSize_width, double patternSize_height, long centers_nativeObj, int flags);
+ private static native boolean findCirclesGrid_2(long image_nativeObj, double patternSize_width, double patternSize_height, long centers_nativeObj);
+
+ // C++: bool cv::solvePnP(vector_Point3f objectPoints, vector_Point2f imagePoints, Mat cameraMatrix, vector_double distCoeffs, Mat& rvec, Mat& tvec, bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE)
+ private static native boolean solvePnP_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int flags);
+ private static native boolean solvePnP_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess);
+ private static native boolean solvePnP_2(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj);
+
+ // C++: bool cv::solvePnPRansac(vector_Point3f objectPoints, vector_Point2f imagePoints, Mat cameraMatrix, vector_double distCoeffs, Mat& rvec, Mat& tvec, bool useExtrinsicGuess = false, int iterationsCount = 100, float reprojectionError = 8.0, double confidence = 0.99, Mat& inliers = Mat(), int flags = SOLVEPNP_ITERATIVE)
+ private static native boolean solvePnPRansac_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, long inliers_nativeObj, int flags);
+ private static native boolean solvePnPRansac_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence, long inliers_nativeObj);
+ private static native boolean solvePnPRansac_2(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError, double confidence);
+ private static native boolean solvePnPRansac_3(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int iterationsCount, float reprojectionError);
+ private static native boolean solvePnPRansac_4(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess, int iterationsCount);
+ private static native boolean solvePnPRansac_5(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, boolean useExtrinsicGuess);
+ private static native boolean solvePnPRansac_6(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj);
+
+ // C++: bool cv::stereoRectifyUncalibrated(Mat points1, Mat points2, Mat F, Size imgSize, Mat& H1, Mat& H2, double threshold = 5)
+ private static native boolean stereoRectifyUncalibrated_0(long points1_nativeObj, long points2_nativeObj, long F_nativeObj, double imgSize_width, double imgSize_height, long H1_nativeObj, long H2_nativeObj, double threshold);
+ private static native boolean stereoRectifyUncalibrated_1(long points1_nativeObj, long points2_nativeObj, long F_nativeObj, double imgSize_width, double imgSize_height, long H1_nativeObj, long H2_nativeObj);
+
+ // C++: double cv::calibrateCamera(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, Mat& stdDeviationsIntrinsics, Mat& stdDeviationsExtrinsics, Mat& perViewErrors, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
+ private static native double calibrateCameraExtended_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, long stdDeviationsIntrinsics_nativeObj, long stdDeviationsExtrinsics_nativeObj, long perViewErrors_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double calibrateCameraExtended_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, long stdDeviationsIntrinsics_nativeObj, long stdDeviationsExtrinsics_nativeObj, long perViewErrors_nativeObj, int flags);
+ private static native double calibrateCameraExtended_2(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, long stdDeviationsIntrinsics_nativeObj, long stdDeviationsExtrinsics_nativeObj, long perViewErrors_nativeObj);
+
+ // C++: double cv::calibrateCamera(vector_Mat objectPoints, vector_Mat imagePoints, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, int flags = 0, TermCriteria criteria = TermCriteria( TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON))
+ private static native double calibrateCamera_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double calibrateCamera_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, int flags);
+ private static native double calibrateCamera_2(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double imageSize_width, double imageSize_height, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj);
+
+ // C++: double cv::sampsonDistance(Mat pt1, Mat pt2, Mat F)
+ private static native double sampsonDistance_0(long pt1_nativeObj, long pt2_nativeObj, long F_nativeObj);
+
+ // C++: double cv::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& cameraMatrix1, Mat& distCoeffs1, Mat& cameraMatrix2, Mat& distCoeffs2, Size imageSize, Mat& R, Mat& T, Mat& E, Mat& F, Mat& perViewErrors, int flags = CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
+ private static native double stereoCalibrateExtended_0(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj, long perViewErrors_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double stereoCalibrateExtended_1(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj, long perViewErrors_nativeObj, int flags);
+ private static native double stereoCalibrateExtended_2(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj, long perViewErrors_nativeObj);
+
+ // C++: double cv::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& cameraMatrix1, Mat& distCoeffs1, Mat& cameraMatrix2, Mat& distCoeffs2, Size imageSize, Mat& R, Mat& T, Mat& E, Mat& F, int flags = CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6))
+ private static native double stereoCalibrate_0(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double stereoCalibrate_1(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj, int flags);
+ private static native double stereoCalibrate_2(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long E_nativeObj, long F_nativeObj);
+
+ // C++: double cv::fisheye::calibrate(vector_Mat objectPoints, vector_Mat imagePoints, Size image_size, Mat& K, Mat& D, vector_Mat& rvecs, vector_Mat& tvecs, int flags = 0, TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON))
+ private static native double fisheye_calibrate_0(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double image_size_width, double image_size_height, long K_nativeObj, long D_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double fisheye_calibrate_1(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double image_size_width, double image_size_height, long K_nativeObj, long D_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, int flags);
+ private static native double fisheye_calibrate_2(long objectPoints_mat_nativeObj, long imagePoints_mat_nativeObj, double image_size_width, double image_size_height, long K_nativeObj, long D_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj);
+
+ // C++: double cv::fisheye::stereoCalibrate(vector_Mat objectPoints, vector_Mat imagePoints1, vector_Mat imagePoints2, Mat& K1, Mat& D1, Mat& K2, Mat& D2, Size imageSize, Mat& R, Mat& T, int flags = fisheye::CALIB_FIX_INTRINSIC, TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON))
+ private static native double fisheye_stereoCalibrate_0(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, int flags, int criteria_type, int criteria_maxCount, double criteria_epsilon);
+ private static native double fisheye_stereoCalibrate_1(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, int flags);
+ private static native double fisheye_stereoCalibrate_2(long objectPoints_mat_nativeObj, long imagePoints1_mat_nativeObj, long imagePoints2_mat_nativeObj, long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj);
+
+ // C++: float cv::rectify3Collinear(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Mat cameraMatrix3, Mat distCoeffs3, vector_Mat imgpt1, vector_Mat imgpt3, Size imageSize, Mat R12, Mat T12, Mat R13, Mat T13, Mat& R1, Mat& R2, Mat& R3, Mat& P1, Mat& P2, Mat& P3, Mat& Q, double alpha, Size newImgSize, Rect* roi1, Rect* roi2, int flags)
+ private static native float rectify3Collinear_0(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, long cameraMatrix3_nativeObj, long distCoeffs3_nativeObj, long imgpt1_mat_nativeObj, long imgpt3_mat_nativeObj, double imageSize_width, double imageSize_height, long R12_nativeObj, long T12_nativeObj, long R13_nativeObj, long T13_nativeObj, long R1_nativeObj, long R2_nativeObj, long R3_nativeObj, long P1_nativeObj, long P2_nativeObj, long P3_nativeObj, long Q_nativeObj, double alpha, double newImgSize_width, double newImgSize_height, double[] roi1_out, double[] roi2_out, int flags);
+
+ // C++: int cv::decomposeHomographyMat(Mat H, Mat K, vector_Mat& rotations, vector_Mat& translations, vector_Mat& normals)
+ private static native int decomposeHomographyMat_0(long H_nativeObj, long K_nativeObj, long rotations_mat_nativeObj, long translations_mat_nativeObj, long normals_mat_nativeObj);
+
+ // C++: int cv::estimateAffine3D(Mat src, Mat dst, Mat& out, Mat& inliers, double ransacThreshold = 3, double confidence = 0.99)
+ private static native int estimateAffine3D_0(long src_nativeObj, long dst_nativeObj, long out_nativeObj, long inliers_nativeObj, double ransacThreshold, double confidence);
+ private static native int estimateAffine3D_1(long src_nativeObj, long dst_nativeObj, long out_nativeObj, long inliers_nativeObj, double ransacThreshold);
+ private static native int estimateAffine3D_2(long src_nativeObj, long dst_nativeObj, long out_nativeObj, long inliers_nativeObj);
+
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat& R, Mat& t, double focal = 1.0, Point2d pp = Point2d(0, 0), Mat& mask = Mat())
+ private static native int recoverPose_0(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long R_nativeObj, long t_nativeObj, double focal, double pp_x, double pp_y, long mask_nativeObj);
+ private static native int recoverPose_1(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long R_nativeObj, long t_nativeObj, double focal, double pp_x, double pp_y);
+ private static native int recoverPose_2(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long R_nativeObj, long t_nativeObj, double focal);
+ private static native int recoverPose_3(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long R_nativeObj, long t_nativeObj);
+
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat& R, Mat& t, Mat& mask = Mat())
+ private static native int recoverPose_4(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, long R_nativeObj, long t_nativeObj, long mask_nativeObj);
+ private static native int recoverPose_5(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, long R_nativeObj, long t_nativeObj);
+
+ // C++: int cv::recoverPose(Mat E, Mat points1, Mat points2, Mat cameraMatrix, Mat& R, Mat& t, double distanceThresh, Mat& mask = Mat(), Mat& triangulatedPoints = Mat())
+ private static native int recoverPose_6(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, long R_nativeObj, long t_nativeObj, double distanceThresh, long mask_nativeObj, long triangulatedPoints_nativeObj);
+ private static native int recoverPose_7(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, long R_nativeObj, long t_nativeObj, double distanceThresh, long mask_nativeObj);
+ private static native int recoverPose_8(long E_nativeObj, long points1_nativeObj, long points2_nativeObj, long cameraMatrix_nativeObj, long R_nativeObj, long t_nativeObj, double distanceThresh);
+
+ // C++: int cv::solveP3P(Mat objectPoints, Mat imagePoints, Mat cameraMatrix, Mat distCoeffs, vector_Mat& rvecs, vector_Mat& tvecs, int flags)
+ private static native int solveP3P_0(long objectPoints_nativeObj, long imagePoints_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_nativeObj, long rvecs_mat_nativeObj, long tvecs_mat_nativeObj, int flags);
+
+ // C++: void cv::Rodrigues(Mat src, Mat& dst, Mat& jacobian = Mat())
+ private static native void Rodrigues_0(long src_nativeObj, long dst_nativeObj, long jacobian_nativeObj);
+ private static native void Rodrigues_1(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::calibrationMatrixValues(Mat cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, double& fovx, double& fovy, double& focalLength, Point2d& principalPoint, double& aspectRatio)
+ private static native void calibrationMatrixValues_0(long cameraMatrix_nativeObj, double imageSize_width, double imageSize_height, double apertureWidth, double apertureHeight, double[] fovx_out, double[] fovy_out, double[] focalLength_out, double[] principalPoint_out, double[] aspectRatio_out);
+
+ // C++: void cv::composeRT(Mat rvec1, Mat tvec1, Mat rvec2, Mat tvec2, Mat& rvec3, Mat& tvec3, Mat& dr3dr1 = Mat(), Mat& dr3dt1 = Mat(), Mat& dr3dr2 = Mat(), Mat& dr3dt2 = Mat(), Mat& dt3dr1 = Mat(), Mat& dt3dt1 = Mat(), Mat& dt3dr2 = Mat(), Mat& dt3dt2 = Mat())
+ private static native void composeRT_0(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj, long dr3dt2_nativeObj, long dt3dr1_nativeObj, long dt3dt1_nativeObj, long dt3dr2_nativeObj, long dt3dt2_nativeObj);
+ private static native void composeRT_1(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj, long dr3dt2_nativeObj, long dt3dr1_nativeObj, long dt3dt1_nativeObj, long dt3dr2_nativeObj);
+ private static native void composeRT_2(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj, long dr3dt2_nativeObj, long dt3dr1_nativeObj, long dt3dt1_nativeObj);
+ private static native void composeRT_3(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj, long dr3dt2_nativeObj, long dt3dr1_nativeObj);
+ private static native void composeRT_4(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj, long dr3dt2_nativeObj);
+ private static native void composeRT_5(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj, long dr3dr2_nativeObj);
+ private static native void composeRT_6(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj, long dr3dt1_nativeObj);
+ private static native void composeRT_7(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj, long dr3dr1_nativeObj);
+ private static native void composeRT_8(long rvec1_nativeObj, long tvec1_nativeObj, long rvec2_nativeObj, long tvec2_nativeObj, long rvec3_nativeObj, long tvec3_nativeObj);
+
+ // C++: void cv::computeCorrespondEpilines(Mat points, int whichImage, Mat F, Mat& lines)
+ private static native void computeCorrespondEpilines_0(long points_nativeObj, int whichImage, long F_nativeObj, long lines_nativeObj);
+
+ // C++: void cv::convertPointsFromHomogeneous(Mat src, Mat& dst)
+ private static native void convertPointsFromHomogeneous_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::convertPointsToHomogeneous(Mat src, Mat& dst)
+ private static native void convertPointsToHomogeneous_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::correctMatches(Mat F, Mat points1, Mat points2, Mat& newPoints1, Mat& newPoints2)
+ private static native void correctMatches_0(long F_nativeObj, long points1_nativeObj, long points2_nativeObj, long newPoints1_nativeObj, long newPoints2_nativeObj);
+
+ // C++: void cv::decomposeEssentialMat(Mat E, Mat& R1, Mat& R2, Mat& t)
+ private static native void decomposeEssentialMat_0(long E_nativeObj, long R1_nativeObj, long R2_nativeObj, long t_nativeObj);
+
+ // C++: void cv::decomposeProjectionMatrix(Mat projMatrix, Mat& cameraMatrix, Mat& rotMatrix, Mat& transVect, Mat& rotMatrixX = Mat(), Mat& rotMatrixY = Mat(), Mat& rotMatrixZ = Mat(), Mat& eulerAngles = Mat())
+ private static native void decomposeProjectionMatrix_0(long projMatrix_nativeObj, long cameraMatrix_nativeObj, long rotMatrix_nativeObj, long transVect_nativeObj, long rotMatrixX_nativeObj, long rotMatrixY_nativeObj, long rotMatrixZ_nativeObj, long eulerAngles_nativeObj);
+ private static native void decomposeProjectionMatrix_1(long projMatrix_nativeObj, long cameraMatrix_nativeObj, long rotMatrix_nativeObj, long transVect_nativeObj, long rotMatrixX_nativeObj, long rotMatrixY_nativeObj, long rotMatrixZ_nativeObj);
+ private static native void decomposeProjectionMatrix_2(long projMatrix_nativeObj, long cameraMatrix_nativeObj, long rotMatrix_nativeObj, long transVect_nativeObj, long rotMatrixX_nativeObj, long rotMatrixY_nativeObj);
+ private static native void decomposeProjectionMatrix_3(long projMatrix_nativeObj, long cameraMatrix_nativeObj, long rotMatrix_nativeObj, long transVect_nativeObj, long rotMatrixX_nativeObj);
+ private static native void decomposeProjectionMatrix_4(long projMatrix_nativeObj, long cameraMatrix_nativeObj, long rotMatrix_nativeObj, long transVect_nativeObj);
+
+ // C++: void cv::drawChessboardCorners(Mat& image, Size patternSize, vector_Point2f corners, bool patternWasFound)
+ private static native void drawChessboardCorners_0(long image_nativeObj, double patternSize_width, double patternSize_height, long corners_mat_nativeObj, boolean patternWasFound);
+
+ // C++: void cv::filterHomographyDecompByVisibleRefpoints(vector_Mat rotations, vector_Mat normals, Mat beforePoints, Mat afterPoints, Mat& possibleSolutions, Mat pointsMask = Mat())
+ private static native void filterHomographyDecompByVisibleRefpoints_0(long rotations_mat_nativeObj, long normals_mat_nativeObj, long beforePoints_nativeObj, long afterPoints_nativeObj, long possibleSolutions_nativeObj, long pointsMask_nativeObj);
+ private static native void filterHomographyDecompByVisibleRefpoints_1(long rotations_mat_nativeObj, long normals_mat_nativeObj, long beforePoints_nativeObj, long afterPoints_nativeObj, long possibleSolutions_nativeObj);
+
+ // C++: void cv::filterSpeckles(Mat& img, double newVal, int maxSpeckleSize, double maxDiff, Mat& buf = Mat())
+ private static native void filterSpeckles_0(long img_nativeObj, double newVal, int maxSpeckleSize, double maxDiff, long buf_nativeObj);
+ private static native void filterSpeckles_1(long img_nativeObj, double newVal, int maxSpeckleSize, double maxDiff);
+
+ // C++: void cv::matMulDeriv(Mat A, Mat B, Mat& dABdA, Mat& dABdB)
+ private static native void matMulDeriv_0(long A_nativeObj, long B_nativeObj, long dABdA_nativeObj, long dABdB_nativeObj);
+
+ // C++: void cv::projectPoints(vector_Point3f objectPoints, Mat rvec, Mat tvec, Mat cameraMatrix, vector_double distCoeffs, vector_Point2f& imagePoints, Mat& jacobian = Mat(), double aspectRatio = 0)
+ private static native void projectPoints_0(long objectPoints_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long imagePoints_mat_nativeObj, long jacobian_nativeObj, double aspectRatio);
+ private static native void projectPoints_1(long objectPoints_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long imagePoints_mat_nativeObj, long jacobian_nativeObj);
+ private static native void projectPoints_2(long objectPoints_mat_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long cameraMatrix_nativeObj, long distCoeffs_mat_nativeObj, long imagePoints_mat_nativeObj);
+
+ // C++: void cv::reprojectImageTo3D(Mat disparity, Mat& _3dImage, Mat Q, bool handleMissingValues = false, int ddepth = -1)
+ private static native void reprojectImageTo3D_0(long disparity_nativeObj, long _3dImage_nativeObj, long Q_nativeObj, boolean handleMissingValues, int ddepth);
+ private static native void reprojectImageTo3D_1(long disparity_nativeObj, long _3dImage_nativeObj, long Q_nativeObj, boolean handleMissingValues);
+ private static native void reprojectImageTo3D_2(long disparity_nativeObj, long _3dImage_nativeObj, long Q_nativeObj);
+
+ // C++: void cv::stereoRectify(Mat cameraMatrix1, Mat distCoeffs1, Mat cameraMatrix2, Mat distCoeffs2, Size imageSize, Mat R, Mat T, Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q, int flags = CALIB_ZERO_DISPARITY, double alpha = -1, Size newImageSize = Size(), Rect* validPixROI1 = 0, Rect* validPixROI2 = 0)
+ private static native void stereoRectify_0(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double alpha, double newImageSize_width, double newImageSize_height, double[] validPixROI1_out, double[] validPixROI2_out);
+ private static native void stereoRectify_1(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double alpha, double newImageSize_width, double newImageSize_height, double[] validPixROI1_out);
+ private static native void stereoRectify_2(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double alpha, double newImageSize_width, double newImageSize_height);
+ private static native void stereoRectify_3(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double alpha);
+ private static native void stereoRectify_4(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags);
+ private static native void stereoRectify_5(long cameraMatrix1_nativeObj, long distCoeffs1_nativeObj, long cameraMatrix2_nativeObj, long distCoeffs2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long T_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj);
+
+ // C++: void cv::triangulatePoints(Mat projMatr1, Mat projMatr2, Mat projPoints1, Mat projPoints2, Mat& points4D)
+ private static native void triangulatePoints_0(long projMatr1_nativeObj, long projMatr2_nativeObj, long projPoints1_nativeObj, long projPoints2_nativeObj, long points4D_nativeObj);
+
+ // C++: void cv::validateDisparity(Mat& disparity, Mat cost, int minDisparity, int numberOfDisparities, int disp12MaxDisp = 1)
+ private static native void validateDisparity_0(long disparity_nativeObj, long cost_nativeObj, int minDisparity, int numberOfDisparities, int disp12MaxDisp);
+ private static native void validateDisparity_1(long disparity_nativeObj, long cost_nativeObj, int minDisparity, int numberOfDisparities);
+
+ // C++: void cv::fisheye::distortPoints(Mat undistorted, Mat& distorted, Mat K, Mat D, double alpha = 0)
+ private static native void fisheye_distortPoints_0(long undistorted_nativeObj, long distorted_nativeObj, long K_nativeObj, long D_nativeObj, double alpha);
+ private static native void fisheye_distortPoints_1(long undistorted_nativeObj, long distorted_nativeObj, long K_nativeObj, long D_nativeObj);
+
+ // C++: void cv::fisheye::estimateNewCameraMatrixForUndistortRectify(Mat K, Mat D, Size image_size, Mat R, Mat& P, double balance = 0.0, Size new_size = Size(), double fov_scale = 1.0)
+ private static native void fisheye_estimateNewCameraMatrixForUndistortRectify_0(long K_nativeObj, long D_nativeObj, double image_size_width, double image_size_height, long R_nativeObj, long P_nativeObj, double balance, double new_size_width, double new_size_height, double fov_scale);
+ private static native void fisheye_estimateNewCameraMatrixForUndistortRectify_1(long K_nativeObj, long D_nativeObj, double image_size_width, double image_size_height, long R_nativeObj, long P_nativeObj, double balance, double new_size_width, double new_size_height);
+ private static native void fisheye_estimateNewCameraMatrixForUndistortRectify_2(long K_nativeObj, long D_nativeObj, double image_size_width, double image_size_height, long R_nativeObj, long P_nativeObj, double balance);
+ private static native void fisheye_estimateNewCameraMatrixForUndistortRectify_3(long K_nativeObj, long D_nativeObj, double image_size_width, double image_size_height, long R_nativeObj, long P_nativeObj);
+
+ // C++: void cv::fisheye::initUndistortRectifyMap(Mat K, Mat D, Mat R, Mat P, Size size, int m1type, Mat& map1, Mat& map2)
+ private static native void fisheye_initUndistortRectifyMap_0(long K_nativeObj, long D_nativeObj, long R_nativeObj, long P_nativeObj, double size_width, double size_height, int m1type, long map1_nativeObj, long map2_nativeObj);
+
+ // C++: void cv::fisheye::projectPoints(Mat objectPoints, Mat& imagePoints, Mat rvec, Mat tvec, Mat K, Mat D, double alpha = 0, Mat& jacobian = Mat())
+ private static native void fisheye_projectPoints_0(long objectPoints_nativeObj, long imagePoints_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long K_nativeObj, long D_nativeObj, double alpha, long jacobian_nativeObj);
+ private static native void fisheye_projectPoints_1(long objectPoints_nativeObj, long imagePoints_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long K_nativeObj, long D_nativeObj, double alpha);
+ private static native void fisheye_projectPoints_2(long objectPoints_nativeObj, long imagePoints_nativeObj, long rvec_nativeObj, long tvec_nativeObj, long K_nativeObj, long D_nativeObj);
+
+ // C++: void cv::fisheye::stereoRectify(Mat K1, Mat D1, Mat K2, Mat D2, Size imageSize, Mat R, Mat tvec, Mat& R1, Mat& R2, Mat& P1, Mat& P2, Mat& Q, int flags, Size newImageSize = Size(), double balance = 0.0, double fov_scale = 1.0)
+ private static native void fisheye_stereoRectify_0(long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long tvec_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double newImageSize_width, double newImageSize_height, double balance, double fov_scale);
+ private static native void fisheye_stereoRectify_1(long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long tvec_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double newImageSize_width, double newImageSize_height, double balance);
+ private static native void fisheye_stereoRectify_2(long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long tvec_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags, double newImageSize_width, double newImageSize_height);
+ private static native void fisheye_stereoRectify_3(long K1_nativeObj, long D1_nativeObj, long K2_nativeObj, long D2_nativeObj, double imageSize_width, double imageSize_height, long R_nativeObj, long tvec_nativeObj, long R1_nativeObj, long R2_nativeObj, long P1_nativeObj, long P2_nativeObj, long Q_nativeObj, int flags);
+
+ // C++: void cv::fisheye::undistortImage(Mat distorted, Mat& undistorted, Mat K, Mat D, Mat Knew = cv::Mat(), Size new_size = Size())
+ private static native void fisheye_undistortImage_0(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj, long Knew_nativeObj, double new_size_width, double new_size_height);
+ private static native void fisheye_undistortImage_1(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj, long Knew_nativeObj);
+ private static native void fisheye_undistortImage_2(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj);
+
+ // C++: void cv::fisheye::undistortPoints(Mat distorted, Mat& undistorted, Mat K, Mat D, Mat R = Mat(), Mat P = Mat())
+ private static native void fisheye_undistortPoints_0(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj, long R_nativeObj, long P_nativeObj);
+ private static native void fisheye_undistortPoints_1(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj, long R_nativeObj);
+ private static native void fisheye_undistortPoints_2(long distorted_nativeObj, long undistorted_nativeObj, long K_nativeObj, long D_nativeObj);
+
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/calib3d/StereoBM.java b/openCVLibrary3/src/main/java/org/opencv/calib3d/StereoBM.java
new file mode 100644
index 00000000000..4c730b82857
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/calib3d/StereoBM.java
@@ -0,0 +1,344 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.calib3d;
+
+import org.opencv.calib3d.StereoBM;
+import org.opencv.calib3d.StereoMatcher;
+import org.opencv.core.Rect;
+
+// C++: class StereoBM
+//javadoc: StereoBM
+
+public class StereoBM extends StereoMatcher {
+
+ protected StereoBM(long addr) { super(addr); }
+
+ // internal usage only
+ public static StereoBM __fromPtr__(long addr) { return new StereoBM(addr); }
+
+ public static final int
+ PREFILTER_NORMALIZED_RESPONSE = 0,
+ PREFILTER_XSOBEL = 1;
+
+
+ //
+ // C++: static Ptr_StereoBM cv::StereoBM::create(int numDisparities = 0, int blockSize = 21)
+ //
+
+ //javadoc: StereoBM::create(numDisparities, blockSize)
+ public static StereoBM create(int numDisparities, int blockSize)
+ {
+
+ StereoBM retVal = StereoBM.__fromPtr__(create_0(numDisparities, blockSize));
+
+ return retVal;
+ }
+
+ //javadoc: StereoBM::create(numDisparities)
+ public static StereoBM create(int numDisparities)
+ {
+
+ StereoBM retVal = StereoBM.__fromPtr__(create_1(numDisparities));
+
+ return retVal;
+ }
+
+ //javadoc: StereoBM::create()
+ public static StereoBM create()
+ {
+
+ StereoBM retVal = StereoBM.__fromPtr__(create_2());
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Rect cv::StereoBM::getROI1()
+ //
+
+ //javadoc: StereoBM::getROI1()
+ public Rect getROI1()
+ {
+
+ Rect retVal = new Rect(getROI1_0(nativeObj));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Rect cv::StereoBM::getROI2()
+ //
+
+ //javadoc: StereoBM::getROI2()
+ public Rect getROI2()
+ {
+
+ Rect retVal = new Rect(getROI2_0(nativeObj));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoBM::getPreFilterCap()
+ //
+
+ //javadoc: StereoBM::getPreFilterCap()
+ public int getPreFilterCap()
+ {
+
+ int retVal = getPreFilterCap_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoBM::getPreFilterSize()
+ //
+
+ //javadoc: StereoBM::getPreFilterSize()
+ public int getPreFilterSize()
+ {
+
+ int retVal = getPreFilterSize_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoBM::getPreFilterType()
+ //
+
+ //javadoc: StereoBM::getPreFilterType()
+ public int getPreFilterType()
+ {
+
+ int retVal = getPreFilterType_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoBM::getSmallerBlockSize()
+ //
+
+ //javadoc: StereoBM::getSmallerBlockSize()
+ public int getSmallerBlockSize()
+ {
+
+ int retVal = getSmallerBlockSize_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoBM::getTextureThreshold()
+ //
+
+ //javadoc: StereoBM::getTextureThreshold()
+ public int getTextureThreshold()
+ {
+
+ int retVal = getTextureThreshold_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoBM::getUniquenessRatio()
+ //
+
+ //javadoc: StereoBM::getUniquenessRatio()
+ public int getUniquenessRatio()
+ {
+
+ int retVal = getUniquenessRatio_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setPreFilterCap(int preFilterCap)
+ //
+
+ //javadoc: StereoBM::setPreFilterCap(preFilterCap)
+ public void setPreFilterCap(int preFilterCap)
+ {
+
+ setPreFilterCap_0(nativeObj, preFilterCap);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setPreFilterSize(int preFilterSize)
+ //
+
+ //javadoc: StereoBM::setPreFilterSize(preFilterSize)
+ public void setPreFilterSize(int preFilterSize)
+ {
+
+ setPreFilterSize_0(nativeObj, preFilterSize);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setPreFilterType(int preFilterType)
+ //
+
+ //javadoc: StereoBM::setPreFilterType(preFilterType)
+ public void setPreFilterType(int preFilterType)
+ {
+
+ setPreFilterType_0(nativeObj, preFilterType);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setROI1(Rect roi1)
+ //
+
+ //javadoc: StereoBM::setROI1(roi1)
+ public void setROI1(Rect roi1)
+ {
+
+ setROI1_0(nativeObj, roi1.x, roi1.y, roi1.width, roi1.height);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setROI2(Rect roi2)
+ //
+
+ //javadoc: StereoBM::setROI2(roi2)
+ public void setROI2(Rect roi2)
+ {
+
+ setROI2_0(nativeObj, roi2.x, roi2.y, roi2.width, roi2.height);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setSmallerBlockSize(int blockSize)
+ //
+
+ //javadoc: StereoBM::setSmallerBlockSize(blockSize)
+ public void setSmallerBlockSize(int blockSize)
+ {
+
+ setSmallerBlockSize_0(nativeObj, blockSize);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setTextureThreshold(int textureThreshold)
+ //
+
+ //javadoc: StereoBM::setTextureThreshold(textureThreshold)
+ public void setTextureThreshold(int textureThreshold)
+ {
+
+ setTextureThreshold_0(nativeObj, textureThreshold);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoBM::setUniquenessRatio(int uniquenessRatio)
+ //
+
+ //javadoc: StereoBM::setUniquenessRatio(uniquenessRatio)
+ public void setUniquenessRatio(int uniquenessRatio)
+ {
+
+ setUniquenessRatio_0(nativeObj, uniquenessRatio);
+
+ return;
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: static Ptr_StereoBM cv::StereoBM::create(int numDisparities = 0, int blockSize = 21)
+ private static native long create_0(int numDisparities, int blockSize);
+ private static native long create_1(int numDisparities);
+ private static native long create_2();
+
+ // C++: Rect cv::StereoBM::getROI1()
+ private static native double[] getROI1_0(long nativeObj);
+
+ // C++: Rect cv::StereoBM::getROI2()
+ private static native double[] getROI2_0(long nativeObj);
+
+ // C++: int cv::StereoBM::getPreFilterCap()
+ private static native int getPreFilterCap_0(long nativeObj);
+
+ // C++: int cv::StereoBM::getPreFilterSize()
+ private static native int getPreFilterSize_0(long nativeObj);
+
+ // C++: int cv::StereoBM::getPreFilterType()
+ private static native int getPreFilterType_0(long nativeObj);
+
+ // C++: int cv::StereoBM::getSmallerBlockSize()
+ private static native int getSmallerBlockSize_0(long nativeObj);
+
+ // C++: int cv::StereoBM::getTextureThreshold()
+ private static native int getTextureThreshold_0(long nativeObj);
+
+ // C++: int cv::StereoBM::getUniquenessRatio()
+ private static native int getUniquenessRatio_0(long nativeObj);
+
+ // C++: void cv::StereoBM::setPreFilterCap(int preFilterCap)
+ private static native void setPreFilterCap_0(long nativeObj, int preFilterCap);
+
+ // C++: void cv::StereoBM::setPreFilterSize(int preFilterSize)
+ private static native void setPreFilterSize_0(long nativeObj, int preFilterSize);
+
+ // C++: void cv::StereoBM::setPreFilterType(int preFilterType)
+ private static native void setPreFilterType_0(long nativeObj, int preFilterType);
+
+ // C++: void cv::StereoBM::setROI1(Rect roi1)
+ private static native void setROI1_0(long nativeObj, int roi1_x, int roi1_y, int roi1_width, int roi1_height);
+
+ // C++: void cv::StereoBM::setROI2(Rect roi2)
+ private static native void setROI2_0(long nativeObj, int roi2_x, int roi2_y, int roi2_width, int roi2_height);
+
+ // C++: void cv::StereoBM::setSmallerBlockSize(int blockSize)
+ private static native void setSmallerBlockSize_0(long nativeObj, int blockSize);
+
+ // C++: void cv::StereoBM::setTextureThreshold(int textureThreshold)
+ private static native void setTextureThreshold_0(long nativeObj, int textureThreshold);
+
+ // C++: void cv::StereoBM::setUniquenessRatio(int uniquenessRatio)
+ private static native void setUniquenessRatio_0(long nativeObj, int uniquenessRatio);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/calib3d/StereoMatcher.java b/openCVLibrary3/src/main/java/org/opencv/calib3d/StereoMatcher.java
new file mode 100644
index 00000000000..39777919aa0
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/calib3d/StereoMatcher.java
@@ -0,0 +1,255 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.calib3d;
+
+import org.opencv.core.Algorithm;
+import org.opencv.core.Mat;
+
+// C++: class StereoMatcher
+//javadoc: StereoMatcher
+
+public class StereoMatcher extends Algorithm {
+
+ protected StereoMatcher(long addr) { super(addr); }
+
+ // internal usage only
+ public static StereoMatcher __fromPtr__(long addr) { return new StereoMatcher(addr); }
+
+ public static final int
+ DISP_SHIFT = 4,
+ DISP_SCALE = (1 << DISP_SHIFT);
+
+
+ //
+ // C++: int cv::StereoMatcher::getBlockSize()
+ //
+
+ //javadoc: StereoMatcher::getBlockSize()
+ public int getBlockSize()
+ {
+
+ int retVal = getBlockSize_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoMatcher::getDisp12MaxDiff()
+ //
+
+ //javadoc: StereoMatcher::getDisp12MaxDiff()
+ public int getDisp12MaxDiff()
+ {
+
+ int retVal = getDisp12MaxDiff_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoMatcher::getMinDisparity()
+ //
+
+ //javadoc: StereoMatcher::getMinDisparity()
+ public int getMinDisparity()
+ {
+
+ int retVal = getMinDisparity_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoMatcher::getNumDisparities()
+ //
+
+ //javadoc: StereoMatcher::getNumDisparities()
+ public int getNumDisparities()
+ {
+
+ int retVal = getNumDisparities_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoMatcher::getSpeckleRange()
+ //
+
+ //javadoc: StereoMatcher::getSpeckleRange()
+ public int getSpeckleRange()
+ {
+
+ int retVal = getSpeckleRange_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoMatcher::getSpeckleWindowSize()
+ //
+
+ //javadoc: StereoMatcher::getSpeckleWindowSize()
+ public int getSpeckleWindowSize()
+ {
+
+ int retVal = getSpeckleWindowSize_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::compute(Mat left, Mat right, Mat& disparity)
+ //
+
+ //javadoc: StereoMatcher::compute(left, right, disparity)
+ public void compute(Mat left, Mat right, Mat disparity)
+ {
+
+ compute_0(nativeObj, left.nativeObj, right.nativeObj, disparity.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setBlockSize(int blockSize)
+ //
+
+ //javadoc: StereoMatcher::setBlockSize(blockSize)
+ public void setBlockSize(int blockSize)
+ {
+
+ setBlockSize_0(nativeObj, blockSize);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setDisp12MaxDiff(int disp12MaxDiff)
+ //
+
+ //javadoc: StereoMatcher::setDisp12MaxDiff(disp12MaxDiff)
+ public void setDisp12MaxDiff(int disp12MaxDiff)
+ {
+
+ setDisp12MaxDiff_0(nativeObj, disp12MaxDiff);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setMinDisparity(int minDisparity)
+ //
+
+ //javadoc: StereoMatcher::setMinDisparity(minDisparity)
+ public void setMinDisparity(int minDisparity)
+ {
+
+ setMinDisparity_0(nativeObj, minDisparity);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setNumDisparities(int numDisparities)
+ //
+
+ //javadoc: StereoMatcher::setNumDisparities(numDisparities)
+ public void setNumDisparities(int numDisparities)
+ {
+
+ setNumDisparities_0(nativeObj, numDisparities);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setSpeckleRange(int speckleRange)
+ //
+
+ //javadoc: StereoMatcher::setSpeckleRange(speckleRange)
+ public void setSpeckleRange(int speckleRange)
+ {
+
+ setSpeckleRange_0(nativeObj, speckleRange);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoMatcher::setSpeckleWindowSize(int speckleWindowSize)
+ //
+
+ //javadoc: StereoMatcher::setSpeckleWindowSize(speckleWindowSize)
+ public void setSpeckleWindowSize(int speckleWindowSize)
+ {
+
+ setSpeckleWindowSize_0(nativeObj, speckleWindowSize);
+
+ return;
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: int cv::StereoMatcher::getBlockSize()
+ private static native int getBlockSize_0(long nativeObj);
+
+ // C++: int cv::StereoMatcher::getDisp12MaxDiff()
+ private static native int getDisp12MaxDiff_0(long nativeObj);
+
+ // C++: int cv::StereoMatcher::getMinDisparity()
+ private static native int getMinDisparity_0(long nativeObj);
+
+ // C++: int cv::StereoMatcher::getNumDisparities()
+ private static native int getNumDisparities_0(long nativeObj);
+
+ // C++: int cv::StereoMatcher::getSpeckleRange()
+ private static native int getSpeckleRange_0(long nativeObj);
+
+ // C++: int cv::StereoMatcher::getSpeckleWindowSize()
+ private static native int getSpeckleWindowSize_0(long nativeObj);
+
+ // C++: void cv::StereoMatcher::compute(Mat left, Mat right, Mat& disparity)
+ private static native void compute_0(long nativeObj, long left_nativeObj, long right_nativeObj, long disparity_nativeObj);
+
+ // C++: void cv::StereoMatcher::setBlockSize(int blockSize)
+ private static native void setBlockSize_0(long nativeObj, int blockSize);
+
+ // C++: void cv::StereoMatcher::setDisp12MaxDiff(int disp12MaxDiff)
+ private static native void setDisp12MaxDiff_0(long nativeObj, int disp12MaxDiff);
+
+ // C++: void cv::StereoMatcher::setMinDisparity(int minDisparity)
+ private static native void setMinDisparity_0(long nativeObj, int minDisparity);
+
+ // C++: void cv::StereoMatcher::setNumDisparities(int numDisparities)
+ private static native void setNumDisparities_0(long nativeObj, int numDisparities);
+
+ // C++: void cv::StereoMatcher::setSpeckleRange(int speckleRange)
+ private static native void setSpeckleRange_0(long nativeObj, int speckleRange);
+
+ // C++: void cv::StereoMatcher::setSpeckleWindowSize(int speckleWindowSize)
+ private static native void setSpeckleWindowSize_0(long nativeObj, int speckleWindowSize);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/calib3d/StereoSGBM.java b/openCVLibrary3/src/main/java/org/opencv/calib3d/StereoSGBM.java
new file mode 100644
index 00000000000..372c4f25269
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/calib3d/StereoSGBM.java
@@ -0,0 +1,333 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.calib3d;
+
+import org.opencv.calib3d.StereoMatcher;
+import org.opencv.calib3d.StereoSGBM;
+
+// C++: class StereoSGBM
+//javadoc: StereoSGBM
+
+public class StereoSGBM extends StereoMatcher {
+
+ protected StereoSGBM(long addr) { super(addr); }
+
+ // internal usage only
+ public static StereoSGBM __fromPtr__(long addr) { return new StereoSGBM(addr); }
+
+ public static final int
+ MODE_SGBM = 0,
+ MODE_HH = 1,
+ MODE_SGBM_3WAY = 2,
+ MODE_HH4 = 3;
+
+
+ //
+ // C++: static Ptr_StereoSGBM cv::StereoSGBM::create(int minDisparity = 0, int numDisparities = 16, int blockSize = 3, int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, int preFilterCap = 0, int uniquenessRatio = 0, int speckleWindowSize = 0, int speckleRange = 0, int mode = StereoSGBM::MODE_SGBM)
+ //
+
+ //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange, mode)
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, int mode)
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_0(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange, mode));
+
+ return retVal;
+ }
+
+ //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange)
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange)
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_1(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize, speckleRange));
+
+ return retVal;
+ }
+
+ //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize)
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize)
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_2(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio, speckleWindowSize));
+
+ return retVal;
+ }
+
+ //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio)
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio)
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_3(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap, uniquenessRatio));
+
+ return retVal;
+ }
+
+ //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap)
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap)
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_4(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff, preFilterCap));
+
+ return retVal;
+ }
+
+ //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff)
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff)
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_5(minDisparity, numDisparities, blockSize, P1, P2, disp12MaxDiff));
+
+ return retVal;
+ }
+
+ //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1, P2)
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1, int P2)
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_6(minDisparity, numDisparities, blockSize, P1, P2));
+
+ return retVal;
+ }
+
+ //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize, P1)
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize, int P1)
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_7(minDisparity, numDisparities, blockSize, P1));
+
+ return retVal;
+ }
+
+ //javadoc: StereoSGBM::create(minDisparity, numDisparities, blockSize)
+ public static StereoSGBM create(int minDisparity, int numDisparities, int blockSize)
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_8(minDisparity, numDisparities, blockSize));
+
+ return retVal;
+ }
+
+ //javadoc: StereoSGBM::create(minDisparity, numDisparities)
+ public static StereoSGBM create(int minDisparity, int numDisparities)
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_9(minDisparity, numDisparities));
+
+ return retVal;
+ }
+
+ //javadoc: StereoSGBM::create(minDisparity)
+ public static StereoSGBM create(int minDisparity)
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_10(minDisparity));
+
+ return retVal;
+ }
+
+ //javadoc: StereoSGBM::create()
+ public static StereoSGBM create()
+ {
+
+ StereoSGBM retVal = StereoSGBM.__fromPtr__(create_11());
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoSGBM::getMode()
+ //
+
+ //javadoc: StereoSGBM::getMode()
+ public int getMode()
+ {
+
+ int retVal = getMode_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoSGBM::getP1()
+ //
+
+ //javadoc: StereoSGBM::getP1()
+ public int getP1()
+ {
+
+ int retVal = getP1_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoSGBM::getP2()
+ //
+
+ //javadoc: StereoSGBM::getP2()
+ public int getP2()
+ {
+
+ int retVal = getP2_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoSGBM::getPreFilterCap()
+ //
+
+ //javadoc: StereoSGBM::getPreFilterCap()
+ public int getPreFilterCap()
+ {
+
+ int retVal = getPreFilterCap_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::StereoSGBM::getUniquenessRatio()
+ //
+
+ //javadoc: StereoSGBM::getUniquenessRatio()
+ public int getUniquenessRatio()
+ {
+
+ int retVal = getUniquenessRatio_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: void cv::StereoSGBM::setMode(int mode)
+ //
+
+ //javadoc: StereoSGBM::setMode(mode)
+ public void setMode(int mode)
+ {
+
+ setMode_0(nativeObj, mode);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoSGBM::setP1(int P1)
+ //
+
+ //javadoc: StereoSGBM::setP1(P1)
+ public void setP1(int P1)
+ {
+
+ setP1_0(nativeObj, P1);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoSGBM::setP2(int P2)
+ //
+
+ //javadoc: StereoSGBM::setP2(P2)
+ public void setP2(int P2)
+ {
+
+ setP2_0(nativeObj, P2);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoSGBM::setPreFilterCap(int preFilterCap)
+ //
+
+ //javadoc: StereoSGBM::setPreFilterCap(preFilterCap)
+ public void setPreFilterCap(int preFilterCap)
+ {
+
+ setPreFilterCap_0(nativeObj, preFilterCap);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::StereoSGBM::setUniquenessRatio(int uniquenessRatio)
+ //
+
+ //javadoc: StereoSGBM::setUniquenessRatio(uniquenessRatio)
+ public void setUniquenessRatio(int uniquenessRatio)
+ {
+
+ setUniquenessRatio_0(nativeObj, uniquenessRatio);
+
+ return;
+ }
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: static Ptr_StereoSGBM cv::StereoSGBM::create(int minDisparity = 0, int numDisparities = 16, int blockSize = 3, int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, int preFilterCap = 0, int uniquenessRatio = 0, int speckleWindowSize = 0, int speckleRange = 0, int mode = StereoSGBM::MODE_SGBM)
+ private static native long create_0(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange, int mode);
+ private static native long create_1(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize, int speckleRange);
+ private static native long create_2(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio, int speckleWindowSize);
+ private static native long create_3(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap, int uniquenessRatio);
+ private static native long create_4(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff, int preFilterCap);
+ private static native long create_5(int minDisparity, int numDisparities, int blockSize, int P1, int P2, int disp12MaxDiff);
+ private static native long create_6(int minDisparity, int numDisparities, int blockSize, int P1, int P2);
+ private static native long create_7(int minDisparity, int numDisparities, int blockSize, int P1);
+ private static native long create_8(int minDisparity, int numDisparities, int blockSize);
+ private static native long create_9(int minDisparity, int numDisparities);
+ private static native long create_10(int minDisparity);
+ private static native long create_11();
+
+ // C++: int cv::StereoSGBM::getMode()
+ private static native int getMode_0(long nativeObj);
+
+ // C++: int cv::StereoSGBM::getP1()
+ private static native int getP1_0(long nativeObj);
+
+ // C++: int cv::StereoSGBM::getP2()
+ private static native int getP2_0(long nativeObj);
+
+ // C++: int cv::StereoSGBM::getPreFilterCap()
+ private static native int getPreFilterCap_0(long nativeObj);
+
+ // C++: int cv::StereoSGBM::getUniquenessRatio()
+ private static native int getUniquenessRatio_0(long nativeObj);
+
+ // C++: void cv::StereoSGBM::setMode(int mode)
+ private static native void setMode_0(long nativeObj, int mode);
+
+ // C++: void cv::StereoSGBM::setP1(int P1)
+ private static native void setP1_0(long nativeObj, int P1);
+
+ // C++: void cv::StereoSGBM::setP2(int P2)
+ private static native void setP2_0(long nativeObj, int P2);
+
+ // C++: void cv::StereoSGBM::setPreFilterCap(int preFilterCap)
+ private static native void setPreFilterCap_0(long nativeObj, int preFilterCap);
+
+ // C++: void cv::StereoSGBM::setUniquenessRatio(int uniquenessRatio)
+ private static native void setUniquenessRatio_0(long nativeObj, int uniquenessRatio);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/core/Algorithm.java b/openCVLibrary3/src/main/java/org/opencv/core/Algorithm.java
new file mode 100644
index 00000000000..8db0fe0187b
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/core/Algorithm.java
@@ -0,0 +1,113 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.core;
+
+import java.lang.String;
+
+// C++: class Algorithm
+//javadoc: Algorithm
+
+public class Algorithm {
+
+ protected final long nativeObj;
+ protected Algorithm(long addr) { nativeObj = addr; }
+
+ public long getNativeObjAddr() { return nativeObj; }
+
+ // internal usage only
+ public static Algorithm __fromPtr__(long addr) { return new Algorithm(addr); }
+
+ //
+ // C++: String cv::Algorithm::getDefaultName()
+ //
+
+ //javadoc: Algorithm::getDefaultName()
+ public String getDefaultName()
+ {
+
+ String retVal = getDefaultName_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: bool cv::Algorithm::empty()
+ //
+
+ //javadoc: Algorithm::empty()
+ public boolean empty()
+ {
+
+ boolean retVal = empty_0(nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: void cv::Algorithm::clear()
+ //
+
+ //javadoc: Algorithm::clear()
+ public void clear()
+ {
+
+ clear_0(nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::Algorithm::read(FileNode fn)
+ //
+
+ // Unknown type 'FileNode' (I), skipping the function
+
+
+ //
+ // C++: void cv::Algorithm::save(String filename)
+ //
+
+ //javadoc: Algorithm::save(filename)
+ public void save(String filename)
+ {
+
+ save_0(nativeObj, filename);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::Algorithm::write(Ptr_FileStorage fs, String name = String())
+ //
+
+ // Unknown type 'Ptr_FileStorage' (I), skipping the function
+
+
+ @Override
+ protected void finalize() throws Throwable {
+ delete(nativeObj);
+ }
+
+
+
+ // C++: String cv::Algorithm::getDefaultName()
+ private static native String getDefaultName_0(long nativeObj);
+
+ // C++: bool cv::Algorithm::empty()
+ private static native boolean empty_0(long nativeObj);
+
+ // C++: void cv::Algorithm::clear()
+ private static native void clear_0(long nativeObj);
+
+ // C++: void cv::Algorithm::save(String filename)
+ private static native void save_0(long nativeObj, String filename);
+
+ // native support for java finalize()
+ private static native void delete(long nativeObj);
+
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/core/Core.java b/openCVLibrary3/src/main/java/org/opencv/core/Core.java
new file mode 100644
index 00000000000..9afc6b3455b
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/core/Core.java
@@ -0,0 +1,2983 @@
+//
+// This file is auto-generated. Please don't modify it!
+//
+package org.opencv.core;
+
+import java.lang.String;
+import java.util.ArrayList;
+import java.util.List;
+import org.opencv.core.Mat;
+import org.opencv.core.MatOfDouble;
+import org.opencv.core.MatOfInt;
+import org.opencv.core.Scalar;
+import org.opencv.core.TermCriteria;
+import org.opencv.utils.Converters;
+
+// C++: class Core
+//javadoc: Core
+
+public class Core {
+ // these constants are wrapped inside functions to prevent inlining
+ private static String getVersion() { return "3.4.3"; }
+ private static String getNativeLibraryName() { return "opencv_java343"; }
+ private static int getVersionMajorJ() { return 3; }
+ private static int getVersionMinorJ() { return 4; }
+ private static int getVersionRevisionJ() { return 3; }
+ private static String getVersionStatusJ() { return ""; }
+
+ public static final String VERSION = getVersion();
+ public static final String NATIVE_LIBRARY_NAME = getNativeLibraryName();
+ public static final int VERSION_MAJOR = getVersionMajorJ();
+ public static final int VERSION_MINOR = getVersionMinorJ();
+ public static final int VERSION_REVISION = getVersionRevisionJ();
+ public static final String VERSION_STATUS = getVersionStatusJ();
+
+ private static final int
+ CV_8U = 0,
+ CV_8S = 1,
+ CV_16U = 2,
+ CV_16S = 3,
+ CV_32S = 4,
+ CV_32F = 5,
+ CV_64F = 6,
+ CV_USRTYPE1 = 7;
+
+
+ public static final int
+ SVD_MODIFY_A = 1,
+ SVD_NO_UV = 2,
+ SVD_FULL_UV = 4,
+ FILLED = -1,
+ REDUCE_SUM = 0,
+ REDUCE_AVG = 1,
+ REDUCE_MAX = 2,
+ REDUCE_MIN = 3,
+ StsOk = 0,
+ StsBackTrace = -1,
+ StsError = -2,
+ StsInternal = -3,
+ StsNoMem = -4,
+ StsBadArg = -5,
+ StsBadFunc = -6,
+ StsNoConv = -7,
+ StsAutoTrace = -8,
+ HeaderIsNull = -9,
+ BadImageSize = -10,
+ BadOffset = -11,
+ BadDataPtr = -12,
+ BadStep = -13,
+ BadModelOrChSeq = -14,
+ BadNumChannels = -15,
+ BadNumChannel1U = -16,
+ BadDepth = -17,
+ BadAlphaChannel = -18,
+ BadOrder = -19,
+ BadOrigin = -20,
+ BadAlign = -21,
+ BadCallBack = -22,
+ BadTileSize = -23,
+ BadCOI = -24,
+ BadROISize = -25,
+ MaskIsTiled = -26,
+ StsNullPtr = -27,
+ StsVecLengthErr = -28,
+ StsFilterStructContentErr = -29,
+ StsKernelStructContentErr = -30,
+ StsFilterOffsetErr = -31,
+ StsBadSize = -201,
+ StsDivByZero = -202,
+ StsInplaceNotSupported = -203,
+ StsObjectNotFound = -204,
+ StsUnmatchedFormats = -205,
+ StsBadFlag = -206,
+ StsBadPoint = -207,
+ StsBadMask = -208,
+ StsUnmatchedSizes = -209,
+ StsUnsupportedFormat = -210,
+ StsOutOfRange = -211,
+ StsParseError = -212,
+ StsNotImplemented = -213,
+ StsBadMemBlock = -214,
+ StsAssert = -215,
+ GpuNotSupported = -216,
+ GpuApiCallError = -217,
+ OpenGlNotSupported = -218,
+ OpenGlApiCallError = -219,
+ OpenCLApiCallError = -220,
+ OpenCLDoubleNotSupported = -221,
+ OpenCLInitError = -222,
+ OpenCLNoAMDBlasFft = -223,
+ DECOMP_LU = 0,
+ DECOMP_SVD = 1,
+ DECOMP_EIG = 2,
+ DECOMP_CHOLESKY = 3,
+ DECOMP_QR = 4,
+ DECOMP_NORMAL = 16,
+ NORM_INF = 1,
+ NORM_L1 = 2,
+ NORM_L2 = 4,
+ NORM_L2SQR = 5,
+ NORM_HAMMING = 6,
+ NORM_HAMMING2 = 7,
+ NORM_TYPE_MASK = 7,
+ NORM_RELATIVE = 8,
+ NORM_MINMAX = 32,
+ CMP_EQ = 0,
+ CMP_GT = 1,
+ CMP_GE = 2,
+ CMP_LT = 3,
+ CMP_LE = 4,
+ CMP_NE = 5,
+ GEMM_1_T = 1,
+ GEMM_2_T = 2,
+ GEMM_3_T = 4,
+ DFT_INVERSE = 1,
+ DFT_SCALE = 2,
+ DFT_ROWS = 4,
+ DFT_COMPLEX_OUTPUT = 16,
+ DFT_REAL_OUTPUT = 32,
+ DFT_COMPLEX_INPUT = 64,
+ DCT_INVERSE = DFT_INVERSE,
+ DCT_ROWS = DFT_ROWS,
+ BORDER_CONSTANT = 0,
+ BORDER_REPLICATE = 1,
+ BORDER_REFLECT = 2,
+ BORDER_WRAP = 3,
+ BORDER_REFLECT_101 = 4,
+ BORDER_TRANSPARENT = 5,
+ BORDER_REFLECT101 = BORDER_REFLECT_101,
+ BORDER_DEFAULT = BORDER_REFLECT_101,
+ BORDER_ISOLATED = 16,
+ SORT_EVERY_ROW = 0,
+ SORT_EVERY_COLUMN = 1,
+ SORT_ASCENDING = 0,
+ SORT_DESCENDING = 16,
+ COVAR_SCRAMBLED = 0,
+ COVAR_NORMAL = 1,
+ COVAR_USE_AVG = 2,
+ COVAR_SCALE = 4,
+ COVAR_ROWS = 8,
+ COVAR_COLS = 16,
+ KMEANS_RANDOM_CENTERS = 0,
+ KMEANS_PP_CENTERS = 2,
+ KMEANS_USE_INITIAL_LABELS = 1,
+ LINE_4 = 4,
+ LINE_8 = 8,
+ LINE_AA = 16,
+ FONT_HERSHEY_SIMPLEX = 0,
+ FONT_HERSHEY_PLAIN = 1,
+ FONT_HERSHEY_DUPLEX = 2,
+ FONT_HERSHEY_COMPLEX = 3,
+ FONT_HERSHEY_TRIPLEX = 4,
+ FONT_HERSHEY_COMPLEX_SMALL = 5,
+ FONT_HERSHEY_SCRIPT_SIMPLEX = 6,
+ FONT_HERSHEY_SCRIPT_COMPLEX = 7,
+ FONT_ITALIC = 16,
+ ROTATE_90_CLOCKWISE = 0,
+ ROTATE_180 = 1,
+ ROTATE_90_COUNTERCLOCKWISE = 2,
+ TYPE_GENERAL = 0,
+ TYPE_MARKER = 0+1,
+ TYPE_WRAPPER = 0+2,
+ TYPE_FUN = 0+3,
+ IMPL_PLAIN = 0,
+ IMPL_IPP = 0+1,
+ IMPL_OPENCL = 0+2,
+ FLAGS_NONE = 0,
+ FLAGS_MAPPING = 0x01,
+ FLAGS_EXPAND_SAME_NAMES = 0x02;
+
+
+ //
+ // C++: Scalar cv::mean(Mat src, Mat mask = Mat())
+ //
+
+ //javadoc: mean(src, mask)
+ public static Scalar mean(Mat src, Mat mask)
+ {
+
+ Scalar retVal = new Scalar(mean_0(src.nativeObj, mask.nativeObj));
+
+ return retVal;
+ }
+
+ //javadoc: mean(src)
+ public static Scalar mean(Mat src)
+ {
+
+ Scalar retVal = new Scalar(mean_1(src.nativeObj));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Scalar cv::sum(Mat src)
+ //
+
+ //javadoc: sumElems(src)
+ public static Scalar sumElems(Mat src)
+ {
+
+ Scalar retVal = new Scalar(sumElems_0(src.nativeObj));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: Scalar cv::trace(Mat mtx)
+ //
+
+ //javadoc: trace(mtx)
+ public static Scalar trace(Mat mtx)
+ {
+
+ Scalar retVal = new Scalar(trace_0(mtx.nativeObj));
+
+ return retVal;
+ }
+
+
+ //
+ // C++: String cv::getBuildInformation()
+ //
+
+ //javadoc: getBuildInformation()
+ public static String getBuildInformation()
+ {
+
+ String retVal = getBuildInformation_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: String cv::getHardwareFeatureName(int feature)
+ //
+
+ //javadoc: getHardwareFeatureName(feature)
+ public static String getHardwareFeatureName(int feature)
+ {
+
+ String retVal = getHardwareFeatureName_0(feature);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: String cv::getVersionString()
+ //
+
+ //javadoc: getVersionString()
+ public static String getVersionString()
+ {
+
+ String retVal = getVersionString_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: String cv::ipp::getIppVersion()
+ //
+
+ //javadoc: getIppVersion()
+ public static String getIppVersion()
+ {
+
+ String retVal = getIppVersion_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: bool cv::checkRange(Mat a, bool quiet = true, _hidden_ * pos = 0, double minVal = -DBL_MAX, double maxVal = DBL_MAX)
+ //
+
+ //javadoc: checkRange(a, quiet, minVal, maxVal)
+ public static boolean checkRange(Mat a, boolean quiet, double minVal, double maxVal)
+ {
+
+ boolean retVal = checkRange_0(a.nativeObj, quiet, minVal, maxVal);
+
+ return retVal;
+ }
+
+ //javadoc: checkRange(a, quiet, minVal)
+ public static boolean checkRange(Mat a, boolean quiet, double minVal)
+ {
+
+ boolean retVal = checkRange_1(a.nativeObj, quiet, minVal);
+
+ return retVal;
+ }
+
+ //javadoc: checkRange(a, quiet)
+ public static boolean checkRange(Mat a, boolean quiet)
+ {
+
+ boolean retVal = checkRange_2(a.nativeObj, quiet);
+
+ return retVal;
+ }
+
+ //javadoc: checkRange(a)
+ public static boolean checkRange(Mat a)
+ {
+
+ boolean retVal = checkRange_4(a.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: bool cv::eigen(Mat src, Mat& eigenvalues, Mat& eigenvectors = Mat())
+ //
+
+ //javadoc: eigen(src, eigenvalues, eigenvectors)
+ public static boolean eigen(Mat src, Mat eigenvalues, Mat eigenvectors)
+ {
+
+ boolean retVal = eigen_0(src.nativeObj, eigenvalues.nativeObj, eigenvectors.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: eigen(src, eigenvalues)
+ public static boolean eigen(Mat src, Mat eigenvalues)
+ {
+
+ boolean retVal = eigen_1(src.nativeObj, eigenvalues.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: bool cv::solve(Mat src1, Mat src2, Mat& dst, int flags = DECOMP_LU)
+ //
+
+ //javadoc: solve(src1, src2, dst, flags)
+ public static boolean solve(Mat src1, Mat src2, Mat dst, int flags)
+ {
+
+ boolean retVal = solve_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, flags);
+
+ return retVal;
+ }
+
+ //javadoc: solve(src1, src2, dst)
+ public static boolean solve(Mat src1, Mat src2, Mat dst)
+ {
+
+ boolean retVal = solve_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: bool cv::ipp::useIPP()
+ //
+
+ //javadoc: useIPP()
+ public static boolean useIPP()
+ {
+
+ boolean retVal = useIPP_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: bool cv::ipp::useIPP_NE()
+ //
+
+ //javadoc: useIPP_NE()
+ public static boolean useIPP_NE()
+ {
+
+ boolean retVal = useIPP_NE_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::Mahalanobis(Mat v1, Mat v2, Mat icovar)
+ //
+
+ //javadoc: Mahalanobis(v1, v2, icovar)
+ public static double Mahalanobis(Mat v1, Mat v2, Mat icovar)
+ {
+
+ double retVal = Mahalanobis_0(v1.nativeObj, v2.nativeObj, icovar.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::PSNR(Mat src1, Mat src2)
+ //
+
+ //javadoc: PSNR(src1, src2)
+ public static double PSNR(Mat src1, Mat src2)
+ {
+
+ double retVal = PSNR_0(src1.nativeObj, src2.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::determinant(Mat mtx)
+ //
+
+ //javadoc: determinant(mtx)
+ public static double determinant(Mat mtx)
+ {
+
+ double retVal = determinant_0(mtx.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::getTickFrequency()
+ //
+
+ //javadoc: getTickFrequency()
+ public static double getTickFrequency()
+ {
+
+ double retVal = getTickFrequency_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::invert(Mat src, Mat& dst, int flags = DECOMP_LU)
+ //
+
+ //javadoc: invert(src, dst, flags)
+ public static double invert(Mat src, Mat dst, int flags)
+ {
+
+ double retVal = invert_0(src.nativeObj, dst.nativeObj, flags);
+
+ return retVal;
+ }
+
+ //javadoc: invert(src, dst)
+ public static double invert(Mat src, Mat dst)
+ {
+
+ double retVal = invert_1(src.nativeObj, dst.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::kmeans(Mat data, int K, Mat& bestLabels, TermCriteria criteria, int attempts, int flags, Mat& centers = Mat())
+ //
+
+ //javadoc: kmeans(data, K, bestLabels, criteria, attempts, flags, centers)
+ public static double kmeans(Mat data, int K, Mat bestLabels, TermCriteria criteria, int attempts, int flags, Mat centers)
+ {
+
+ double retVal = kmeans_0(data.nativeObj, K, bestLabels.nativeObj, criteria.type, criteria.maxCount, criteria.epsilon, attempts, flags, centers.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: kmeans(data, K, bestLabels, criteria, attempts, flags)
+ public static double kmeans(Mat data, int K, Mat bestLabels, TermCriteria criteria, int attempts, int flags)
+ {
+
+ double retVal = kmeans_1(data.nativeObj, K, bestLabels.nativeObj, criteria.type, criteria.maxCount, criteria.epsilon, attempts, flags);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::norm(Mat src1, Mat src2, int normType = NORM_L2, Mat mask = Mat())
+ //
+
+ //javadoc: norm(src1, src2, normType, mask)
+ public static double norm(Mat src1, Mat src2, int normType, Mat mask)
+ {
+
+ double retVal = norm_0(src1.nativeObj, src2.nativeObj, normType, mask.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: norm(src1, src2, normType)
+ public static double norm(Mat src1, Mat src2, int normType)
+ {
+
+ double retVal = norm_1(src1.nativeObj, src2.nativeObj, normType);
+
+ return retVal;
+ }
+
+ //javadoc: norm(src1, src2)
+ public static double norm(Mat src1, Mat src2)
+ {
+
+ double retVal = norm_2(src1.nativeObj, src2.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::norm(Mat src1, int normType = NORM_L2, Mat mask = Mat())
+ //
+
+ //javadoc: norm(src1, normType, mask)
+ public static double norm(Mat src1, int normType, Mat mask)
+ {
+
+ double retVal = norm_3(src1.nativeObj, normType, mask.nativeObj);
+
+ return retVal;
+ }
+
+ //javadoc: norm(src1, normType)
+ public static double norm(Mat src1, int normType)
+ {
+
+ double retVal = norm_4(src1.nativeObj, normType);
+
+ return retVal;
+ }
+
+ //javadoc: norm(src1)
+ public static double norm(Mat src1)
+ {
+
+ double retVal = norm_5(src1.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: double cv::solvePoly(Mat coeffs, Mat& roots, int maxIters = 300)
+ //
+
+ //javadoc: solvePoly(coeffs, roots, maxIters)
+ public static double solvePoly(Mat coeffs, Mat roots, int maxIters)
+ {
+
+ double retVal = solvePoly_0(coeffs.nativeObj, roots.nativeObj, maxIters);
+
+ return retVal;
+ }
+
+ //javadoc: solvePoly(coeffs, roots)
+ public static double solvePoly(Mat coeffs, Mat roots)
+ {
+
+ double retVal = solvePoly_1(coeffs.nativeObj, roots.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: float cv::cubeRoot(float val)
+ //
+
+ //javadoc: cubeRoot(val)
+ public static float cubeRoot(float val)
+ {
+
+ float retVal = cubeRoot_0(val);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: float cv::fastAtan2(float y, float x)
+ //
+
+ //javadoc: fastAtan2(y, x)
+ public static float fastAtan2(float y, float x)
+ {
+
+ float retVal = fastAtan2_0(y, x);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::borderInterpolate(int p, int len, int borderType)
+ //
+
+ //javadoc: borderInterpolate(p, len, borderType)
+ public static int borderInterpolate(int p, int len, int borderType)
+ {
+
+ int retVal = borderInterpolate_0(p, len, borderType);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::countNonZero(Mat src)
+ //
+
+ //javadoc: countNonZero(src)
+ public static int countNonZero(Mat src)
+ {
+
+ int retVal = countNonZero_0(src.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::getNumThreads()
+ //
+
+ //javadoc: getNumThreads()
+ public static int getNumThreads()
+ {
+
+ int retVal = getNumThreads_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::getNumberOfCPUs()
+ //
+
+ //javadoc: getNumberOfCPUs()
+ public static int getNumberOfCPUs()
+ {
+
+ int retVal = getNumberOfCPUs_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::getOptimalDFTSize(int vecsize)
+ //
+
+ //javadoc: getOptimalDFTSize(vecsize)
+ public static int getOptimalDFTSize(int vecsize)
+ {
+
+ int retVal = getOptimalDFTSize_0(vecsize);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::getThreadNum()
+ //
+
+ //javadoc: getThreadNum()
+ @Deprecated
+ public static int getThreadNum()
+ {
+
+ int retVal = getThreadNum_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::getVersionMajor()
+ //
+
+ //javadoc: getVersionMajor()
+ public static int getVersionMajor()
+ {
+
+ int retVal = getVersionMajor_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::getVersionMinor()
+ //
+
+ //javadoc: getVersionMinor()
+ public static int getVersionMinor()
+ {
+
+ int retVal = getVersionMinor_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::getVersionRevision()
+ //
+
+ //javadoc: getVersionRevision()
+ public static int getVersionRevision()
+ {
+
+ int retVal = getVersionRevision_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int cv::solveCubic(Mat coeffs, Mat& roots)
+ //
+
+ //javadoc: solveCubic(coeffs, roots)
+ public static int solveCubic(Mat coeffs, Mat roots)
+ {
+
+ int retVal = solveCubic_0(coeffs.nativeObj, roots.nativeObj);
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int64 cv::getCPUTickCount()
+ //
+
+ //javadoc: getCPUTickCount()
+ public static long getCPUTickCount()
+ {
+
+ long retVal = getCPUTickCount_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: int64 cv::getTickCount()
+ //
+
+ //javadoc: getTickCount()
+ public static long getTickCount()
+ {
+
+ long retVal = getTickCount_0();
+
+ return retVal;
+ }
+
+
+ //
+ // C++: void cv::LUT(Mat src, Mat lut, Mat& dst)
+ //
+
+ //javadoc: LUT(src, lut, dst)
+ public static void LUT(Mat src, Mat lut, Mat dst)
+ {
+
+ LUT_0(src.nativeObj, lut.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::PCABackProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
+ //
+
+ //javadoc: PCABackProject(data, mean, eigenvectors, result)
+ public static void PCABackProject(Mat data, Mat mean, Mat eigenvectors, Mat result)
+ {
+
+ PCABackProject_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, result.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, double retainedVariance)
+ //
+
+ //javadoc: PCACompute2(data, mean, eigenvectors, eigenvalues, retainedVariance)
+ public static void PCACompute2(Mat data, Mat mean, Mat eigenvectors, Mat eigenvalues, double retainedVariance)
+ {
+
+ PCACompute2_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, eigenvalues.nativeObj, retainedVariance);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, int maxComponents = 0)
+ //
+
+ //javadoc: PCACompute2(data, mean, eigenvectors, eigenvalues, maxComponents)
+ public static void PCACompute2(Mat data, Mat mean, Mat eigenvectors, Mat eigenvalues, int maxComponents)
+ {
+
+ PCACompute2_1(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, eigenvalues.nativeObj, maxComponents);
+
+ return;
+ }
+
+ //javadoc: PCACompute2(data, mean, eigenvectors, eigenvalues)
+ public static void PCACompute2(Mat data, Mat mean, Mat eigenvectors, Mat eigenvalues)
+ {
+
+ PCACompute2_2(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, eigenvalues.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, double retainedVariance)
+ //
+
+ //javadoc: PCACompute(data, mean, eigenvectors, retainedVariance)
+ public static void PCACompute(Mat data, Mat mean, Mat eigenvectors, double retainedVariance)
+ {
+
+ PCACompute_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, retainedVariance);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, int maxComponents = 0)
+ //
+
+ //javadoc: PCACompute(data, mean, eigenvectors, maxComponents)
+ public static void PCACompute(Mat data, Mat mean, Mat eigenvectors, int maxComponents)
+ {
+
+ PCACompute_1(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, maxComponents);
+
+ return;
+ }
+
+ //javadoc: PCACompute(data, mean, eigenvectors)
+ public static void PCACompute(Mat data, Mat mean, Mat eigenvectors)
+ {
+
+ PCACompute_2(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::PCAProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
+ //
+
+ //javadoc: PCAProject(data, mean, eigenvectors, result)
+ public static void PCAProject(Mat data, Mat mean, Mat eigenvectors, Mat result)
+ {
+
+ PCAProject_0(data.nativeObj, mean.nativeObj, eigenvectors.nativeObj, result.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::SVBackSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat& dst)
+ //
+
+ //javadoc: SVBackSubst(w, u, vt, rhs, dst)
+ public static void SVBackSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat dst)
+ {
+
+ SVBackSubst_0(w.nativeObj, u.nativeObj, vt.nativeObj, rhs.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::SVDecomp(Mat src, Mat& w, Mat& u, Mat& vt, int flags = 0)
+ //
+
+ //javadoc: SVDecomp(src, w, u, vt, flags)
+ public static void SVDecomp(Mat src, Mat w, Mat u, Mat vt, int flags)
+ {
+
+ SVDecomp_0(src.nativeObj, w.nativeObj, u.nativeObj, vt.nativeObj, flags);
+
+ return;
+ }
+
+ //javadoc: SVDecomp(src, w, u, vt)
+ public static void SVDecomp(Mat src, Mat w, Mat u, Mat vt)
+ {
+
+ SVDecomp_1(src.nativeObj, w.nativeObj, u.nativeObj, vt.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::absdiff(Mat src1, Mat src2, Mat& dst)
+ //
+
+ //javadoc: absdiff(src1, src2, dst)
+ public static void absdiff(Mat src1, Mat src2, Mat dst)
+ {
+
+ absdiff_0(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::absdiff(Mat src1, Scalar src2, Mat& dst)
+ //
+
+ //javadoc: absdiff(src1, src2, dst)
+ public static void absdiff(Mat src1, Scalar src2, Mat dst)
+ {
+
+ absdiff_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::add(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ //
+
+ //javadoc: add(src1, src2, dst, mask, dtype)
+ public static void add(Mat src1, Mat src2, Mat dst, Mat mask, int dtype)
+ {
+
+ add_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj, dtype);
+
+ return;
+ }
+
+ //javadoc: add(src1, src2, dst, mask)
+ public static void add(Mat src1, Mat src2, Mat dst, Mat mask)
+ {
+
+ add_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: add(src1, src2, dst)
+ public static void add(Mat src1, Mat src2, Mat dst)
+ {
+
+ add_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::add(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ //
+
+ //javadoc: add(src1, src2, dst, mask, dtype)
+ public static void add(Mat src1, Scalar src2, Mat dst, Mat mask, int dtype)
+ {
+
+ add_3(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj, dtype);
+
+ return;
+ }
+
+ //javadoc: add(src1, src2, dst, mask)
+ public static void add(Mat src1, Scalar src2, Mat dst, Mat mask)
+ {
+
+ add_4(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: add(src1, src2, dst)
+ public static void add(Mat src1, Scalar src2, Mat dst)
+ {
+
+ add_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat& dst, int dtype = -1)
+ //
+
+ //javadoc: addWeighted(src1, alpha, src2, beta, gamma, dst, dtype)
+ public static void addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat dst, int dtype)
+ {
+
+ addWeighted_0(src1.nativeObj, alpha, src2.nativeObj, beta, gamma, dst.nativeObj, dtype);
+
+ return;
+ }
+
+ //javadoc: addWeighted(src1, alpha, src2, beta, gamma, dst)
+ public static void addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat dst)
+ {
+
+ addWeighted_1(src1.nativeObj, alpha, src2.nativeObj, beta, gamma, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::batchDistance(Mat src1, Mat src2, Mat& dist, int dtype, Mat& nidx, int normType = NORM_L2, int K = 0, Mat mask = Mat(), int update = 0, bool crosscheck = false)
+ //
+
+ //javadoc: batchDistance(src1, src2, dist, dtype, nidx, normType, K, mask, update, crosscheck)
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K, Mat mask, int update, boolean crosscheck)
+ {
+
+ batchDistance_0(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K, mask.nativeObj, update, crosscheck);
+
+ return;
+ }
+
+ //javadoc: batchDistance(src1, src2, dist, dtype, nidx, normType, K, mask, update)
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K, Mat mask, int update)
+ {
+
+ batchDistance_1(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K, mask.nativeObj, update);
+
+ return;
+ }
+
+ //javadoc: batchDistance(src1, src2, dist, dtype, nidx, normType, K, mask)
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K, Mat mask)
+ {
+
+ batchDistance_2(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K, mask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: batchDistance(src1, src2, dist, dtype, nidx, normType, K)
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType, int K)
+ {
+
+ batchDistance_3(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType, K);
+
+ return;
+ }
+
+ //javadoc: batchDistance(src1, src2, dist, dtype, nidx, normType)
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx, int normType)
+ {
+
+ batchDistance_4(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj, normType);
+
+ return;
+ }
+
+ //javadoc: batchDistance(src1, src2, dist, dtype, nidx)
+ public static void batchDistance(Mat src1, Mat src2, Mat dist, int dtype, Mat nidx)
+ {
+
+ batchDistance_5(src1.nativeObj, src2.nativeObj, dist.nativeObj, dtype, nidx.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::bitwise_and(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ //
+
+ //javadoc: bitwise_and(src1, src2, dst, mask)
+ public static void bitwise_and(Mat src1, Mat src2, Mat dst, Mat mask)
+ {
+
+ bitwise_and_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: bitwise_and(src1, src2, dst)
+ public static void bitwise_and(Mat src1, Mat src2, Mat dst)
+ {
+
+ bitwise_and_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::bitwise_not(Mat src, Mat& dst, Mat mask = Mat())
+ //
+
+ //javadoc: bitwise_not(src, dst, mask)
+ public static void bitwise_not(Mat src, Mat dst, Mat mask)
+ {
+
+ bitwise_not_0(src.nativeObj, dst.nativeObj, mask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: bitwise_not(src, dst)
+ public static void bitwise_not(Mat src, Mat dst)
+ {
+
+ bitwise_not_1(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::bitwise_or(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ //
+
+ //javadoc: bitwise_or(src1, src2, dst, mask)
+ public static void bitwise_or(Mat src1, Mat src2, Mat dst, Mat mask)
+ {
+
+ bitwise_or_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: bitwise_or(src1, src2, dst)
+ public static void bitwise_or(Mat src1, Mat src2, Mat dst)
+ {
+
+ bitwise_or_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::bitwise_xor(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ //
+
+ //javadoc: bitwise_xor(src1, src2, dst, mask)
+ public static void bitwise_xor(Mat src1, Mat src2, Mat dst, Mat mask)
+ {
+
+ bitwise_xor_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: bitwise_xor(src1, src2, dst)
+ public static void bitwise_xor(Mat src1, Mat src2, Mat dst)
+ {
+
+ bitwise_xor_1(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::calcCovarMatrix(Mat samples, Mat& covar, Mat& mean, int flags, int ctype = CV_64F)
+ //
+
+ //javadoc: calcCovarMatrix(samples, covar, mean, flags, ctype)
+ public static void calcCovarMatrix(Mat samples, Mat covar, Mat mean, int flags, int ctype)
+ {
+
+ calcCovarMatrix_0(samples.nativeObj, covar.nativeObj, mean.nativeObj, flags, ctype);
+
+ return;
+ }
+
+ //javadoc: calcCovarMatrix(samples, covar, mean, flags)
+ public static void calcCovarMatrix(Mat samples, Mat covar, Mat mean, int flags)
+ {
+
+ calcCovarMatrix_1(samples.nativeObj, covar.nativeObj, mean.nativeObj, flags);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::cartToPolar(Mat x, Mat y, Mat& magnitude, Mat& angle, bool angleInDegrees = false)
+ //
+
+ //javadoc: cartToPolar(x, y, magnitude, angle, angleInDegrees)
+ public static void cartToPolar(Mat x, Mat y, Mat magnitude, Mat angle, boolean angleInDegrees)
+ {
+
+ cartToPolar_0(x.nativeObj, y.nativeObj, magnitude.nativeObj, angle.nativeObj, angleInDegrees);
+
+ return;
+ }
+
+ //javadoc: cartToPolar(x, y, magnitude, angle)
+ public static void cartToPolar(Mat x, Mat y, Mat magnitude, Mat angle)
+ {
+
+ cartToPolar_1(x.nativeObj, y.nativeObj, magnitude.nativeObj, angle.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::compare(Mat src1, Mat src2, Mat& dst, int cmpop)
+ //
+
+ //javadoc: compare(src1, src2, dst, cmpop)
+ public static void compare(Mat src1, Mat src2, Mat dst, int cmpop)
+ {
+
+ compare_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, cmpop);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::compare(Mat src1, Scalar src2, Mat& dst, int cmpop)
+ //
+
+ //javadoc: compare(src1, src2, dst, cmpop)
+ public static void compare(Mat src1, Scalar src2, Mat dst, int cmpop)
+ {
+
+ compare_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, cmpop);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::completeSymm(Mat& m, bool lowerToUpper = false)
+ //
+
+ //javadoc: completeSymm(m, lowerToUpper)
+ public static void completeSymm(Mat m, boolean lowerToUpper)
+ {
+
+ completeSymm_0(m.nativeObj, lowerToUpper);
+
+ return;
+ }
+
+ //javadoc: completeSymm(m)
+ public static void completeSymm(Mat m)
+ {
+
+ completeSymm_1(m.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::convertFp16(Mat src, Mat& dst)
+ //
+
+ //javadoc: convertFp16(src, dst)
+ public static void convertFp16(Mat src, Mat dst)
+ {
+
+ convertFp16_0(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::convertScaleAbs(Mat src, Mat& dst, double alpha = 1, double beta = 0)
+ //
+
+ //javadoc: convertScaleAbs(src, dst, alpha, beta)
+ public static void convertScaleAbs(Mat src, Mat dst, double alpha, double beta)
+ {
+
+ convertScaleAbs_0(src.nativeObj, dst.nativeObj, alpha, beta);
+
+ return;
+ }
+
+ //javadoc: convertScaleAbs(src, dst, alpha)
+ public static void convertScaleAbs(Mat src, Mat dst, double alpha)
+ {
+
+ convertScaleAbs_1(src.nativeObj, dst.nativeObj, alpha);
+
+ return;
+ }
+
+ //javadoc: convertScaleAbs(src, dst)
+ public static void convertScaleAbs(Mat src, Mat dst)
+ {
+
+ convertScaleAbs_2(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::copyMakeBorder(Mat src, Mat& dst, int top, int bottom, int left, int right, int borderType, Scalar value = Scalar())
+ //
+
+ //javadoc: copyMakeBorder(src, dst, top, bottom, left, right, borderType, value)
+ public static void copyMakeBorder(Mat src, Mat dst, int top, int bottom, int left, int right, int borderType, Scalar value)
+ {
+
+ copyMakeBorder_0(src.nativeObj, dst.nativeObj, top, bottom, left, right, borderType, value.val[0], value.val[1], value.val[2], value.val[3]);
+
+ return;
+ }
+
+ //javadoc: copyMakeBorder(src, dst, top, bottom, left, right, borderType)
+ public static void copyMakeBorder(Mat src, Mat dst, int top, int bottom, int left, int right, int borderType)
+ {
+
+ copyMakeBorder_1(src.nativeObj, dst.nativeObj, top, bottom, left, right, borderType);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::dct(Mat src, Mat& dst, int flags = 0)
+ //
+
+ //javadoc: dct(src, dst, flags)
+ public static void dct(Mat src, Mat dst, int flags)
+ {
+
+ dct_0(src.nativeObj, dst.nativeObj, flags);
+
+ return;
+ }
+
+ //javadoc: dct(src, dst)
+ public static void dct(Mat src, Mat dst)
+ {
+
+ dct_1(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::dft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
+ //
+
+ //javadoc: dft(src, dst, flags, nonzeroRows)
+ public static void dft(Mat src, Mat dst, int flags, int nonzeroRows)
+ {
+
+ dft_0(src.nativeObj, dst.nativeObj, flags, nonzeroRows);
+
+ return;
+ }
+
+ //javadoc: dft(src, dst, flags)
+ public static void dft(Mat src, Mat dst, int flags)
+ {
+
+ dft_1(src.nativeObj, dst.nativeObj, flags);
+
+ return;
+ }
+
+ //javadoc: dft(src, dst)
+ public static void dft(Mat src, Mat dst)
+ {
+
+ dft_2(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::divide(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
+ //
+
+ //javadoc: divide(src1, src2, dst, scale, dtype)
+ public static void divide(Mat src1, Mat src2, Mat dst, double scale, int dtype)
+ {
+
+ divide_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale, dtype);
+
+ return;
+ }
+
+ //javadoc: divide(src1, src2, dst, scale)
+ public static void divide(Mat src1, Mat src2, Mat dst, double scale)
+ {
+
+ divide_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale);
+
+ return;
+ }
+
+ //javadoc: divide(src1, src2, dst)
+ public static void divide(Mat src1, Mat src2, Mat dst)
+ {
+
+ divide_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::divide(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
+ //
+
+ //javadoc: divide(src1, src2, dst, scale, dtype)
+ public static void divide(Mat src1, Scalar src2, Mat dst, double scale, int dtype)
+ {
+
+ divide_3(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale, dtype);
+
+ return;
+ }
+
+ //javadoc: divide(src1, src2, dst, scale)
+ public static void divide(Mat src1, Scalar src2, Mat dst, double scale)
+ {
+
+ divide_4(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale);
+
+ return;
+ }
+
+ //javadoc: divide(src1, src2, dst)
+ public static void divide(Mat src1, Scalar src2, Mat dst)
+ {
+
+ divide_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::divide(double scale, Mat src2, Mat& dst, int dtype = -1)
+ //
+
+ //javadoc: divide(scale, src2, dst, dtype)
+ public static void divide(double scale, Mat src2, Mat dst, int dtype)
+ {
+
+ divide_6(scale, src2.nativeObj, dst.nativeObj, dtype);
+
+ return;
+ }
+
+ //javadoc: divide(scale, src2, dst)
+ public static void divide(double scale, Mat src2, Mat dst)
+ {
+
+ divide_7(scale, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::eigenNonSymmetric(Mat src, Mat& eigenvalues, Mat& eigenvectors)
+ //
+
+ //javadoc: eigenNonSymmetric(src, eigenvalues, eigenvectors)
+ public static void eigenNonSymmetric(Mat src, Mat eigenvalues, Mat eigenvectors)
+ {
+
+ eigenNonSymmetric_0(src.nativeObj, eigenvalues.nativeObj, eigenvectors.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::exp(Mat src, Mat& dst)
+ //
+
+ //javadoc: exp(src, dst)
+ public static void exp(Mat src, Mat dst)
+ {
+
+ exp_0(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::extractChannel(Mat src, Mat& dst, int coi)
+ //
+
+ //javadoc: extractChannel(src, dst, coi)
+ public static void extractChannel(Mat src, Mat dst, int coi)
+ {
+
+ extractChannel_0(src.nativeObj, dst.nativeObj, coi);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::findNonZero(Mat src, Mat& idx)
+ //
+
+ //javadoc: findNonZero(src, idx)
+ public static void findNonZero(Mat src, Mat idx)
+ {
+
+ findNonZero_0(src.nativeObj, idx.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::flip(Mat src, Mat& dst, int flipCode)
+ //
+
+ //javadoc: flip(src, dst, flipCode)
+ public static void flip(Mat src, Mat dst, int flipCode)
+ {
+
+ flip_0(src.nativeObj, dst.nativeObj, flipCode);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat& dst, int flags = 0)
+ //
+
+ //javadoc: gemm(src1, src2, alpha, src3, beta, dst, flags)
+ public static void gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat dst, int flags)
+ {
+
+ gemm_0(src1.nativeObj, src2.nativeObj, alpha, src3.nativeObj, beta, dst.nativeObj, flags);
+
+ return;
+ }
+
+ //javadoc: gemm(src1, src2, alpha, src3, beta, dst)
+ public static void gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat dst)
+ {
+
+ gemm_1(src1.nativeObj, src2.nativeObj, alpha, src3.nativeObj, beta, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::hconcat(vector_Mat src, Mat& dst)
+ //
+
+ //javadoc: hconcat(src, dst)
+ public static void hconcat(List src, Mat dst)
+ {
+ Mat src_mat = Converters.vector_Mat_to_Mat(src);
+ hconcat_0(src_mat.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::idct(Mat src, Mat& dst, int flags = 0)
+ //
+
+ //javadoc: idct(src, dst, flags)
+ public static void idct(Mat src, Mat dst, int flags)
+ {
+
+ idct_0(src.nativeObj, dst.nativeObj, flags);
+
+ return;
+ }
+
+ //javadoc: idct(src, dst)
+ public static void idct(Mat src, Mat dst)
+ {
+
+ idct_1(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::idft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
+ //
+
+ //javadoc: idft(src, dst, flags, nonzeroRows)
+ public static void idft(Mat src, Mat dst, int flags, int nonzeroRows)
+ {
+
+ idft_0(src.nativeObj, dst.nativeObj, flags, nonzeroRows);
+
+ return;
+ }
+
+ //javadoc: idft(src, dst, flags)
+ public static void idft(Mat src, Mat dst, int flags)
+ {
+
+ idft_1(src.nativeObj, dst.nativeObj, flags);
+
+ return;
+ }
+
+ //javadoc: idft(src, dst)
+ public static void idft(Mat src, Mat dst)
+ {
+
+ idft_2(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::inRange(Mat src, Scalar lowerb, Scalar upperb, Mat& dst)
+ //
+
+ //javadoc: inRange(src, lowerb, upperb, dst)
+ public static void inRange(Mat src, Scalar lowerb, Scalar upperb, Mat dst)
+ {
+
+ inRange_0(src.nativeObj, lowerb.val[0], lowerb.val[1], lowerb.val[2], lowerb.val[3], upperb.val[0], upperb.val[1], upperb.val[2], upperb.val[3], dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::insertChannel(Mat src, Mat& dst, int coi)
+ //
+
+ //javadoc: insertChannel(src, dst, coi)
+ public static void insertChannel(Mat src, Mat dst, int coi)
+ {
+
+ insertChannel_0(src.nativeObj, dst.nativeObj, coi);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::log(Mat src, Mat& dst)
+ //
+
+ //javadoc: log(src, dst)
+ public static void log(Mat src, Mat dst)
+ {
+
+ log_0(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::magnitude(Mat x, Mat y, Mat& magnitude)
+ //
+
+ //javadoc: magnitude(x, y, magnitude)
+ public static void magnitude(Mat x, Mat y, Mat magnitude)
+ {
+
+ magnitude_0(x.nativeObj, y.nativeObj, magnitude.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::max(Mat src1, Mat src2, Mat& dst)
+ //
+
+ //javadoc: max(src1, src2, dst)
+ public static void max(Mat src1, Mat src2, Mat dst)
+ {
+
+ max_0(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::max(Mat src1, Scalar src2, Mat& dst)
+ //
+
+ //javadoc: max(src1, src2, dst)
+ public static void max(Mat src1, Scalar src2, Mat dst)
+ {
+
+ max_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::meanStdDev(Mat src, vector_double& mean, vector_double& stddev, Mat mask = Mat())
+ //
+
+ //javadoc: meanStdDev(src, mean, stddev, mask)
+ public static void meanStdDev(Mat src, MatOfDouble mean, MatOfDouble stddev, Mat mask)
+ {
+ Mat mean_mat = mean;
+ Mat stddev_mat = stddev;
+ meanStdDev_0(src.nativeObj, mean_mat.nativeObj, stddev_mat.nativeObj, mask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: meanStdDev(src, mean, stddev)
+ public static void meanStdDev(Mat src, MatOfDouble mean, MatOfDouble stddev)
+ {
+ Mat mean_mat = mean;
+ Mat stddev_mat = stddev;
+ meanStdDev_1(src.nativeObj, mean_mat.nativeObj, stddev_mat.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::merge(vector_Mat mv, Mat& dst)
+ //
+
+ //javadoc: merge(mv, dst)
+ public static void merge(List mv, Mat dst)
+ {
+ Mat mv_mat = Converters.vector_Mat_to_Mat(mv);
+ merge_0(mv_mat.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::min(Mat src1, Mat src2, Mat& dst)
+ //
+
+ //javadoc: min(src1, src2, dst)
+ public static void min(Mat src1, Mat src2, Mat dst)
+ {
+
+ min_0(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::min(Mat src1, Scalar src2, Mat& dst)
+ //
+
+ //javadoc: min(src1, src2, dst)
+ public static void min(Mat src1, Scalar src2, Mat dst)
+ {
+
+ min_1(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::mixChannels(vector_Mat src, vector_Mat dst, vector_int fromTo)
+ //
+
+ //javadoc: mixChannels(src, dst, fromTo)
+ public static void mixChannels(List src, List dst, MatOfInt fromTo)
+ {
+ Mat src_mat = Converters.vector_Mat_to_Mat(src);
+ Mat dst_mat = Converters.vector_Mat_to_Mat(dst);
+ Mat fromTo_mat = fromTo;
+ mixChannels_0(src_mat.nativeObj, dst_mat.nativeObj, fromTo_mat.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::mulSpectrums(Mat a, Mat b, Mat& c, int flags, bool conjB = false)
+ //
+
+ //javadoc: mulSpectrums(a, b, c, flags, conjB)
+ public static void mulSpectrums(Mat a, Mat b, Mat c, int flags, boolean conjB)
+ {
+
+ mulSpectrums_0(a.nativeObj, b.nativeObj, c.nativeObj, flags, conjB);
+
+ return;
+ }
+
+ //javadoc: mulSpectrums(a, b, c, flags)
+ public static void mulSpectrums(Mat a, Mat b, Mat c, int flags)
+ {
+
+ mulSpectrums_1(a.nativeObj, b.nativeObj, c.nativeObj, flags);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::mulTransposed(Mat src, Mat& dst, bool aTa, Mat delta = Mat(), double scale = 1, int dtype = -1)
+ //
+
+ //javadoc: mulTransposed(src, dst, aTa, delta, scale, dtype)
+ public static void mulTransposed(Mat src, Mat dst, boolean aTa, Mat delta, double scale, int dtype)
+ {
+
+ mulTransposed_0(src.nativeObj, dst.nativeObj, aTa, delta.nativeObj, scale, dtype);
+
+ return;
+ }
+
+ //javadoc: mulTransposed(src, dst, aTa, delta, scale)
+ public static void mulTransposed(Mat src, Mat dst, boolean aTa, Mat delta, double scale)
+ {
+
+ mulTransposed_1(src.nativeObj, dst.nativeObj, aTa, delta.nativeObj, scale);
+
+ return;
+ }
+
+ //javadoc: mulTransposed(src, dst, aTa, delta)
+ public static void mulTransposed(Mat src, Mat dst, boolean aTa, Mat delta)
+ {
+
+ mulTransposed_2(src.nativeObj, dst.nativeObj, aTa, delta.nativeObj);
+
+ return;
+ }
+
+ //javadoc: mulTransposed(src, dst, aTa)
+ public static void mulTransposed(Mat src, Mat dst, boolean aTa)
+ {
+
+ mulTransposed_3(src.nativeObj, dst.nativeObj, aTa);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::multiply(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
+ //
+
+ //javadoc: multiply(src1, src2, dst, scale, dtype)
+ public static void multiply(Mat src1, Mat src2, Mat dst, double scale, int dtype)
+ {
+
+ multiply_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale, dtype);
+
+ return;
+ }
+
+ //javadoc: multiply(src1, src2, dst, scale)
+ public static void multiply(Mat src1, Mat src2, Mat dst, double scale)
+ {
+
+ multiply_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, scale);
+
+ return;
+ }
+
+ //javadoc: multiply(src1, src2, dst)
+ public static void multiply(Mat src1, Mat src2, Mat dst)
+ {
+
+ multiply_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::multiply(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
+ //
+
+ //javadoc: multiply(src1, src2, dst, scale, dtype)
+ public static void multiply(Mat src1, Scalar src2, Mat dst, double scale, int dtype)
+ {
+
+ multiply_3(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale, dtype);
+
+ return;
+ }
+
+ //javadoc: multiply(src1, src2, dst, scale)
+ public static void multiply(Mat src1, Scalar src2, Mat dst, double scale)
+ {
+
+ multiply_4(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, scale);
+
+ return;
+ }
+
+ //javadoc: multiply(src1, src2, dst)
+ public static void multiply(Mat src1, Scalar src2, Mat dst)
+ {
+
+ multiply_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::normalize(Mat src, Mat& dst, double alpha = 1, double beta = 0, int norm_type = NORM_L2, int dtype = -1, Mat mask = Mat())
+ //
+
+ //javadoc: normalize(src, dst, alpha, beta, norm_type, dtype, mask)
+ public static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type, int dtype, Mat mask)
+ {
+
+ normalize_0(src.nativeObj, dst.nativeObj, alpha, beta, norm_type, dtype, mask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: normalize(src, dst, alpha, beta, norm_type, dtype)
+ public static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type, int dtype)
+ {
+
+ normalize_1(src.nativeObj, dst.nativeObj, alpha, beta, norm_type, dtype);
+
+ return;
+ }
+
+ //javadoc: normalize(src, dst, alpha, beta, norm_type)
+ public static void normalize(Mat src, Mat dst, double alpha, double beta, int norm_type)
+ {
+
+ normalize_2(src.nativeObj, dst.nativeObj, alpha, beta, norm_type);
+
+ return;
+ }
+
+ //javadoc: normalize(src, dst, alpha, beta)
+ public static void normalize(Mat src, Mat dst, double alpha, double beta)
+ {
+
+ normalize_3(src.nativeObj, dst.nativeObj, alpha, beta);
+
+ return;
+ }
+
+ //javadoc: normalize(src, dst, alpha)
+ public static void normalize(Mat src, Mat dst, double alpha)
+ {
+
+ normalize_4(src.nativeObj, dst.nativeObj, alpha);
+
+ return;
+ }
+
+ //javadoc: normalize(src, dst)
+ public static void normalize(Mat src, Mat dst)
+ {
+
+ normalize_5(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::patchNaNs(Mat& a, double val = 0)
+ //
+
+ //javadoc: patchNaNs(a, val)
+ public static void patchNaNs(Mat a, double val)
+ {
+
+ patchNaNs_0(a.nativeObj, val);
+
+ return;
+ }
+
+ //javadoc: patchNaNs(a)
+ public static void patchNaNs(Mat a)
+ {
+
+ patchNaNs_1(a.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::perspectiveTransform(Mat src, Mat& dst, Mat m)
+ //
+
+ //javadoc: perspectiveTransform(src, dst, m)
+ public static void perspectiveTransform(Mat src, Mat dst, Mat m)
+ {
+
+ perspectiveTransform_0(src.nativeObj, dst.nativeObj, m.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::phase(Mat x, Mat y, Mat& angle, bool angleInDegrees = false)
+ //
+
+ //javadoc: phase(x, y, angle, angleInDegrees)
+ public static void phase(Mat x, Mat y, Mat angle, boolean angleInDegrees)
+ {
+
+ phase_0(x.nativeObj, y.nativeObj, angle.nativeObj, angleInDegrees);
+
+ return;
+ }
+
+ //javadoc: phase(x, y, angle)
+ public static void phase(Mat x, Mat y, Mat angle)
+ {
+
+ phase_1(x.nativeObj, y.nativeObj, angle.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::polarToCart(Mat magnitude, Mat angle, Mat& x, Mat& y, bool angleInDegrees = false)
+ //
+
+ //javadoc: polarToCart(magnitude, angle, x, y, angleInDegrees)
+ public static void polarToCart(Mat magnitude, Mat angle, Mat x, Mat y, boolean angleInDegrees)
+ {
+
+ polarToCart_0(magnitude.nativeObj, angle.nativeObj, x.nativeObj, y.nativeObj, angleInDegrees);
+
+ return;
+ }
+
+ //javadoc: polarToCart(magnitude, angle, x, y)
+ public static void polarToCart(Mat magnitude, Mat angle, Mat x, Mat y)
+ {
+
+ polarToCart_1(magnitude.nativeObj, angle.nativeObj, x.nativeObj, y.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::pow(Mat src, double power, Mat& dst)
+ //
+
+ //javadoc: pow(src, power, dst)
+ public static void pow(Mat src, double power, Mat dst)
+ {
+
+ pow_0(src.nativeObj, power, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::randShuffle(Mat& dst, double iterFactor = 1., RNG* rng = 0)
+ //
+
+ //javadoc: randShuffle(dst, iterFactor)
+ public static void randShuffle(Mat dst, double iterFactor)
+ {
+
+ randShuffle_0(dst.nativeObj, iterFactor);
+
+ return;
+ }
+
+ //javadoc: randShuffle(dst)
+ public static void randShuffle(Mat dst)
+ {
+
+ randShuffle_2(dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::randn(Mat& dst, double mean, double stddev)
+ //
+
+ //javadoc: randn(dst, mean, stddev)
+ public static void randn(Mat dst, double mean, double stddev)
+ {
+
+ randn_0(dst.nativeObj, mean, stddev);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::randu(Mat& dst, double low, double high)
+ //
+
+ //javadoc: randu(dst, low, high)
+ public static void randu(Mat dst, double low, double high)
+ {
+
+ randu_0(dst.nativeObj, low, high);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::reduce(Mat src, Mat& dst, int dim, int rtype, int dtype = -1)
+ //
+
+ //javadoc: reduce(src, dst, dim, rtype, dtype)
+ public static void reduce(Mat src, Mat dst, int dim, int rtype, int dtype)
+ {
+
+ reduce_0(src.nativeObj, dst.nativeObj, dim, rtype, dtype);
+
+ return;
+ }
+
+ //javadoc: reduce(src, dst, dim, rtype)
+ public static void reduce(Mat src, Mat dst, int dim, int rtype)
+ {
+
+ reduce_1(src.nativeObj, dst.nativeObj, dim, rtype);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::repeat(Mat src, int ny, int nx, Mat& dst)
+ //
+
+ //javadoc: repeat(src, ny, nx, dst)
+ public static void repeat(Mat src, int ny, int nx, Mat dst)
+ {
+
+ repeat_0(src.nativeObj, ny, nx, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::rotate(Mat src, Mat& dst, int rotateCode)
+ //
+
+ //javadoc: rotate(src, dst, rotateCode)
+ public static void rotate(Mat src, Mat dst, int rotateCode)
+ {
+
+ rotate_0(src.nativeObj, dst.nativeObj, rotateCode);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::scaleAdd(Mat src1, double alpha, Mat src2, Mat& dst)
+ //
+
+ //javadoc: scaleAdd(src1, alpha, src2, dst)
+ public static void scaleAdd(Mat src1, double alpha, Mat src2, Mat dst)
+ {
+
+ scaleAdd_0(src1.nativeObj, alpha, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::setErrorVerbosity(bool verbose)
+ //
+
+ //javadoc: setErrorVerbosity(verbose)
+ public static void setErrorVerbosity(boolean verbose)
+ {
+
+ setErrorVerbosity_0(verbose);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::setIdentity(Mat& mtx, Scalar s = Scalar(1))
+ //
+
+ //javadoc: setIdentity(mtx, s)
+ public static void setIdentity(Mat mtx, Scalar s)
+ {
+
+ setIdentity_0(mtx.nativeObj, s.val[0], s.val[1], s.val[2], s.val[3]);
+
+ return;
+ }
+
+ //javadoc: setIdentity(mtx)
+ public static void setIdentity(Mat mtx)
+ {
+
+ setIdentity_1(mtx.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::setNumThreads(int nthreads)
+ //
+
+ //javadoc: setNumThreads(nthreads)
+ public static void setNumThreads(int nthreads)
+ {
+
+ setNumThreads_0(nthreads);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::setRNGSeed(int seed)
+ //
+
+ //javadoc: setRNGSeed(seed)
+ public static void setRNGSeed(int seed)
+ {
+
+ setRNGSeed_0(seed);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::sort(Mat src, Mat& dst, int flags)
+ //
+
+ //javadoc: sort(src, dst, flags)
+ public static void sort(Mat src, Mat dst, int flags)
+ {
+
+ sort_0(src.nativeObj, dst.nativeObj, flags);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::sortIdx(Mat src, Mat& dst, int flags)
+ //
+
+ //javadoc: sortIdx(src, dst, flags)
+ public static void sortIdx(Mat src, Mat dst, int flags)
+ {
+
+ sortIdx_0(src.nativeObj, dst.nativeObj, flags);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::split(Mat m, vector_Mat& mv)
+ //
+
+ //javadoc: split(m, mv)
+ public static void split(Mat m, List mv)
+ {
+ Mat mv_mat = new Mat();
+ split_0(m.nativeObj, mv_mat.nativeObj);
+ Converters.Mat_to_vector_Mat(mv_mat, mv);
+ mv_mat.release();
+ return;
+ }
+
+
+ //
+ // C++: void cv::sqrt(Mat src, Mat& dst)
+ //
+
+ //javadoc: sqrt(src, dst)
+ public static void sqrt(Mat src, Mat dst)
+ {
+
+ sqrt_0(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::subtract(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ //
+
+ //javadoc: subtract(src1, src2, dst, mask, dtype)
+ public static void subtract(Mat src1, Mat src2, Mat dst, Mat mask, int dtype)
+ {
+
+ subtract_0(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj, dtype);
+
+ return;
+ }
+
+ //javadoc: subtract(src1, src2, dst, mask)
+ public static void subtract(Mat src1, Mat src2, Mat dst, Mat mask)
+ {
+
+ subtract_1(src1.nativeObj, src2.nativeObj, dst.nativeObj, mask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: subtract(src1, src2, dst)
+ public static void subtract(Mat src1, Mat src2, Mat dst)
+ {
+
+ subtract_2(src1.nativeObj, src2.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::subtract(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ //
+
+ //javadoc: subtract(src1, src2, dst, mask, dtype)
+ public static void subtract(Mat src1, Scalar src2, Mat dst, Mat mask, int dtype)
+ {
+
+ subtract_3(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj, dtype);
+
+ return;
+ }
+
+ //javadoc: subtract(src1, src2, dst, mask)
+ public static void subtract(Mat src1, Scalar src2, Mat dst, Mat mask)
+ {
+
+ subtract_4(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj, mask.nativeObj);
+
+ return;
+ }
+
+ //javadoc: subtract(src1, src2, dst)
+ public static void subtract(Mat src1, Scalar src2, Mat dst)
+ {
+
+ subtract_5(src1.nativeObj, src2.val[0], src2.val[1], src2.val[2], src2.val[3], dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::transform(Mat src, Mat& dst, Mat m)
+ //
+
+ //javadoc: transform(src, dst, m)
+ public static void transform(Mat src, Mat dst, Mat m)
+ {
+
+ transform_0(src.nativeObj, dst.nativeObj, m.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::transpose(Mat src, Mat& dst)
+ //
+
+ //javadoc: transpose(src, dst)
+ public static void transpose(Mat src, Mat dst)
+ {
+
+ transpose_0(src.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::vconcat(vector_Mat src, Mat& dst)
+ //
+
+ //javadoc: vconcat(src, dst)
+ public static void vconcat(List src, Mat dst)
+ {
+ Mat src_mat = Converters.vector_Mat_to_Mat(src);
+ vconcat_0(src_mat.nativeObj, dst.nativeObj);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::ipp::setUseIPP(bool flag)
+ //
+
+ //javadoc: setUseIPP(flag)
+ public static void setUseIPP(boolean flag)
+ {
+
+ setUseIPP_0(flag);
+
+ return;
+ }
+
+
+ //
+ // C++: void cv::ipp::setUseIPP_NE(bool flag)
+ //
+
+ //javadoc: setUseIPP_NE(flag)
+ public static void setUseIPP_NE(boolean flag)
+ {
+
+ setUseIPP_NE_0(flag);
+
+ return;
+ }
+
+// manual port
+public static class MinMaxLocResult {
+ public double minVal;
+ public double maxVal;
+ public Point minLoc;
+ public Point maxLoc;
+
+
+ public MinMaxLocResult() {
+ minVal=0; maxVal=0;
+ minLoc=new Point();
+ maxLoc=new Point();
+ }
+}
+
+
+// C++: minMaxLoc(Mat src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, InputArray mask=noArray())
+
+
+//javadoc: minMaxLoc(src, mask)
+public static MinMaxLocResult minMaxLoc(Mat src, Mat mask) {
+ MinMaxLocResult res = new MinMaxLocResult();
+ long maskNativeObj=0;
+ if (mask != null) {
+ maskNativeObj=mask.nativeObj;
+ }
+ double resarr[] = n_minMaxLocManual(src.nativeObj, maskNativeObj);
+ res.minVal=resarr[0];
+ res.maxVal=resarr[1];
+ res.minLoc.x=resarr[2];
+ res.minLoc.y=resarr[3];
+ res.maxLoc.x=resarr[4];
+ res.maxLoc.y=resarr[5];
+ return res;
+}
+
+
+//javadoc: minMaxLoc(src)
+public static MinMaxLocResult minMaxLoc(Mat src) {
+ return minMaxLoc(src, null);
+}
+
+
+ // C++: Scalar cv::mean(Mat src, Mat mask = Mat())
+ private static native double[] mean_0(long src_nativeObj, long mask_nativeObj);
+ private static native double[] mean_1(long src_nativeObj);
+
+ // C++: Scalar cv::sum(Mat src)
+ private static native double[] sumElems_0(long src_nativeObj);
+
+ // C++: Scalar cv::trace(Mat mtx)
+ private static native double[] trace_0(long mtx_nativeObj);
+
+ // C++: String cv::getBuildInformation()
+ private static native String getBuildInformation_0();
+
+ // C++: String cv::getHardwareFeatureName(int feature)
+ private static native String getHardwareFeatureName_0(int feature);
+
+ // C++: String cv::getVersionString()
+ private static native String getVersionString_0();
+
+ // C++: String cv::ipp::getIppVersion()
+ private static native String getIppVersion_0();
+
+ // C++: bool cv::checkRange(Mat a, bool quiet = true, _hidden_ * pos = 0, double minVal = -DBL_MAX, double maxVal = DBL_MAX)
+ private static native boolean checkRange_0(long a_nativeObj, boolean quiet, double minVal, double maxVal);
+ private static native boolean checkRange_1(long a_nativeObj, boolean quiet, double minVal);
+ private static native boolean checkRange_2(long a_nativeObj, boolean quiet);
+ private static native boolean checkRange_4(long a_nativeObj);
+
+ // C++: bool cv::eigen(Mat src, Mat& eigenvalues, Mat& eigenvectors = Mat())
+ private static native boolean eigen_0(long src_nativeObj, long eigenvalues_nativeObj, long eigenvectors_nativeObj);
+ private static native boolean eigen_1(long src_nativeObj, long eigenvalues_nativeObj);
+
+ // C++: bool cv::solve(Mat src1, Mat src2, Mat& dst, int flags = DECOMP_LU)
+ private static native boolean solve_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, int flags);
+ private static native boolean solve_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: bool cv::ipp::useIPP()
+ private static native boolean useIPP_0();
+
+ // C++: bool cv::ipp::useIPP_NE()
+ private static native boolean useIPP_NE_0();
+
+ // C++: double cv::Mahalanobis(Mat v1, Mat v2, Mat icovar)
+ private static native double Mahalanobis_0(long v1_nativeObj, long v2_nativeObj, long icovar_nativeObj);
+
+ // C++: double cv::PSNR(Mat src1, Mat src2)
+ private static native double PSNR_0(long src1_nativeObj, long src2_nativeObj);
+
+ // C++: double cv::determinant(Mat mtx)
+ private static native double determinant_0(long mtx_nativeObj);
+
+ // C++: double cv::getTickFrequency()
+ private static native double getTickFrequency_0();
+
+ // C++: double cv::invert(Mat src, Mat& dst, int flags = DECOMP_LU)
+ private static native double invert_0(long src_nativeObj, long dst_nativeObj, int flags);
+ private static native double invert_1(long src_nativeObj, long dst_nativeObj);
+
+ // C++: double cv::kmeans(Mat data, int K, Mat& bestLabels, TermCriteria criteria, int attempts, int flags, Mat& centers = Mat())
+ private static native double kmeans_0(long data_nativeObj, int K, long bestLabels_nativeObj, int criteria_type, int criteria_maxCount, double criteria_epsilon, int attempts, int flags, long centers_nativeObj);
+ private static native double kmeans_1(long data_nativeObj, int K, long bestLabels_nativeObj, int criteria_type, int criteria_maxCount, double criteria_epsilon, int attempts, int flags);
+
+ // C++: double cv::norm(Mat src1, Mat src2, int normType = NORM_L2, Mat mask = Mat())
+ private static native double norm_0(long src1_nativeObj, long src2_nativeObj, int normType, long mask_nativeObj);
+ private static native double norm_1(long src1_nativeObj, long src2_nativeObj, int normType);
+ private static native double norm_2(long src1_nativeObj, long src2_nativeObj);
+
+ // C++: double cv::norm(Mat src1, int normType = NORM_L2, Mat mask = Mat())
+ private static native double norm_3(long src1_nativeObj, int normType, long mask_nativeObj);
+ private static native double norm_4(long src1_nativeObj, int normType);
+ private static native double norm_5(long src1_nativeObj);
+
+ // C++: double cv::solvePoly(Mat coeffs, Mat& roots, int maxIters = 300)
+ private static native double solvePoly_0(long coeffs_nativeObj, long roots_nativeObj, int maxIters);
+ private static native double solvePoly_1(long coeffs_nativeObj, long roots_nativeObj);
+
+ // C++: float cv::cubeRoot(float val)
+ private static native float cubeRoot_0(float val);
+
+ // C++: float cv::fastAtan2(float y, float x)
+ private static native float fastAtan2_0(float y, float x);
+
+ // C++: int cv::borderInterpolate(int p, int len, int borderType)
+ private static native int borderInterpolate_0(int p, int len, int borderType);
+
+ // C++: int cv::countNonZero(Mat src)
+ private static native int countNonZero_0(long src_nativeObj);
+
+ // C++: int cv::getNumThreads()
+ private static native int getNumThreads_0();
+
+ // C++: int cv::getNumberOfCPUs()
+ private static native int getNumberOfCPUs_0();
+
+ // C++: int cv::getOptimalDFTSize(int vecsize)
+ private static native int getOptimalDFTSize_0(int vecsize);
+
+ // C++: int cv::getThreadNum()
+ private static native int getThreadNum_0();
+
+ // C++: int cv::getVersionMajor()
+ private static native int getVersionMajor_0();
+
+ // C++: int cv::getVersionMinor()
+ private static native int getVersionMinor_0();
+
+ // C++: int cv::getVersionRevision()
+ private static native int getVersionRevision_0();
+
+ // C++: int cv::solveCubic(Mat coeffs, Mat& roots)
+ private static native int solveCubic_0(long coeffs_nativeObj, long roots_nativeObj);
+
+ // C++: int64 cv::getCPUTickCount()
+ private static native long getCPUTickCount_0();
+
+ // C++: int64 cv::getTickCount()
+ private static native long getTickCount_0();
+
+ // C++: void cv::LUT(Mat src, Mat lut, Mat& dst)
+ private static native void LUT_0(long src_nativeObj, long lut_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::PCABackProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
+ private static native void PCABackProject_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long result_nativeObj);
+
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, double retainedVariance)
+ private static native void PCACompute2_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long eigenvalues_nativeObj, double retainedVariance);
+
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, Mat& eigenvalues, int maxComponents = 0)
+ private static native void PCACompute2_1(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long eigenvalues_nativeObj, int maxComponents);
+ private static native void PCACompute2_2(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long eigenvalues_nativeObj);
+
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, double retainedVariance)
+ private static native void PCACompute_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, double retainedVariance);
+
+ // C++: void cv::PCACompute(Mat data, Mat& mean, Mat& eigenvectors, int maxComponents = 0)
+ private static native void PCACompute_1(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, int maxComponents);
+ private static native void PCACompute_2(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj);
+
+ // C++: void cv::PCAProject(Mat data, Mat mean, Mat eigenvectors, Mat& result)
+ private static native void PCAProject_0(long data_nativeObj, long mean_nativeObj, long eigenvectors_nativeObj, long result_nativeObj);
+
+ // C++: void cv::SVBackSubst(Mat w, Mat u, Mat vt, Mat rhs, Mat& dst)
+ private static native void SVBackSubst_0(long w_nativeObj, long u_nativeObj, long vt_nativeObj, long rhs_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::SVDecomp(Mat src, Mat& w, Mat& u, Mat& vt, int flags = 0)
+ private static native void SVDecomp_0(long src_nativeObj, long w_nativeObj, long u_nativeObj, long vt_nativeObj, int flags);
+ private static native void SVDecomp_1(long src_nativeObj, long w_nativeObj, long u_nativeObj, long vt_nativeObj);
+
+ // C++: void cv::absdiff(Mat src1, Mat src2, Mat& dst)
+ private static native void absdiff_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::absdiff(Mat src1, Scalar src2, Mat& dst)
+ private static native void absdiff_1(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::add(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ private static native void add_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj, int dtype);
+ private static native void add_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void add_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::add(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ private static native void add_3(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, long mask_nativeObj, int dtype);
+ private static native void add_4(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, long mask_nativeObj);
+ private static native void add_5(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::addWeighted(Mat src1, double alpha, Mat src2, double beta, double gamma, Mat& dst, int dtype = -1)
+ private static native void addWeighted_0(long src1_nativeObj, double alpha, long src2_nativeObj, double beta, double gamma, long dst_nativeObj, int dtype);
+ private static native void addWeighted_1(long src1_nativeObj, double alpha, long src2_nativeObj, double beta, double gamma, long dst_nativeObj);
+
+ // C++: void cv::batchDistance(Mat src1, Mat src2, Mat& dist, int dtype, Mat& nidx, int normType = NORM_L2, int K = 0, Mat mask = Mat(), int update = 0, bool crosscheck = false)
+ private static native void batchDistance_0(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType, int K, long mask_nativeObj, int update, boolean crosscheck);
+ private static native void batchDistance_1(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType, int K, long mask_nativeObj, int update);
+ private static native void batchDistance_2(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType, int K, long mask_nativeObj);
+ private static native void batchDistance_3(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType, int K);
+ private static native void batchDistance_4(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj, int normType);
+ private static native void batchDistance_5(long src1_nativeObj, long src2_nativeObj, long dist_nativeObj, int dtype, long nidx_nativeObj);
+
+ // C++: void cv::bitwise_and(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ private static native void bitwise_and_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void bitwise_and_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::bitwise_not(Mat src, Mat& dst, Mat mask = Mat())
+ private static native void bitwise_not_0(long src_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void bitwise_not_1(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::bitwise_or(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ private static native void bitwise_or_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void bitwise_or_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::bitwise_xor(Mat src1, Mat src2, Mat& dst, Mat mask = Mat())
+ private static native void bitwise_xor_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void bitwise_xor_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::calcCovarMatrix(Mat samples, Mat& covar, Mat& mean, int flags, int ctype = CV_64F)
+ private static native void calcCovarMatrix_0(long samples_nativeObj, long covar_nativeObj, long mean_nativeObj, int flags, int ctype);
+ private static native void calcCovarMatrix_1(long samples_nativeObj, long covar_nativeObj, long mean_nativeObj, int flags);
+
+ // C++: void cv::cartToPolar(Mat x, Mat y, Mat& magnitude, Mat& angle, bool angleInDegrees = false)
+ private static native void cartToPolar_0(long x_nativeObj, long y_nativeObj, long magnitude_nativeObj, long angle_nativeObj, boolean angleInDegrees);
+ private static native void cartToPolar_1(long x_nativeObj, long y_nativeObj, long magnitude_nativeObj, long angle_nativeObj);
+
+ // C++: void cv::compare(Mat src1, Mat src2, Mat& dst, int cmpop)
+ private static native void compare_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, int cmpop);
+
+ // C++: void cv::compare(Mat src1, Scalar src2, Mat& dst, int cmpop)
+ private static native void compare_1(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, int cmpop);
+
+ // C++: void cv::completeSymm(Mat& m, bool lowerToUpper = false)
+ private static native void completeSymm_0(long m_nativeObj, boolean lowerToUpper);
+ private static native void completeSymm_1(long m_nativeObj);
+
+ // C++: void cv::convertFp16(Mat src, Mat& dst)
+ private static native void convertFp16_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::convertScaleAbs(Mat src, Mat& dst, double alpha = 1, double beta = 0)
+ private static native void convertScaleAbs_0(long src_nativeObj, long dst_nativeObj, double alpha, double beta);
+ private static native void convertScaleAbs_1(long src_nativeObj, long dst_nativeObj, double alpha);
+ private static native void convertScaleAbs_2(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::copyMakeBorder(Mat src, Mat& dst, int top, int bottom, int left, int right, int borderType, Scalar value = Scalar())
+ private static native void copyMakeBorder_0(long src_nativeObj, long dst_nativeObj, int top, int bottom, int left, int right, int borderType, double value_val0, double value_val1, double value_val2, double value_val3);
+ private static native void copyMakeBorder_1(long src_nativeObj, long dst_nativeObj, int top, int bottom, int left, int right, int borderType);
+
+ // C++: void cv::dct(Mat src, Mat& dst, int flags = 0)
+ private static native void dct_0(long src_nativeObj, long dst_nativeObj, int flags);
+ private static native void dct_1(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::dft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
+ private static native void dft_0(long src_nativeObj, long dst_nativeObj, int flags, int nonzeroRows);
+ private static native void dft_1(long src_nativeObj, long dst_nativeObj, int flags);
+ private static native void dft_2(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::divide(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
+ private static native void divide_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale, int dtype);
+ private static native void divide_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale);
+ private static native void divide_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::divide(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
+ private static native void divide_3(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, double scale, int dtype);
+ private static native void divide_4(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, double scale);
+ private static native void divide_5(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::divide(double scale, Mat src2, Mat& dst, int dtype = -1)
+ private static native void divide_6(double scale, long src2_nativeObj, long dst_nativeObj, int dtype);
+ private static native void divide_7(double scale, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::eigenNonSymmetric(Mat src, Mat& eigenvalues, Mat& eigenvectors)
+ private static native void eigenNonSymmetric_0(long src_nativeObj, long eigenvalues_nativeObj, long eigenvectors_nativeObj);
+
+ // C++: void cv::exp(Mat src, Mat& dst)
+ private static native void exp_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::extractChannel(Mat src, Mat& dst, int coi)
+ private static native void extractChannel_0(long src_nativeObj, long dst_nativeObj, int coi);
+
+ // C++: void cv::findNonZero(Mat src, Mat& idx)
+ private static native void findNonZero_0(long src_nativeObj, long idx_nativeObj);
+
+ // C++: void cv::flip(Mat src, Mat& dst, int flipCode)
+ private static native void flip_0(long src_nativeObj, long dst_nativeObj, int flipCode);
+
+ // C++: void cv::gemm(Mat src1, Mat src2, double alpha, Mat src3, double beta, Mat& dst, int flags = 0)
+ private static native void gemm_0(long src1_nativeObj, long src2_nativeObj, double alpha, long src3_nativeObj, double beta, long dst_nativeObj, int flags);
+ private static native void gemm_1(long src1_nativeObj, long src2_nativeObj, double alpha, long src3_nativeObj, double beta, long dst_nativeObj);
+
+ // C++: void cv::hconcat(vector_Mat src, Mat& dst)
+ private static native void hconcat_0(long src_mat_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::idct(Mat src, Mat& dst, int flags = 0)
+ private static native void idct_0(long src_nativeObj, long dst_nativeObj, int flags);
+ private static native void idct_1(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::idft(Mat src, Mat& dst, int flags = 0, int nonzeroRows = 0)
+ private static native void idft_0(long src_nativeObj, long dst_nativeObj, int flags, int nonzeroRows);
+ private static native void idft_1(long src_nativeObj, long dst_nativeObj, int flags);
+ private static native void idft_2(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::inRange(Mat src, Scalar lowerb, Scalar upperb, Mat& dst)
+ private static native void inRange_0(long src_nativeObj, double lowerb_val0, double lowerb_val1, double lowerb_val2, double lowerb_val3, double upperb_val0, double upperb_val1, double upperb_val2, double upperb_val3, long dst_nativeObj);
+
+ // C++: void cv::insertChannel(Mat src, Mat& dst, int coi)
+ private static native void insertChannel_0(long src_nativeObj, long dst_nativeObj, int coi);
+
+ // C++: void cv::log(Mat src, Mat& dst)
+ private static native void log_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::magnitude(Mat x, Mat y, Mat& magnitude)
+ private static native void magnitude_0(long x_nativeObj, long y_nativeObj, long magnitude_nativeObj);
+
+ // C++: void cv::max(Mat src1, Mat src2, Mat& dst)
+ private static native void max_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::max(Mat src1, Scalar src2, Mat& dst)
+ private static native void max_1(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::meanStdDev(Mat src, vector_double& mean, vector_double& stddev, Mat mask = Mat())
+ private static native void meanStdDev_0(long src_nativeObj, long mean_mat_nativeObj, long stddev_mat_nativeObj, long mask_nativeObj);
+ private static native void meanStdDev_1(long src_nativeObj, long mean_mat_nativeObj, long stddev_mat_nativeObj);
+
+ // C++: void cv::merge(vector_Mat mv, Mat& dst)
+ private static native void merge_0(long mv_mat_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::min(Mat src1, Mat src2, Mat& dst)
+ private static native void min_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::min(Mat src1, Scalar src2, Mat& dst)
+ private static native void min_1(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::mixChannels(vector_Mat src, vector_Mat dst, vector_int fromTo)
+ private static native void mixChannels_0(long src_mat_nativeObj, long dst_mat_nativeObj, long fromTo_mat_nativeObj);
+
+ // C++: void cv::mulSpectrums(Mat a, Mat b, Mat& c, int flags, bool conjB = false)
+ private static native void mulSpectrums_0(long a_nativeObj, long b_nativeObj, long c_nativeObj, int flags, boolean conjB);
+ private static native void mulSpectrums_1(long a_nativeObj, long b_nativeObj, long c_nativeObj, int flags);
+
+ // C++: void cv::mulTransposed(Mat src, Mat& dst, bool aTa, Mat delta = Mat(), double scale = 1, int dtype = -1)
+ private static native void mulTransposed_0(long src_nativeObj, long dst_nativeObj, boolean aTa, long delta_nativeObj, double scale, int dtype);
+ private static native void mulTransposed_1(long src_nativeObj, long dst_nativeObj, boolean aTa, long delta_nativeObj, double scale);
+ private static native void mulTransposed_2(long src_nativeObj, long dst_nativeObj, boolean aTa, long delta_nativeObj);
+ private static native void mulTransposed_3(long src_nativeObj, long dst_nativeObj, boolean aTa);
+
+ // C++: void cv::multiply(Mat src1, Mat src2, Mat& dst, double scale = 1, int dtype = -1)
+ private static native void multiply_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale, int dtype);
+ private static native void multiply_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, double scale);
+ private static native void multiply_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::multiply(Mat src1, Scalar src2, Mat& dst, double scale = 1, int dtype = -1)
+ private static native void multiply_3(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, double scale, int dtype);
+ private static native void multiply_4(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, double scale);
+ private static native void multiply_5(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::normalize(Mat src, Mat& dst, double alpha = 1, double beta = 0, int norm_type = NORM_L2, int dtype = -1, Mat mask = Mat())
+ private static native void normalize_0(long src_nativeObj, long dst_nativeObj, double alpha, double beta, int norm_type, int dtype, long mask_nativeObj);
+ private static native void normalize_1(long src_nativeObj, long dst_nativeObj, double alpha, double beta, int norm_type, int dtype);
+ private static native void normalize_2(long src_nativeObj, long dst_nativeObj, double alpha, double beta, int norm_type);
+ private static native void normalize_3(long src_nativeObj, long dst_nativeObj, double alpha, double beta);
+ private static native void normalize_4(long src_nativeObj, long dst_nativeObj, double alpha);
+ private static native void normalize_5(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::patchNaNs(Mat& a, double val = 0)
+ private static native void patchNaNs_0(long a_nativeObj, double val);
+ private static native void patchNaNs_1(long a_nativeObj);
+
+ // C++: void cv::perspectiveTransform(Mat src, Mat& dst, Mat m)
+ private static native void perspectiveTransform_0(long src_nativeObj, long dst_nativeObj, long m_nativeObj);
+
+ // C++: void cv::phase(Mat x, Mat y, Mat& angle, bool angleInDegrees = false)
+ private static native void phase_0(long x_nativeObj, long y_nativeObj, long angle_nativeObj, boolean angleInDegrees);
+ private static native void phase_1(long x_nativeObj, long y_nativeObj, long angle_nativeObj);
+
+ // C++: void cv::polarToCart(Mat magnitude, Mat angle, Mat& x, Mat& y, bool angleInDegrees = false)
+ private static native void polarToCart_0(long magnitude_nativeObj, long angle_nativeObj, long x_nativeObj, long y_nativeObj, boolean angleInDegrees);
+ private static native void polarToCart_1(long magnitude_nativeObj, long angle_nativeObj, long x_nativeObj, long y_nativeObj);
+
+ // C++: void cv::pow(Mat src, double power, Mat& dst)
+ private static native void pow_0(long src_nativeObj, double power, long dst_nativeObj);
+
+ // C++: void cv::randShuffle(Mat& dst, double iterFactor = 1., RNG* rng = 0)
+ private static native void randShuffle_0(long dst_nativeObj, double iterFactor);
+ private static native void randShuffle_2(long dst_nativeObj);
+
+ // C++: void cv::randn(Mat& dst, double mean, double stddev)
+ private static native void randn_0(long dst_nativeObj, double mean, double stddev);
+
+ // C++: void cv::randu(Mat& dst, double low, double high)
+ private static native void randu_0(long dst_nativeObj, double low, double high);
+
+ // C++: void cv::reduce(Mat src, Mat& dst, int dim, int rtype, int dtype = -1)
+ private static native void reduce_0(long src_nativeObj, long dst_nativeObj, int dim, int rtype, int dtype);
+ private static native void reduce_1(long src_nativeObj, long dst_nativeObj, int dim, int rtype);
+
+ // C++: void cv::repeat(Mat src, int ny, int nx, Mat& dst)
+ private static native void repeat_0(long src_nativeObj, int ny, int nx, long dst_nativeObj);
+
+ // C++: void cv::rotate(Mat src, Mat& dst, int rotateCode)
+ private static native void rotate_0(long src_nativeObj, long dst_nativeObj, int rotateCode);
+
+ // C++: void cv::scaleAdd(Mat src1, double alpha, Mat src2, Mat& dst)
+ private static native void scaleAdd_0(long src1_nativeObj, double alpha, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::setErrorVerbosity(bool verbose)
+ private static native void setErrorVerbosity_0(boolean verbose);
+
+ // C++: void cv::setIdentity(Mat& mtx, Scalar s = Scalar(1))
+ private static native void setIdentity_0(long mtx_nativeObj, double s_val0, double s_val1, double s_val2, double s_val3);
+ private static native void setIdentity_1(long mtx_nativeObj);
+
+ // C++: void cv::setNumThreads(int nthreads)
+ private static native void setNumThreads_0(int nthreads);
+
+ // C++: void cv::setRNGSeed(int seed)
+ private static native void setRNGSeed_0(int seed);
+
+ // C++: void cv::sort(Mat src, Mat& dst, int flags)
+ private static native void sort_0(long src_nativeObj, long dst_nativeObj, int flags);
+
+ // C++: void cv::sortIdx(Mat src, Mat& dst, int flags)
+ private static native void sortIdx_0(long src_nativeObj, long dst_nativeObj, int flags);
+
+ // C++: void cv::split(Mat m, vector_Mat& mv)
+ private static native void split_0(long m_nativeObj, long mv_mat_nativeObj);
+
+ // C++: void cv::sqrt(Mat src, Mat& dst)
+ private static native void sqrt_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::subtract(Mat src1, Mat src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ private static native void subtract_0(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj, int dtype);
+ private static native void subtract_1(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj, long mask_nativeObj);
+ private static native void subtract_2(long src1_nativeObj, long src2_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::subtract(Mat src1, Scalar src2, Mat& dst, Mat mask = Mat(), int dtype = -1)
+ private static native void subtract_3(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, long mask_nativeObj, int dtype);
+ private static native void subtract_4(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj, long mask_nativeObj);
+ private static native void subtract_5(long src1_nativeObj, double src2_val0, double src2_val1, double src2_val2, double src2_val3, long dst_nativeObj);
+
+ // C++: void cv::transform(Mat src, Mat& dst, Mat m)
+ private static native void transform_0(long src_nativeObj, long dst_nativeObj, long m_nativeObj);
+
+ // C++: void cv::transpose(Mat src, Mat& dst)
+ private static native void transpose_0(long src_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::vconcat(vector_Mat src, Mat& dst)
+ private static native void vconcat_0(long src_mat_nativeObj, long dst_nativeObj);
+
+ // C++: void cv::ipp::setUseIPP(bool flag)
+ private static native void setUseIPP_0(boolean flag);
+
+ // C++: void cv::ipp::setUseIPP_NE(bool flag)
+ private static native void setUseIPP_NE_0(boolean flag);
+private static native double[] n_minMaxLocManual(long src_nativeObj, long mask_nativeObj);
+
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/core/CvException.java b/openCVLibrary3/src/main/java/org/opencv/core/CvException.java
new file mode 100644
index 00000000000..e9241e68860
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/core/CvException.java
@@ -0,0 +1,15 @@
+package org.opencv.core;
+
+public class CvException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public CvException(String msg) {
+ super(msg);
+ }
+
+ @Override
+ public String toString() {
+ return "CvException [" + super.toString() + "]";
+ }
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/core/CvType.java b/openCVLibrary3/src/main/java/org/opencv/core/CvType.java
new file mode 100644
index 00000000000..748c1cd75c2
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/core/CvType.java
@@ -0,0 +1,136 @@
+package org.opencv.core;
+
+public final class CvType {
+
+ // type depth constants
+ public static final int
+ CV_8U = 0, CV_8S = 1,
+ CV_16U = 2, CV_16S = 3,
+ CV_32S = 4,
+ CV_32F = 5,
+ CV_64F = 6,
+ CV_USRTYPE1 = 7;
+
+ // predefined type constants
+ public static final int
+ CV_8UC1 = CV_8UC(1), CV_8UC2 = CV_8UC(2), CV_8UC3 = CV_8UC(3), CV_8UC4 = CV_8UC(4),
+ CV_8SC1 = CV_8SC(1), CV_8SC2 = CV_8SC(2), CV_8SC3 = CV_8SC(3), CV_8SC4 = CV_8SC(4),
+ CV_16UC1 = CV_16UC(1), CV_16UC2 = CV_16UC(2), CV_16UC3 = CV_16UC(3), CV_16UC4 = CV_16UC(4),
+ CV_16SC1 = CV_16SC(1), CV_16SC2 = CV_16SC(2), CV_16SC3 = CV_16SC(3), CV_16SC4 = CV_16SC(4),
+ CV_32SC1 = CV_32SC(1), CV_32SC2 = CV_32SC(2), CV_32SC3 = CV_32SC(3), CV_32SC4 = CV_32SC(4),
+ CV_32FC1 = CV_32FC(1), CV_32FC2 = CV_32FC(2), CV_32FC3 = CV_32FC(3), CV_32FC4 = CV_32FC(4),
+ CV_64FC1 = CV_64FC(1), CV_64FC2 = CV_64FC(2), CV_64FC3 = CV_64FC(3), CV_64FC4 = CV_64FC(4);
+
+ private static final int CV_CN_MAX = 512, CV_CN_SHIFT = 3, CV_DEPTH_MAX = (1 << CV_CN_SHIFT);
+
+ public static final int makeType(int depth, int channels) {
+ if (channels <= 0 || channels >= CV_CN_MAX) {
+ throw new java.lang.UnsupportedOperationException(
+ "Channels count should be 1.." + (CV_CN_MAX - 1));
+ }
+ if (depth < 0 || depth >= CV_DEPTH_MAX) {
+ throw new java.lang.UnsupportedOperationException(
+ "Data type depth should be 0.." + (CV_DEPTH_MAX - 1));
+ }
+ return (depth & (CV_DEPTH_MAX - 1)) + ((channels - 1) << CV_CN_SHIFT);
+ }
+
+ public static final int CV_8UC(int ch) {
+ return makeType(CV_8U, ch);
+ }
+
+ public static final int CV_8SC(int ch) {
+ return makeType(CV_8S, ch);
+ }
+
+ public static final int CV_16UC(int ch) {
+ return makeType(CV_16U, ch);
+ }
+
+ public static final int CV_16SC(int ch) {
+ return makeType(CV_16S, ch);
+ }
+
+ public static final int CV_32SC(int ch) {
+ return makeType(CV_32S, ch);
+ }
+
+ public static final int CV_32FC(int ch) {
+ return makeType(CV_32F, ch);
+ }
+
+ public static final int CV_64FC(int ch) {
+ return makeType(CV_64F, ch);
+ }
+
+ public static final int channels(int type) {
+ return (type >> CV_CN_SHIFT) + 1;
+ }
+
+ public static final int depth(int type) {
+ return type & (CV_DEPTH_MAX - 1);
+ }
+
+ public static final boolean isInteger(int type) {
+ return depth(type) < CV_32F;
+ }
+
+ public static final int ELEM_SIZE(int type) {
+ switch (depth(type)) {
+ case CV_8U:
+ case CV_8S:
+ return channels(type);
+ case CV_16U:
+ case CV_16S:
+ return 2 * channels(type);
+ case CV_32S:
+ case CV_32F:
+ return 4 * channels(type);
+ case CV_64F:
+ return 8 * channels(type);
+ default:
+ throw new java.lang.UnsupportedOperationException(
+ "Unsupported CvType value: " + type);
+ }
+ }
+
+ public static final String typeToString(int type) {
+ String s;
+ switch (depth(type)) {
+ case CV_8U:
+ s = "CV_8U";
+ break;
+ case CV_8S:
+ s = "CV_8S";
+ break;
+ case CV_16U:
+ s = "CV_16U";
+ break;
+ case CV_16S:
+ s = "CV_16S";
+ break;
+ case CV_32S:
+ s = "CV_32S";
+ break;
+ case CV_32F:
+ s = "CV_32F";
+ break;
+ case CV_64F:
+ s = "CV_64F";
+ break;
+ case CV_USRTYPE1:
+ s = "CV_USRTYPE1";
+ break;
+ default:
+ throw new java.lang.UnsupportedOperationException(
+ "Unsupported CvType value: " + type);
+ }
+
+ int ch = channels(type);
+ if (ch <= 4)
+ return s + "C" + ch;
+ else
+ return s + "C(" + ch + ")";
+ }
+
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/core/DMatch.java b/openCVLibrary3/src/main/java/org/opencv/core/DMatch.java
new file mode 100644
index 00000000000..db44d9a0a68
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/core/DMatch.java
@@ -0,0 +1,58 @@
+package org.opencv.core;
+
+//C++: class DMatch
+
+/**
+ * Structure for matching: query descriptor index, train descriptor index, train
+ * image index and distance between descriptors.
+ */
+public class DMatch {
+
+ /**
+ * Query descriptor index.
+ */
+ public int queryIdx;
+ /**
+ * Train descriptor index.
+ */
+ public int trainIdx;
+ /**
+ * Train image index.
+ */
+ public int imgIdx;
+
+ // javadoc: DMatch::distance
+ public float distance;
+
+ // javadoc: DMatch::DMatch()
+ public DMatch() {
+ this(-1, -1, Float.MAX_VALUE);
+ }
+
+ // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _distance)
+ public DMatch(int _queryIdx, int _trainIdx, float _distance) {
+ queryIdx = _queryIdx;
+ trainIdx = _trainIdx;
+ imgIdx = -1;
+ distance = _distance;
+ }
+
+ // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _imgIdx, _distance)
+ public DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance) {
+ queryIdx = _queryIdx;
+ trainIdx = _trainIdx;
+ imgIdx = _imgIdx;
+ distance = _distance;
+ }
+
+ public boolean lessThan(DMatch it) {
+ return distance < it.distance;
+ }
+
+ @Override
+ public String toString() {
+ return "DMatch [queryIdx=" + queryIdx + ", trainIdx=" + trainIdx
+ + ", imgIdx=" + imgIdx + ", distance=" + distance + "]";
+ }
+
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/core/KeyPoint.java b/openCVLibrary3/src/main/java/org/opencv/core/KeyPoint.java
new file mode 100644
index 00000000000..de5b2151ff7
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/core/KeyPoint.java
@@ -0,0 +1,83 @@
+package org.opencv.core;
+
+import org.opencv.core.Point;
+
+//javadoc: KeyPoint
+public class KeyPoint {
+
+ /**
+ * Coordinates of the keypoint.
+ */
+ public Point pt;
+ /**
+ * Diameter of the useful keypoint adjacent area.
+ */
+ public float size;
+ /**
+ * Computed orientation of the keypoint (-1 if not applicable).
+ */
+ public float angle;
+ /**
+ * The response, by which the strongest keypoints have been selected. Can
+ * be used for further sorting or subsampling.
+ */
+ public float response;
+ /**
+ * Octave (pyramid layer), from which the keypoint has been extracted.
+ */
+ public int octave;
+ /**
+ * Object ID, that can be used to cluster keypoints by an object they
+ * belong to.
+ */
+ public int class_id;
+
+ // javadoc:KeyPoint::KeyPoint(x,y,_size,_angle,_response,_octave,_class_id)
+ public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave, int _class_id)
+ {
+ pt = new Point(x, y);
+ size = _size;
+ angle = _angle;
+ response = _response;
+ octave = _octave;
+ class_id = _class_id;
+ }
+
+ // javadoc: KeyPoint::KeyPoint()
+ public KeyPoint()
+ {
+ this(0, 0, 0, -1, 0, 0, -1);
+ }
+
+ // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response, _octave)
+ public KeyPoint(float x, float y, float _size, float _angle, float _response, int _octave)
+ {
+ this(x, y, _size, _angle, _response, _octave, -1);
+ }
+
+ // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle, _response)
+ public KeyPoint(float x, float y, float _size, float _angle, float _response)
+ {
+ this(x, y, _size, _angle, _response, 0, -1);
+ }
+
+ // javadoc: KeyPoint::KeyPoint(x, y, _size, _angle)
+ public KeyPoint(float x, float y, float _size, float _angle)
+ {
+ this(x, y, _size, _angle, 0, 0, -1);
+ }
+
+ // javadoc: KeyPoint::KeyPoint(x, y, _size)
+ public KeyPoint(float x, float y, float _size)
+ {
+ this(x, y, _size, -1, 0, 0, -1);
+ }
+
+ @Override
+ public String toString() {
+ return "KeyPoint [pt=" + pt + ", size=" + size + ", angle=" + angle
+ + ", response=" + response + ", octave=" + octave
+ + ", class_id=" + class_id + "]";
+ }
+
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/core/Mat.java b/openCVLibrary3/src/main/java/org/opencv/core/Mat.java
new file mode 100644
index 00000000000..c975f0c44b8
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/core/Mat.java
@@ -0,0 +1,1351 @@
+package org.opencv.core;
+
+import java.nio.ByteBuffer;
+
+// C++: class Mat
+//javadoc: Mat
+public class Mat {
+
+ public final long nativeObj;
+
+ public Mat(long addr)
+ {
+ if (addr == 0)
+ throw new java.lang.UnsupportedOperationException("Native object address is NULL");
+ nativeObj = addr;
+ }
+
+ //
+ // C++: Mat::Mat()
+ //
+
+ // javadoc: Mat::Mat()
+ public Mat()
+ {
+
+ nativeObj = n_Mat();
+
+ return;
+ }
+
+ //
+ // C++: Mat::Mat(int rows, int cols, int type)
+ //
+
+ // javadoc: Mat::Mat(rows, cols, type)
+ public Mat(int rows, int cols, int type)
+ {
+
+ nativeObj = n_Mat(rows, cols, type);
+
+ return;
+ }
+
+ //
+ // C++: Mat::Mat(int rows, int cols, int type, void* data)
+ //
+
+ // javadoc: Mat::Mat(rows, cols, type, data)
+ public Mat(int rows, int cols, int type, ByteBuffer data)
+ {
+
+ nativeObj = n_Mat(rows, cols, type, data);
+
+ return;
+ }
+
+ //
+ // C++: Mat::Mat(Size size, int type)
+ //
+
+ // javadoc: Mat::Mat(size, type)
+ public Mat(Size size, int type)
+ {
+
+ nativeObj = n_Mat(size.width, size.height, type);
+
+ return;
+ }
+
+ //
+ // C++: Mat::Mat(int rows, int cols, int type, Scalar s)
+ //
+
+ // javadoc: Mat::Mat(rows, cols, type, s)
+ public Mat(int rows, int cols, int type, Scalar s)
+ {
+
+ nativeObj = n_Mat(rows, cols, type, s.val[0], s.val[1], s.val[2], s.val[3]);
+
+ return;
+ }
+
+ //
+ // C++: Mat::Mat(Size size, int type, Scalar s)
+ //
+
+ // javadoc: Mat::Mat(size, type, s)
+ public Mat(Size size, int type, Scalar s)
+ {
+
+ nativeObj = n_Mat(size.width, size.height, type, s.val[0], s.val[1], s.val[2], s.val[3]);
+
+ return;
+ }
+
+ //
+ // C++: Mat::Mat(Mat m, Range rowRange, Range colRange = Range::all())
+ //
+
+ // javadoc: Mat::Mat(m, rowRange, colRange)
+ public Mat(Mat m, Range rowRange, Range colRange)
+ {
+
+ nativeObj = n_Mat(m.nativeObj, rowRange.start, rowRange.end, colRange.start, colRange.end);
+
+ return;
+ }
+
+ // javadoc: Mat::Mat(m, rowRange)
+ public Mat(Mat m, Range rowRange)
+ {
+
+ nativeObj = n_Mat(m.nativeObj, rowRange.start, rowRange.end);
+
+ return;
+ }
+
+ //
+ // C++: Mat::Mat(Mat m, Rect roi)
+ //
+
+ // javadoc: Mat::Mat(m, roi)
+ public Mat(Mat m, Rect roi)
+ {
+
+ nativeObj = n_Mat(m.nativeObj, roi.y, roi.y + roi.height, roi.x, roi.x + roi.width);
+
+ return;
+ }
+
+ //
+ // C++: Mat Mat::adjustROI(int dtop, int dbottom, int dleft, int dright)
+ //
+
+ // javadoc: Mat::adjustROI(dtop, dbottom, dleft, dright)
+ public Mat adjustROI(int dtop, int dbottom, int dleft, int dright)
+ {
+
+ Mat retVal = new Mat(n_adjustROI(nativeObj, dtop, dbottom, dleft, dright));
+
+ return retVal;
+ }
+
+ //
+ // C++: void Mat::assignTo(Mat m, int type = -1)
+ //
+
+ // javadoc: Mat::assignTo(m, type)
+ public void assignTo(Mat m, int type)
+ {
+
+ n_assignTo(nativeObj, m.nativeObj, type);
+
+ return;
+ }
+
+ // javadoc: Mat::assignTo(m)
+ public void assignTo(Mat m)
+ {
+
+ n_assignTo(nativeObj, m.nativeObj);
+
+ return;
+ }
+
+ //
+ // C++: int Mat::channels()
+ //
+
+ // javadoc: Mat::channels()
+ public int channels()
+ {
+
+ int retVal = n_channels(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: int Mat::checkVector(int elemChannels, int depth = -1, bool
+ // requireContinuous = true)
+ //
+
+ // javadoc: Mat::checkVector(elemChannels, depth, requireContinuous)
+ public int checkVector(int elemChannels, int depth, boolean requireContinuous)
+ {
+
+ int retVal = n_checkVector(nativeObj, elemChannels, depth, requireContinuous);
+
+ return retVal;
+ }
+
+ // javadoc: Mat::checkVector(elemChannels, depth)
+ public int checkVector(int elemChannels, int depth)
+ {
+
+ int retVal = n_checkVector(nativeObj, elemChannels, depth);
+
+ return retVal;
+ }
+
+ // javadoc: Mat::checkVector(elemChannels)
+ public int checkVector(int elemChannels)
+ {
+
+ int retVal = n_checkVector(nativeObj, elemChannels);
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::clone()
+ //
+
+ // javadoc: Mat::clone()
+ public Mat clone()
+ {
+
+ Mat retVal = new Mat(n_clone(nativeObj));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::col(int x)
+ //
+
+ // javadoc: Mat::col(x)
+ public Mat col(int x)
+ {
+
+ Mat retVal = new Mat(n_col(nativeObj, x));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::colRange(int startcol, int endcol)
+ //
+
+ // javadoc: Mat::colRange(startcol, endcol)
+ public Mat colRange(int startcol, int endcol)
+ {
+
+ Mat retVal = new Mat(n_colRange(nativeObj, startcol, endcol));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::colRange(Range r)
+ //
+
+ // javadoc: Mat::colRange(r)
+ public Mat colRange(Range r)
+ {
+
+ Mat retVal = new Mat(n_colRange(nativeObj, r.start, r.end));
+
+ return retVal;
+ }
+
+ //
+ // C++: int Mat::dims()
+ //
+
+ // javadoc: Mat::dims()
+ public int dims()
+ {
+
+ int retVal = n_dims(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: int Mat::cols()
+ //
+
+ // javadoc: Mat::cols()
+ public int cols()
+ {
+
+ int retVal = n_cols(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: void Mat::convertTo(Mat& m, int rtype, double alpha = 1, double beta
+ // = 0)
+ //
+
+ // javadoc: Mat::convertTo(m, rtype, alpha, beta)
+ public void convertTo(Mat m, int rtype, double alpha, double beta)
+ {
+
+ n_convertTo(nativeObj, m.nativeObj, rtype, alpha, beta);
+
+ return;
+ }
+
+ // javadoc: Mat::convertTo(m, rtype, alpha)
+ public void convertTo(Mat m, int rtype, double alpha)
+ {
+
+ n_convertTo(nativeObj, m.nativeObj, rtype, alpha);
+
+ return;
+ }
+
+ // javadoc: Mat::convertTo(m, rtype)
+ public void convertTo(Mat m, int rtype)
+ {
+
+ n_convertTo(nativeObj, m.nativeObj, rtype);
+
+ return;
+ }
+
+ //
+ // C++: void Mat::copyTo(Mat& m)
+ //
+
+ // javadoc: Mat::copyTo(m)
+ public void copyTo(Mat m)
+ {
+
+ n_copyTo(nativeObj, m.nativeObj);
+
+ return;
+ }
+
+ //
+ // C++: void Mat::copyTo(Mat& m, Mat mask)
+ //
+
+ // javadoc: Mat::copyTo(m, mask)
+ public void copyTo(Mat m, Mat mask)
+ {
+
+ n_copyTo(nativeObj, m.nativeObj, mask.nativeObj);
+
+ return;
+ }
+
+ //
+ // C++: void Mat::create(int rows, int cols, int type)
+ //
+
+ // javadoc: Mat::create(rows, cols, type)
+ public void create(int rows, int cols, int type)
+ {
+
+ n_create(nativeObj, rows, cols, type);
+
+ return;
+ }
+
+ //
+ // C++: void Mat::create(Size size, int type)
+ //
+
+ // javadoc: Mat::create(size, type)
+ public void create(Size size, int type)
+ {
+
+ n_create(nativeObj, size.width, size.height, type);
+
+ return;
+ }
+
+ //
+ // C++: Mat Mat::cross(Mat m)
+ //
+
+ // javadoc: Mat::cross(m)
+ public Mat cross(Mat m)
+ {
+
+ Mat retVal = new Mat(n_cross(nativeObj, m.nativeObj));
+
+ return retVal;
+ }
+
+ //
+ // C++: long Mat::dataAddr()
+ //
+
+ // javadoc: Mat::dataAddr()
+ public long dataAddr()
+ {
+
+ long retVal = n_dataAddr(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: int Mat::depth()
+ //
+
+ // javadoc: Mat::depth()
+ public int depth()
+ {
+
+ int retVal = n_depth(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::diag(int d = 0)
+ //
+
+ // javadoc: Mat::diag(d)
+ public Mat diag(int d)
+ {
+
+ Mat retVal = new Mat(n_diag(nativeObj, d));
+
+ return retVal;
+ }
+
+ // javadoc: Mat::diag()
+ public Mat diag()
+ {
+
+ Mat retVal = new Mat(n_diag(nativeObj, 0));
+
+ return retVal;
+ }
+
+ //
+ // C++: static Mat Mat::diag(Mat d)
+ //
+
+ // javadoc: Mat::diag(d)
+ public static Mat diag(Mat d)
+ {
+
+ Mat retVal = new Mat(n_diag(d.nativeObj));
+
+ return retVal;
+ }
+
+ //
+ // C++: double Mat::dot(Mat m)
+ //
+
+ // javadoc: Mat::dot(m)
+ public double dot(Mat m)
+ {
+
+ double retVal = n_dot(nativeObj, m.nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: size_t Mat::elemSize()
+ //
+
+ // javadoc: Mat::elemSize()
+ public long elemSize()
+ {
+
+ long retVal = n_elemSize(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: size_t Mat::elemSize1()
+ //
+
+ // javadoc: Mat::elemSize1()
+ public long elemSize1()
+ {
+
+ long retVal = n_elemSize1(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: bool Mat::empty()
+ //
+
+ // javadoc: Mat::empty()
+ public boolean empty()
+ {
+
+ boolean retVal = n_empty(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: static Mat Mat::eye(int rows, int cols, int type)
+ //
+
+ // javadoc: Mat::eye(rows, cols, type)
+ public static Mat eye(int rows, int cols, int type)
+ {
+
+ Mat retVal = new Mat(n_eye(rows, cols, type));
+
+ return retVal;
+ }
+
+ //
+ // C++: static Mat Mat::eye(Size size, int type)
+ //
+
+ // javadoc: Mat::eye(size, type)
+ public static Mat eye(Size size, int type)
+ {
+
+ Mat retVal = new Mat(n_eye(size.width, size.height, type));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::inv(int method = DECOMP_LU)
+ //
+
+ // javadoc: Mat::inv(method)
+ public Mat inv(int method)
+ {
+
+ Mat retVal = new Mat(n_inv(nativeObj, method));
+
+ return retVal;
+ }
+
+ // javadoc: Mat::inv()
+ public Mat inv()
+ {
+
+ Mat retVal = new Mat(n_inv(nativeObj));
+
+ return retVal;
+ }
+
+ //
+ // C++: bool Mat::isContinuous()
+ //
+
+ // javadoc: Mat::isContinuous()
+ public boolean isContinuous()
+ {
+
+ boolean retVal = n_isContinuous(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: bool Mat::isSubmatrix()
+ //
+
+ // javadoc: Mat::isSubmatrix()
+ public boolean isSubmatrix()
+ {
+
+ boolean retVal = n_isSubmatrix(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: void Mat::locateROI(Size wholeSize, Point ofs)
+ //
+
+ // javadoc: Mat::locateROI(wholeSize, ofs)
+ public void locateROI(Size wholeSize, Point ofs)
+ {
+ double[] wholeSize_out = new double[2];
+ double[] ofs_out = new double[2];
+ locateROI_0(nativeObj, wholeSize_out, ofs_out);
+ if(wholeSize!=null){ wholeSize.width = wholeSize_out[0]; wholeSize.height = wholeSize_out[1]; }
+ if(ofs!=null){ ofs.x = ofs_out[0]; ofs.y = ofs_out[1]; }
+ return;
+ }
+
+ //
+ // C++: Mat Mat::mul(Mat m, double scale = 1)
+ //
+
+ // javadoc: Mat::mul(m, scale)
+ public Mat mul(Mat m, double scale)
+ {
+
+ Mat retVal = new Mat(n_mul(nativeObj, m.nativeObj, scale));
+
+ return retVal;
+ }
+
+ // javadoc: Mat::mul(m)
+ public Mat mul(Mat m)
+ {
+
+ Mat retVal = new Mat(n_mul(nativeObj, m.nativeObj));
+
+ return retVal;
+ }
+
+ //
+ // C++: static Mat Mat::ones(int rows, int cols, int type)
+ //
+
+ // javadoc: Mat::ones(rows, cols, type)
+ public static Mat ones(int rows, int cols, int type)
+ {
+
+ Mat retVal = new Mat(n_ones(rows, cols, type));
+
+ return retVal;
+ }
+
+ //
+ // C++: static Mat Mat::ones(Size size, int type)
+ //
+
+ // javadoc: Mat::ones(size, type)
+ public static Mat ones(Size size, int type)
+ {
+
+ Mat retVal = new Mat(n_ones(size.width, size.height, type));
+
+ return retVal;
+ }
+
+ //
+ // C++: void Mat::push_back(Mat m)
+ //
+
+ // javadoc: Mat::push_back(m)
+ public void push_back(Mat m)
+ {
+
+ n_push_back(nativeObj, m.nativeObj);
+
+ return;
+ }
+
+ //
+ // C++: void Mat::release()
+ //
+
+ // javadoc: Mat::release()
+ public void release()
+ {
+
+ n_release(nativeObj);
+
+ return;
+ }
+
+ //
+ // C++: Mat Mat::reshape(int cn, int rows = 0)
+ //
+
+ // javadoc: Mat::reshape(cn, rows)
+ public Mat reshape(int cn, int rows)
+ {
+
+ Mat retVal = new Mat(n_reshape(nativeObj, cn, rows));
+
+ return retVal;
+ }
+
+ // javadoc: Mat::reshape(cn)
+ public Mat reshape(int cn)
+ {
+
+ Mat retVal = new Mat(n_reshape(nativeObj, cn));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::row(int y)
+ //
+
+ // javadoc: Mat::row(y)
+ public Mat row(int y)
+ {
+
+ Mat retVal = new Mat(n_row(nativeObj, y));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::rowRange(int startrow, int endrow)
+ //
+
+ // javadoc: Mat::rowRange(startrow, endrow)
+ public Mat rowRange(int startrow, int endrow)
+ {
+
+ Mat retVal = new Mat(n_rowRange(nativeObj, startrow, endrow));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::rowRange(Range r)
+ //
+
+ // javadoc: Mat::rowRange(r)
+ public Mat rowRange(Range r)
+ {
+
+ Mat retVal = new Mat(n_rowRange(nativeObj, r.start, r.end));
+
+ return retVal;
+ }
+
+ //
+ // C++: int Mat::rows()
+ //
+
+ // javadoc: Mat::rows()
+ public int rows()
+ {
+
+ int retVal = n_rows(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::operator =(Scalar s)
+ //
+
+ // javadoc: Mat::operator =(s)
+ public Mat setTo(Scalar s)
+ {
+
+ Mat retVal = new Mat(n_setTo(nativeObj, s.val[0], s.val[1], s.val[2], s.val[3]));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::setTo(Scalar value, Mat mask = Mat())
+ //
+
+ // javadoc: Mat::setTo(value, mask)
+ public Mat setTo(Scalar value, Mat mask)
+ {
+
+ Mat retVal = new Mat(n_setTo(nativeObj, value.val[0], value.val[1], value.val[2], value.val[3], mask.nativeObj));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::setTo(Mat value, Mat mask = Mat())
+ //
+
+ // javadoc: Mat::setTo(value, mask)
+ public Mat setTo(Mat value, Mat mask)
+ {
+
+ Mat retVal = new Mat(n_setTo(nativeObj, value.nativeObj, mask.nativeObj));
+
+ return retVal;
+ }
+
+ // javadoc: Mat::setTo(value)
+ public Mat setTo(Mat value)
+ {
+
+ Mat retVal = new Mat(n_setTo(nativeObj, value.nativeObj));
+
+ return retVal;
+ }
+
+ //
+ // C++: Size Mat::size()
+ //
+
+ // javadoc: Mat::size()
+ public Size size()
+ {
+
+ Size retVal = new Size(n_size(nativeObj));
+
+ return retVal;
+ }
+
+ //
+ // C++: size_t Mat::step1(int i = 0)
+ //
+
+ // javadoc: Mat::step1(i)
+ public long step1(int i)
+ {
+
+ long retVal = n_step1(nativeObj, i);
+
+ return retVal;
+ }
+
+ // javadoc: Mat::step1()
+ public long step1()
+ {
+
+ long retVal = n_step1(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::operator()(int rowStart, int rowEnd, int colStart, int
+ // colEnd)
+ //
+
+ // javadoc: Mat::operator()(rowStart, rowEnd, colStart, colEnd)
+ public Mat submat(int rowStart, int rowEnd, int colStart, int colEnd)
+ {
+
+ Mat retVal = new Mat(n_submat_rr(nativeObj, rowStart, rowEnd, colStart, colEnd));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::operator()(Range rowRange, Range colRange)
+ //
+
+ // javadoc: Mat::operator()(rowRange, colRange)
+ public Mat submat(Range rowRange, Range colRange)
+ {
+
+ Mat retVal = new Mat(n_submat_rr(nativeObj, rowRange.start, rowRange.end, colRange.start, colRange.end));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::operator()(Rect roi)
+ //
+
+ // javadoc: Mat::operator()(roi)
+ public Mat submat(Rect roi)
+ {
+
+ Mat retVal = new Mat(n_submat(nativeObj, roi.x, roi.y, roi.width, roi.height));
+
+ return retVal;
+ }
+
+ //
+ // C++: Mat Mat::t()
+ //
+
+ // javadoc: Mat::t()
+ public Mat t()
+ {
+
+ Mat retVal = new Mat(n_t(nativeObj));
+
+ return retVal;
+ }
+
+ //
+ // C++: size_t Mat::total()
+ //
+
+ // javadoc: Mat::total()
+ public long total()
+ {
+
+ long retVal = n_total(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: int Mat::type()
+ //
+
+ // javadoc: Mat::type()
+ public int type()
+ {
+
+ int retVal = n_type(nativeObj);
+
+ return retVal;
+ }
+
+ //
+ // C++: static Mat Mat::zeros(int rows, int cols, int type)
+ //
+
+ // javadoc: Mat::zeros(rows, cols, type)
+ public static Mat zeros(int rows, int cols, int type)
+ {
+
+ Mat retVal = new Mat(n_zeros(rows, cols, type));
+
+ return retVal;
+ }
+
+ //
+ // C++: static Mat Mat::zeros(Size size, int type)
+ //
+
+ // javadoc: Mat::zeros(size, type)
+ public static Mat zeros(Size size, int type)
+ {
+
+ Mat retVal = new Mat(n_zeros(size.width, size.height, type));
+
+ return retVal;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ n_delete(nativeObj);
+ super.finalize();
+ }
+
+ // javadoc:Mat::toString()
+ @Override
+ public String toString() {
+ return "Mat [ " +
+ rows() + "*" + cols() + "*" + CvType.typeToString(type()) +
+ ", isCont=" + isContinuous() + ", isSubmat=" + isSubmatrix() +
+ ", nativeObj=0x" + Long.toHexString(nativeObj) +
+ ", dataAddr=0x" + Long.toHexString(dataAddr()) +
+ " ]";
+ }
+
+ // javadoc:Mat::dump()
+ public String dump() {
+ return nDump(nativeObj);
+ }
+
+ // javadoc:Mat::put(row,col,data)
+ public int put(int row, int col, double... data) {
+ int t = type();
+ if (data == null || data.length % CvType.channels(t) != 0)
+ throw new java.lang.UnsupportedOperationException(
+ "Provided data element number (" +
+ (data == null ? 0 : data.length) +
+ ") should be multiple of the Mat channels count (" +
+ CvType.channels(t) + ")");
+ return nPutD(nativeObj, row, col, data.length, data);
+ }
+
+ // javadoc:Mat::put(row,col,data)
+ public int put(int row, int col, float[] data) {
+ int t = type();
+ if (data == null || data.length % CvType.channels(t) != 0)
+ throw new java.lang.UnsupportedOperationException(
+ "Provided data element number (" +
+ (data == null ? 0 : data.length) +
+ ") should be multiple of the Mat channels count (" +
+ CvType.channels(t) + ")");
+ if (CvType.depth(t) == CvType.CV_32F) {
+ return nPutF(nativeObj, row, col, data.length, data);
+ }
+ throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
+ }
+
+ // javadoc:Mat::put(row,col,data)
+ public int put(int row, int col, int[] data) {
+ int t = type();
+ if (data == null || data.length % CvType.channels(t) != 0)
+ throw new java.lang.UnsupportedOperationException(
+ "Provided data element number (" +
+ (data == null ? 0 : data.length) +
+ ") should be multiple of the Mat channels count (" +
+ CvType.channels(t) + ")");
+ if (CvType.depth(t) == CvType.CV_32S) {
+ return nPutI(nativeObj, row, col, data.length, data);
+ }
+ throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
+ }
+
+ // javadoc:Mat::put(row,col,data)
+ public int put(int row, int col, short[] data) {
+ int t = type();
+ if (data == null || data.length % CvType.channels(t) != 0)
+ throw new java.lang.UnsupportedOperationException(
+ "Provided data element number (" +
+ (data == null ? 0 : data.length) +
+ ") should be multiple of the Mat channels count (" +
+ CvType.channels(t) + ")");
+ if (CvType.depth(t) == CvType.CV_16U || CvType.depth(t) == CvType.CV_16S) {
+ return nPutS(nativeObj, row, col, data.length, data);
+ }
+ throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
+ }
+
+ // javadoc:Mat::put(row,col,data)
+ public int put(int row, int col, byte[] data) {
+ int t = type();
+ if (data == null || data.length % CvType.channels(t) != 0)
+ throw new java.lang.UnsupportedOperationException(
+ "Provided data element number (" +
+ (data == null ? 0 : data.length) +
+ ") should be multiple of the Mat channels count (" +
+ CvType.channels(t) + ")");
+ if (CvType.depth(t) == CvType.CV_8U || CvType.depth(t) == CvType.CV_8S) {
+ return nPutB(nativeObj, row, col, data.length, data);
+ }
+ throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
+ }
+
+ // javadoc:Mat::put(row,col,data,offset,length)
+ public int put(int row, int col, byte[] data, int offset, int length) {
+ int t = type();
+ if (data == null || length % CvType.channels(t) != 0)
+ throw new java.lang.UnsupportedOperationException(
+ "Provided data element number (" +
+ (data == null ? 0 : data.length) +
+ ") should be multiple of the Mat channels count (" +
+ CvType.channels(t) + ")");
+ if (CvType.depth(t) == CvType.CV_8U || CvType.depth(t) == CvType.CV_8S) {
+ return nPutBwOffset(nativeObj, row, col, length, offset, data);
+ }
+ throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
+ }
+
+ // javadoc:Mat::get(row,col,data)
+ public int get(int row, int col, byte[] data) {
+ int t = type();
+ if (data == null || data.length % CvType.channels(t) != 0)
+ throw new java.lang.UnsupportedOperationException(
+ "Provided data element number (" +
+ (data == null ? 0 : data.length) +
+ ") should be multiple of the Mat channels count (" +
+ CvType.channels(t) + ")");
+ if (CvType.depth(t) == CvType.CV_8U || CvType.depth(t) == CvType.CV_8S) {
+ return nGetB(nativeObj, row, col, data.length, data);
+ }
+ throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
+ }
+
+ // javadoc:Mat::get(row,col,data)
+ public int get(int row, int col, short[] data) {
+ int t = type();
+ if (data == null || data.length % CvType.channels(t) != 0)
+ throw new java.lang.UnsupportedOperationException(
+ "Provided data element number (" +
+ (data == null ? 0 : data.length) +
+ ") should be multiple of the Mat channels count (" +
+ CvType.channels(t) + ")");
+ if (CvType.depth(t) == CvType.CV_16U || CvType.depth(t) == CvType.CV_16S) {
+ return nGetS(nativeObj, row, col, data.length, data);
+ }
+ throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
+ }
+
+ // javadoc:Mat::get(row,col,data)
+ public int get(int row, int col, int[] data) {
+ int t = type();
+ if (data == null || data.length % CvType.channels(t) != 0)
+ throw new java.lang.UnsupportedOperationException(
+ "Provided data element number (" +
+ (data == null ? 0 : data.length) +
+ ") should be multiple of the Mat channels count (" +
+ CvType.channels(t) + ")");
+ if (CvType.depth(t) == CvType.CV_32S) {
+ return nGetI(nativeObj, row, col, data.length, data);
+ }
+ throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
+ }
+
+ // javadoc:Mat::get(row,col,data)
+ public int get(int row, int col, float[] data) {
+ int t = type();
+ if (data == null || data.length % CvType.channels(t) != 0)
+ throw new java.lang.UnsupportedOperationException(
+ "Provided data element number (" +
+ (data == null ? 0 : data.length) +
+ ") should be multiple of the Mat channels count (" +
+ CvType.channels(t) + ")");
+ if (CvType.depth(t) == CvType.CV_32F) {
+ return nGetF(nativeObj, row, col, data.length, data);
+ }
+ throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
+ }
+
+ // javadoc:Mat::get(row,col,data)
+ public int get(int row, int col, double[] data) {
+ int t = type();
+ if (data == null || data.length % CvType.channels(t) != 0)
+ throw new java.lang.UnsupportedOperationException(
+ "Provided data element number (" +
+ (data == null ? 0 : data.length) +
+ ") should be multiple of the Mat channels count (" +
+ CvType.channels(t) + ")");
+ if (CvType.depth(t) == CvType.CV_64F) {
+ return nGetD(nativeObj, row, col, data.length, data);
+ }
+ throw new java.lang.UnsupportedOperationException("Mat data type is not compatible: " + t);
+ }
+
+ // javadoc:Mat::get(row,col)
+ public double[] get(int row, int col) {
+ return nGet(nativeObj, row, col);
+ }
+
+ // javadoc:Mat::height()
+ public int height() {
+ return rows();
+ }
+
+ // javadoc:Mat::width()
+ public int width() {
+ return cols();
+ }
+
+ // javadoc:Mat::getNativeObjAddr()
+ public long getNativeObjAddr() {
+ return nativeObj;
+ }
+
+ // C++: Mat::Mat()
+ private static native long n_Mat();
+
+ // C++: Mat::Mat(int rows, int cols, int type)
+ private static native long n_Mat(int rows, int cols, int type);
+
+ // C++: Mat::Mat(int rows, int cols, int type, void* data)
+ private static native long n_Mat(int rows, int cols, int type, ByteBuffer data);
+
+ // C++: Mat::Mat(Size size, int type)
+ private static native long n_Mat(double size_width, double size_height, int type);
+
+ // C++: Mat::Mat(int rows, int cols, int type, Scalar s)
+ private static native long n_Mat(int rows, int cols, int type, double s_val0, double s_val1, double s_val2, double s_val3);
+
+ // C++: Mat::Mat(Size size, int type, Scalar s)
+ private static native long n_Mat(double size_width, double size_height, int type, double s_val0, double s_val1, double s_val2, double s_val3);
+
+ // C++: Mat::Mat(Mat m, Range rowRange, Range colRange = Range::all())
+ private static native long n_Mat(long m_nativeObj, int rowRange_start, int rowRange_end, int colRange_start, int colRange_end);
+
+ private static native long n_Mat(long m_nativeObj, int rowRange_start, int rowRange_end);
+
+ // C++: Mat Mat::adjustROI(int dtop, int dbottom, int dleft, int dright)
+ private static native long n_adjustROI(long nativeObj, int dtop, int dbottom, int dleft, int dright);
+
+ // C++: void Mat::assignTo(Mat m, int type = -1)
+ private static native void n_assignTo(long nativeObj, long m_nativeObj, int type);
+
+ private static native void n_assignTo(long nativeObj, long m_nativeObj);
+
+ // C++: int Mat::channels()
+ private static native int n_channels(long nativeObj);
+
+ // C++: int Mat::checkVector(int elemChannels, int depth = -1, bool
+ // requireContinuous = true)
+ private static native int n_checkVector(long nativeObj, int elemChannels, int depth, boolean requireContinuous);
+
+ private static native int n_checkVector(long nativeObj, int elemChannels, int depth);
+
+ private static native int n_checkVector(long nativeObj, int elemChannels);
+
+ // C++: Mat Mat::clone()
+ private static native long n_clone(long nativeObj);
+
+ // C++: Mat Mat::col(int x)
+ private static native long n_col(long nativeObj, int x);
+
+ // C++: Mat Mat::colRange(int startcol, int endcol)
+ private static native long n_colRange(long nativeObj, int startcol, int endcol);
+
+ // C++: int Mat::dims()
+ private static native int n_dims(long nativeObj);
+
+ // C++: int Mat::cols()
+ private static native int n_cols(long nativeObj);
+
+ // C++: void Mat::convertTo(Mat& m, int rtype, double alpha = 1, double beta
+ // = 0)
+ private static native void n_convertTo(long nativeObj, long m_nativeObj, int rtype, double alpha, double beta);
+
+ private static native void n_convertTo(long nativeObj, long m_nativeObj, int rtype, double alpha);
+
+ private static native void n_convertTo(long nativeObj, long m_nativeObj, int rtype);
+
+ // C++: void Mat::copyTo(Mat& m)
+ private static native void n_copyTo(long nativeObj, long m_nativeObj);
+
+ // C++: void Mat::copyTo(Mat& m, Mat mask)
+ private static native void n_copyTo(long nativeObj, long m_nativeObj, long mask_nativeObj);
+
+ // C++: void Mat::create(int rows, int cols, int type)
+ private static native void n_create(long nativeObj, int rows, int cols, int type);
+
+ // C++: void Mat::create(Size size, int type)
+ private static native void n_create(long nativeObj, double size_width, double size_height, int type);
+
+ // C++: Mat Mat::cross(Mat m)
+ private static native long n_cross(long nativeObj, long m_nativeObj);
+
+ // C++: long Mat::dataAddr()
+ private static native long n_dataAddr(long nativeObj);
+
+ // C++: int Mat::depth()
+ private static native int n_depth(long nativeObj);
+
+ // C++: Mat Mat::diag(int d = 0)
+ private static native long n_diag(long nativeObj, int d);
+
+ // C++: static Mat Mat::diag(Mat d)
+ private static native long n_diag(long d_nativeObj);
+
+ // C++: double Mat::dot(Mat m)
+ private static native double n_dot(long nativeObj, long m_nativeObj);
+
+ // C++: size_t Mat::elemSize()
+ private static native long n_elemSize(long nativeObj);
+
+ // C++: size_t Mat::elemSize1()
+ private static native long n_elemSize1(long nativeObj);
+
+ // C++: bool Mat::empty()
+ private static native boolean n_empty(long nativeObj);
+
+ // C++: static Mat Mat::eye(int rows, int cols, int type)
+ private static native long n_eye(int rows, int cols, int type);
+
+ // C++: static Mat Mat::eye(Size size, int type)
+ private static native long n_eye(double size_width, double size_height, int type);
+
+ // C++: Mat Mat::inv(int method = DECOMP_LU)
+ private static native long n_inv(long nativeObj, int method);
+
+ private static native long n_inv(long nativeObj);
+
+ // C++: bool Mat::isContinuous()
+ private static native boolean n_isContinuous(long nativeObj);
+
+ // C++: bool Mat::isSubmatrix()
+ private static native boolean n_isSubmatrix(long nativeObj);
+
+ // C++: void Mat::locateROI(Size wholeSize, Point ofs)
+ private static native void locateROI_0(long nativeObj, double[] wholeSize_out, double[] ofs_out);
+
+ // C++: Mat Mat::mul(Mat m, double scale = 1)
+ private static native long n_mul(long nativeObj, long m_nativeObj, double scale);
+
+ private static native long n_mul(long nativeObj, long m_nativeObj);
+
+ // C++: static Mat Mat::ones(int rows, int cols, int type)
+ private static native long n_ones(int rows, int cols, int type);
+
+ // C++: static Mat Mat::ones(Size size, int type)
+ private static native long n_ones(double size_width, double size_height, int type);
+
+ // C++: void Mat::push_back(Mat m)
+ private static native void n_push_back(long nativeObj, long m_nativeObj);
+
+ // C++: void Mat::release()
+ private static native void n_release(long nativeObj);
+
+ // C++: Mat Mat::reshape(int cn, int rows = 0)
+ private static native long n_reshape(long nativeObj, int cn, int rows);
+
+ private static native long n_reshape(long nativeObj, int cn);
+
+ // C++: Mat Mat::row(int y)
+ private static native long n_row(long nativeObj, int y);
+
+ // C++: Mat Mat::rowRange(int startrow, int endrow)
+ private static native long n_rowRange(long nativeObj, int startrow, int endrow);
+
+ // C++: int Mat::rows()
+ private static native int n_rows(long nativeObj);
+
+ // C++: Mat Mat::operator =(Scalar s)
+ private static native long n_setTo(long nativeObj, double s_val0, double s_val1, double s_val2, double s_val3);
+
+ // C++: Mat Mat::setTo(Scalar value, Mat mask = Mat())
+ private static native long n_setTo(long nativeObj, double s_val0, double s_val1, double s_val2, double s_val3, long mask_nativeObj);
+
+ // C++: Mat Mat::setTo(Mat value, Mat mask = Mat())
+ private static native long n_setTo(long nativeObj, long value_nativeObj, long mask_nativeObj);
+
+ private static native long n_setTo(long nativeObj, long value_nativeObj);
+
+ // C++: Size Mat::size()
+ private static native double[] n_size(long nativeObj);
+
+ // C++: size_t Mat::step1(int i = 0)
+ private static native long n_step1(long nativeObj, int i);
+
+ private static native long n_step1(long nativeObj);
+
+ // C++: Mat Mat::operator()(Range rowRange, Range colRange)
+ private static native long n_submat_rr(long nativeObj, int rowRange_start, int rowRange_end, int colRange_start, int colRange_end);
+
+ // C++: Mat Mat::operator()(Rect roi)
+ private static native long n_submat(long nativeObj, int roi_x, int roi_y, int roi_width, int roi_height);
+
+ // C++: Mat Mat::t()
+ private static native long n_t(long nativeObj);
+
+ // C++: size_t Mat::total()
+ private static native long n_total(long nativeObj);
+
+ // C++: int Mat::type()
+ private static native int n_type(long nativeObj);
+
+ // C++: static Mat Mat::zeros(int rows, int cols, int type)
+ private static native long n_zeros(int rows, int cols, int type);
+
+ // C++: static Mat Mat::zeros(Size size, int type)
+ private static native long n_zeros(double size_width, double size_height, int type);
+
+ // native support for java finalize()
+ private static native void n_delete(long nativeObj);
+
+ private static native int nPutD(long self, int row, int col, int count, double[] data);
+
+ private static native int nPutF(long self, int row, int col, int count, float[] data);
+
+ private static native int nPutI(long self, int row, int col, int count, int[] data);
+
+ private static native int nPutS(long self, int row, int col, int count, short[] data);
+
+ private static native int nPutB(long self, int row, int col, int count, byte[] data);
+
+ private static native int nPutBwOffset(long self, int row, int col, int count, int offset, byte[] data);
+
+ private static native int nGetB(long self, int row, int col, int count, byte[] vals);
+
+ private static native int nGetS(long self, int row, int col, int count, short[] vals);
+
+ private static native int nGetI(long self, int row, int col, int count, int[] vals);
+
+ private static native int nGetF(long self, int row, int col, int count, float[] vals);
+
+ private static native int nGetD(long self, int row, int col, int count, double[] vals);
+
+ private static native double[] nGet(long self, int row, int col);
+
+ private static native String nDump(long self);
+}
diff --git a/openCVLibrary3/src/main/java/org/opencv/core/MatOfByte.java b/openCVLibrary3/src/main/java/org/opencv/core/MatOfByte.java
new file mode 100644
index 00000000000..eb928fb0a9a
--- /dev/null
+++ b/openCVLibrary3/src/main/java/org/opencv/core/MatOfByte.java
@@ -0,0 +1,98 @@
+package org.opencv.core;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MatOfByte extends Mat {
+ // 8UC(x)
+ private static final int _depth = CvType.CV_8U;
+ private static final int _channels = 1;
+
+ public MatOfByte() {
+ super();
+ }
+
+ protected MatOfByte(long addr) {
+ super(addr);
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public static MatOfByte fromNativeAddr(long addr) {
+ return new MatOfByte(addr);
+ }
+
+ public MatOfByte(Mat m) {
+ super(m, Range.all());
+ if( !empty() && checkVector(_channels, _depth) < 0 )
+ throw new IllegalArgumentException("Incompatible Mat");
+ //FIXME: do we need release() here?
+ }
+
+ public MatOfByte(byte...a) {
+ super();
+ fromArray(a);
+ }
+
+ public MatOfByte(int offset, int length, byte...a) {
+ super();
+ fromArray(offset, length, a);
+ }
+
+ public void alloc(int elemNumber) {
+ if(elemNumber>0)
+ super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
+ }
+
+ public void fromArray(byte...a) {
+ if(a==null || a.length==0)
+ return;
+ int num = a.length / _channels;
+ alloc(num);
+ put(0, 0, a); //TODO: check ret val!
+ }
+
+ public void fromArray(int offset, int length, byte...a) {
+ if (offset < 0)
+ throw new IllegalArgumentException("offset < 0");
+ if (a == null)
+ throw new NullPointerException();
+ if (length < 0 || length + offset > a.length)
+ throw new IllegalArgumentException("invalid 'length' parameter: " + Integer.toString(length));
+ if (a.length == 0)
+ return;
+ int num = length / _channels;
+ alloc(num);
+ put(0, 0, a, offset, length); //TODO: check ret val!
+ }
+
+ public byte[] toArray() {
+ int num = checkVector(_channels, _depth);
+ if(num < 0)
+ throw new RuntimeException("Native Mat has unexpected type or size: " + toString());
+ byte[] a = new byte[num * _channels];
+ if(num == 0)
+ return a;
+ get(0, 0, a); //TODO: check ret val!
+ return a;
+ }
+
+ public void fromList(List lb) {
+ if(lb==null || lb.size()==0)
+ return;
+ Byte ab[] = lb.toArray(new Byte[0]);
+ byte a[] = new byte[ab.length];
+ for(int i=0; i