mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-29 02:21:41 +00:00
Update OpenCV to new WPI Maven Repo
Adds support for Linux AARCH64
This commit is contained in:
57
Main/pom.xml
57
Main/pom.xml
@@ -49,6 +49,11 @@
|
||||
<name>WPI Maven repo</name>
|
||||
<url>https://first.wpi.edu/FRC/roborio/maven/release</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>WPIArtifactory</id>
|
||||
<name>WPILib Artifactory Server-releases</name>
|
||||
<url>https://frcmaven.wpi.edu:443/artifactory/release</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<!--javalin micro webservices framework-->
|
||||
@@ -84,7 +89,6 @@
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.5</version>
|
||||
</dependency>
|
||||
<!--what is this for again?-->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
@@ -95,11 +99,17 @@
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.10.0.pr1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- supported platforms for wpilib JNI classifiers
|
||||
linuxathena
|
||||
linuxaarch64bionic
|
||||
linuxraspbian
|
||||
linuxx86-64
|
||||
osxx86-64
|
||||
windowsx86-64
|
||||
-->
|
||||
<!--frc cscore java libs-->
|
||||
@@ -182,6 +192,43 @@
|
||||
</dependency>
|
||||
|
||||
<!-- WPI OpenCV for all supported platforms -->
|
||||
<!-- NEW 2020 OpenCV Deps -->
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.thirdparty.frc2020.opencv</groupId>
|
||||
<artifactId>opencv-java</artifactId>
|
||||
<version>3.4.7-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.thirdparty.frc2020.opencv</groupId>
|
||||
<artifactId>opencv-jni</artifactId>
|
||||
<version>3.4.7-1</version>
|
||||
<classifier>linuxaarch64bionic</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.thirdparty.frc2020.opencv</groupId>
|
||||
<artifactId>opencv-jni</artifactId>
|
||||
<version>3.4.7-1</version>
|
||||
<classifier>linuxraspbian</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.thirdparty.frc2020.opencv</groupId>
|
||||
<artifactId>opencv-jni</artifactId>
|
||||
<version>3.4.7-1</version>
|
||||
<classifier>linuxx86-64</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.thirdparty.frc2020.opencv</groupId>
|
||||
<artifactId>opencv-jni</artifactId>
|
||||
<version>3.4.7-1</version>
|
||||
<classifier>osxx86-64</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.thirdparty.frc2020.opencv</groupId>
|
||||
<artifactId>opencv-jni</artifactId>
|
||||
<version>3.4.7-1</version>
|
||||
<classifier>windowsx86-64</classifier>
|
||||
</dependency>
|
||||
<!-- OLD 2019 OpenCV Deps
|
||||
<dependency>
|
||||
<groupId>edu.wpi.first.thirdparty.frc2019.opencv</groupId>
|
||||
<artifactId>opencv-java</artifactId>
|
||||
@@ -211,10 +258,6 @@
|
||||
<version>3.4.4-5</version>
|
||||
<classifier>linuxraspbian</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.10.0.pr1</version>
|
||||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.chameleonvision.vision.camera;
|
||||
|
||||
import com.chameleonvision.CameraException;
|
||||
import com.chameleonvision.settings.SettingsManager;
|
||||
import com.chameleonvision.vision.Pipeline;
|
||||
import com.chameleonvision.web.ServerHandler;
|
||||
import edu.wpi.cscore.*;
|
||||
import edu.wpi.first.cameraserver.CameraServer;
|
||||
import org.opencv.core.Mat;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -80,7 +82,12 @@ public class Camera {
|
||||
var initTimeMs = (System.nanoTime() - initTimeout) / 1e6;
|
||||
System.out.printf("Camera initialized in %.2fms\n", initTimeMs);
|
||||
}
|
||||
availableVideoModes = Arrays.stream(UsbCam.enumerateVideoModes()).filter(v -> v.fps >= MINIMUM_FPS && v.width >= MINIMUM_WIDTH && v.height >= MINIMUM_HEIGHT).toArray(VideoMode[]::new);
|
||||
var trueVideoModes = UsbCam.enumerateVideoModes();
|
||||
availableVideoModes = Arrays.stream(trueVideoModes).filter(v -> v.fps >= MINIMUM_FPS && v.width >= MINIMUM_WIDTH && v.height >= MINIMUM_HEIGHT && v.pixelFormat == VideoMode.PixelFormat.kYUYV).toArray(VideoMode[]::new);
|
||||
if (availableVideoModes.length == 0) {
|
||||
System.err.println("Camera not supported!");
|
||||
throw new RuntimeException(new CameraException(CameraException.CameraExceptionType.BAD_CAMERA));
|
||||
}
|
||||
if (videoModeIndex <= availableVideoModes.length - 1) {
|
||||
setCamVideoMode(videoModeIndex, false);
|
||||
} else {
|
||||
@@ -109,9 +116,7 @@ public class Camera {
|
||||
private void setCamVideoMode(CamVideoMode newVideoMode, boolean updateCvSource) {
|
||||
var prevVideoMode = this.camVideoMode;
|
||||
this.camVideoMode = newVideoMode;
|
||||
UsbCam.setPixelFormat(newVideoMode.getActualPixelFormat());
|
||||
UsbCam.setFPS(newVideoMode.fps);
|
||||
UsbCam.setResolution(newVideoMode.width, newVideoMode.height);
|
||||
UsbCam.setVideoMode(newVideoMode.getActualPixelFormat(), newVideoMode.width, newVideoMode.height, newVideoMode.fps);
|
||||
|
||||
// update camera values
|
||||
camVals = new CameraValues(this);
|
||||
|
||||
Reference in New Issue
Block a user