[cscore] Deprecate AxisCamera (#6579)

This commit is contained in:
Gold856
2024-05-12 13:28:51 -04:00
committed by GitHub
parent fb3e0e1ecb
commit 305a0657e2
12 changed files with 75 additions and 20 deletions

View File

@@ -318,12 +318,12 @@
"commandversion": 2
},
{
"name": "Axis Camera Sample",
"description": "Acquire images from an Axis network camera and adds some annotation to the image (as you might do for showing operators the result of some image recognition), and sends it to the dashboard for display.",
"name": "HTTP Camera",
"description": "Acquire images from an HTTP network camera and adds some annotation to the image (as you might do for showing operators the result of some image recognition), and sends it to the dashboard for display.",
"tags": [
"Vision"
],
"foldername": "axiscamera",
"foldername": "httpcamera",
"gradlebase": "java",
"mainclass": "Main",
"commandversion": 2

View File

@@ -2,7 +2,7 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj.examples.axiscamera;
package edu.wpi.first.wpilibj.examples.httpcamera;
import edu.wpi.first.wpilibj.RobotBase;

View File

@@ -2,12 +2,12 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj.examples.axiscamera;
package edu.wpi.first.wpilibj.examples.httpcamera;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.cscore.AxisCamera;
import edu.wpi.first.cscore.CvSink;
import edu.wpi.first.cscore.CvSource;
import edu.wpi.first.cscore.HttpCamera;
import edu.wpi.first.wpilibj.TimedRobot;
import org.opencv.core.Mat;
import org.opencv.core.Point;
@@ -16,7 +16,7 @@ import org.opencv.imgproc.Imgproc;
/**
* This is a demo program showing the use of OpenCV to do vision processing. The image is acquired
* from the Axis camera, then a rectangle is put on the image and sent to the dashboard. OpenCV has
* from an HTTP camera, then a rectangle is put on the image and sent to the dashboard. OpenCV has
* many methods for different types of processing.
*/
public class Robot extends TimedRobot {
@@ -27,8 +27,12 @@ public class Robot extends TimedRobot {
m_visionThread =
new Thread(
() -> {
// Get the Axis camera from CameraServer
AxisCamera camera = CameraServer.addAxisCamera("axis-camera.local");
// Create an HTTP camera. The address will need to be modified to have the correct
// team number. The exact path will depend on the source.
HttpCamera camera =
new HttpCamera("HTTP Camera", "http://10.x.y.11/video/stream.mjpg");
// Start capturing images
CameraServer.startAutomaticCapture(camera);
// Set the resolution
camera.setResolution(640, 480);