diff --git a/cameraserver/src/main/java/edu/wpi/first/cameraserver/CameraServer.java b/cameraserver/src/main/java/edu/wpi/first/cameraserver/CameraServer.java index 630943ec5d..b0c01469d6 100644 --- a/cameraserver/src/main/java/edu/wpi/first/cameraserver/CameraServer.java +++ b/cameraserver/src/main/java/edu/wpi/first/cameraserver/CameraServer.java @@ -634,7 +634,10 @@ public final class CameraServer { * * @param host Camera host IP or DNS name (e.g. "10.x.y.11") * @return The Axis camera capturing images. + * @deprecated Call startAutomaticCapture with a HttpCamera instead. */ + @Deprecated(forRemoval = true, since = "2025") + @SuppressWarnings("removal") public static AxisCamera addAxisCamera(String host) { return addAxisCamera("Axis Camera", host); } @@ -646,7 +649,10 @@ public final class CameraServer { * * @param hosts Array of Camera host IPs/DNS names * @return The Axis camera capturing images. + * @deprecated Call startAutomaticCapture with a HttpCamera instead. */ + @Deprecated(forRemoval = true, since = "2025") + @SuppressWarnings("removal") public static AxisCamera addAxisCamera(String[] hosts) { return addAxisCamera("Axis Camera", hosts); } @@ -657,7 +663,10 @@ public final class CameraServer { * @param name The name to give the camera * @param host Camera host IP or DNS name (e.g. "10.x.y.11") * @return The Axis camera capturing images. + * @deprecated Call startAutomaticCapture with a HttpCamera instead. */ + @Deprecated(forRemoval = true, since = "2025") + @SuppressWarnings("removal") public static AxisCamera addAxisCamera(String name, String host) { AxisCamera camera = new AxisCamera(name, host); // Create a passthrough MJPEG server for USB access @@ -672,7 +681,10 @@ public final class CameraServer { * @param name The name to give the camera * @param hosts Array of Camera host IPs/DNS names * @return The Axis camera capturing images. + * @deprecated Call startAutomaticCapture with a HttpCamera instead. */ + @Deprecated(forRemoval = true, since = "2025") + @SuppressWarnings("removal") public static AxisCamera addAxisCamera(String name, String[] hosts) { AxisCamera camera = new AxisCamera(name, hosts); // Create a passthrough MJPEG server for USB access diff --git a/cameraserver/src/main/native/cpp/cameraserver/CameraServer.cpp b/cameraserver/src/main/native/cpp/cameraserver/CameraServer.cpp index 58394b465e..c13c113c56 100644 --- a/cameraserver/src/main/native/cpp/cameraserver/CameraServer.cpp +++ b/cameraserver/src/main/native/cpp/cameraserver/CameraServer.cpp @@ -504,6 +504,7 @@ cs::UsbCamera CameraServer::StartAutomaticCapture(std::string_view name, return camera; } +WPI_IGNORE_DEPRECATED cs::AxisCamera CameraServer::AddAxisCamera(std::string_view host) { return AddAxisCamera("Axis Camera", host); } @@ -559,7 +560,7 @@ cs::AxisCamera CameraServer::AddAxisCamera(std::string_view name, csShared->ReportAxisCamera(camera.GetHandle()); return camera; } - +WPI_UNIGNORE_DEPRECATED cs::MjpegServer CameraServer::AddSwitchedCamera(std::string_view name) { auto& inst = ::GetInstance(); // create a dummy CvSource diff --git a/cameraserver/src/main/native/include/cameraserver/CameraServer.h b/cameraserver/src/main/native/include/cameraserver/CameraServer.h index 09606128bd..0dfa97f178 100644 --- a/cameraserver/src/main/native/include/cameraserver/CameraServer.h +++ b/cameraserver/src/main/native/include/cameraserver/CameraServer.h @@ -10,6 +10,8 @@ #include #include +#include + #include "cscore.h" #include "cscore_cv.h" @@ -73,13 +75,16 @@ class CameraServer { */ static cs::MjpegServer StartAutomaticCapture(const cs::VideoSource& camera); + WPI_IGNORE_DEPRECATED /** * Adds an Axis IP camera. * * This overload calls AddAxisCamera() with name "Axis Camera". * * @param host Camera host IP or DNS name (e.g. "10.x.y.11") + * @deprecated Call StartAutomaticCapture with a HttpCamera instead. */ + [[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]] static cs::AxisCamera AddAxisCamera(std::string_view host); /** @@ -88,7 +93,9 @@ class CameraServer { * This overload calls AddAxisCamera() with name "Axis Camera". * * @param host Camera host IP or DNS name (e.g. "10.x.y.11") + * @deprecated Call StartAutomaticCapture with a HttpCamera instead. */ + [[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]] static cs::AxisCamera AddAxisCamera(const char* host); /** @@ -97,7 +104,9 @@ class CameraServer { * This overload calls AddAxisCamera() with name "Axis Camera". * * @param host Camera host IP or DNS name (e.g. "10.x.y.11") + * @deprecated Call StartAutomaticCapture with a HttpCamera instead. */ + [[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]] static cs::AxisCamera AddAxisCamera(const std::string& host); /** @@ -106,7 +115,9 @@ class CameraServer { * This overload calls AddAxisCamera() with name "Axis Camera". * * @param hosts Array of Camera host IPs/DNS names + * @deprecated Call StartAutomaticCapture with a HttpCamera instead. */ + [[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]] static cs::AxisCamera AddAxisCamera(std::span hosts); /** @@ -115,8 +126,10 @@ class CameraServer { * This overload calls AddAxisCamera() with name "Axis Camera". * * @param hosts Array of Camera host IPs/DNS names + * @deprecated Call StartAutomaticCapture with a HttpCamera instead. */ template + [[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]] static cs::AxisCamera AddAxisCamera(std::initializer_list hosts); /** @@ -124,7 +137,9 @@ class CameraServer { * * @param name The name to give the camera * @param host Camera host IP or DNS name (e.g. "10.x.y.11") + * @deprecated Call StartAutomaticCapture with a HttpCamera instead. */ + [[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]] static cs::AxisCamera AddAxisCamera(std::string_view name, std::string_view host); @@ -133,7 +148,9 @@ class CameraServer { * * @param name The name to give the camera * @param host Camera host IP or DNS name (e.g. "10.x.y.11") + * @deprecated Call StartAutomaticCapture with a HttpCamera instead. */ + [[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]] static cs::AxisCamera AddAxisCamera(std::string_view name, const char* host); /** @@ -141,7 +158,9 @@ class CameraServer { * * @param name The name to give the camera * @param host Camera host IP or DNS name (e.g. "10.x.y.11") + * @deprecated Call StartAutomaticCapture with a HttpCamera instead. */ + [[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]] static cs::AxisCamera AddAxisCamera(std::string_view name, const std::string& host); @@ -150,7 +169,9 @@ class CameraServer { * * @param name The name to give the camera * @param hosts Array of Camera host IPs/DNS names + * @deprecated Call StartAutomaticCapture with a HttpCamera instead. */ + [[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]] static cs::AxisCamera AddAxisCamera(std::string_view name, std::span hosts); @@ -159,10 +180,13 @@ class CameraServer { * * @param name The name to give the camera * @param hosts Array of Camera host IPs/DNS names + * @deprecated Call StartAutomaticCapture with a HttpCamera instead. */ template + [[deprecated("Call StartAutomaticCapture with a HttpCamera instead.")]] static cs::AxisCamera AddAxisCamera(std::string_view name, std::initializer_list hosts); + WPI_UNIGNORE_DEPRECATED /** * Adds a virtual camera for switching between two streams. Unlike the diff --git a/cameraserver/src/main/native/include/cameraserver/CameraServer.inc b/cameraserver/src/main/native/include/cameraserver/CameraServer.inc index 8c8ec21cf9..5ae14f7f9a 100644 --- a/cameraserver/src/main/native/include/cameraserver/CameraServer.inc +++ b/cameraserver/src/main/native/include/cameraserver/CameraServer.inc @@ -11,6 +11,7 @@ namespace frc { +WPI_IGNORE_DEPRECATED template inline cs::AxisCamera CameraServer::AddAxisCamera( std::initializer_list hosts) { @@ -27,5 +28,6 @@ inline cs::AxisCamera CameraServer::AddAxisCamera( } return AddAxisCamera(name, vec); } +WPI_UNIGNORE_DEPRECATED } // namespace frc diff --git a/cscore/src/main/java/edu/wpi/first/cscore/AxisCamera.java b/cscore/src/main/java/edu/wpi/first/cscore/AxisCamera.java index 296bd6bd14..6165fb545d 100644 --- a/cscore/src/main/java/edu/wpi/first/cscore/AxisCamera.java +++ b/cscore/src/main/java/edu/wpi/first/cscore/AxisCamera.java @@ -4,7 +4,12 @@ package edu.wpi.first.cscore; -/** A source that represents an Axis IP camera. */ +/** + * A source that represents an Axis IP camera. + * + * @deprecated Use HttpCamera instead. + */ +@Deprecated(forRemoval = true, since = "2025") public class AxisCamera extends HttpCamera { private static String hostToUrl(String host) { return "http://" + host + "/mjpg/video.mjpg"; diff --git a/cscore/src/main/native/include/cscore_oo.h b/cscore/src/main/native/include/cscore_oo.h index 1f96476742..950fa688ee 100644 --- a/cscore/src/main/native/include/cscore_oo.h +++ b/cscore/src/main/native/include/cscore_oo.h @@ -692,8 +692,10 @@ class HttpCamera : public VideoCamera { /** * A source that represents an Axis IP camera. + * + * @deprecated Use HttpCamera instead. */ -class AxisCamera : public HttpCamera { +class [[deprecated("Use HttpCamera instead.")]] AxisCamera : public HttpCamera { static std::string HostToUrl(std::string_view host); static std::vector HostToUrl(std::span hosts); template diff --git a/cscore/src/main/native/include/cscore_oo.inc b/cscore/src/main/native/include/cscore_oo.inc index 18a1df263d..20960f20e6 100644 --- a/cscore/src/main/native/include/cscore_oo.inc +++ b/cscore/src/main/native/include/cscore_oo.inc @@ -11,6 +11,8 @@ #include #include +#include + #include "cscore_oo.h" namespace cs { @@ -350,7 +352,7 @@ inline std::vector HttpCamera::GetUrls() const { m_status = 0; return ::cs::GetHttpCameraUrls(m_handle, &m_status); } - +WPI_IGNORE_DEPRECATED inline std::vector AxisCamera::HostToUrl( std::span hosts) { std::vector rv; @@ -389,6 +391,7 @@ template inline AxisCamera::AxisCamera(std::string_view name, std::initializer_list hosts) : HttpCamera(name, HostToUrl(hosts), kAxis) {} +WPI_UNIGNORE_DEPRECATED inline void ImageSource::NotifyError(std::string_view msg) { m_status = 0; diff --git a/wpilibcExamples/src/main/cpp/examples/AxisCameraSample/cpp/Robot.cpp b/wpilibcExamples/src/main/cpp/examples/HttpCamera/cpp/Robot.cpp similarity index 83% rename from wpilibcExamples/src/main/cpp/examples/AxisCameraSample/cpp/Robot.cpp rename to wpilibcExamples/src/main/cpp/examples/HttpCamera/cpp/Robot.cpp index 7f4f7615d2..e8b5fe0aa2 100644 --- a/wpilibcExamples/src/main/cpp/examples/AxisCameraSample/cpp/Robot.cpp +++ b/wpilibcExamples/src/main/cpp/examples/HttpCamera/cpp/Robot.cpp @@ -10,16 +10,18 @@ /** * 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 + * image is acquired 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. */ class Robot : public frc::TimedRobot { private: static void VisionThread() { - // Get the Axis camera from CameraServer - cs::AxisCamera camera = - frc::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. + cs::HttpCamera camera{"My Camera", "http://10.x.y.11/video/stream.mjpg"}; + // Start capturing images + frc::CameraServer::StartAutomaticCapture(camera); // Set the resolution camera.SetResolution(640, 480); diff --git a/wpilibcExamples/src/main/cpp/examples/examples.json b/wpilibcExamples/src/main/cpp/examples/examples.json index 0a165d6e8f..2aed399020 100644 --- a/wpilibcExamples/src/main/cpp/examples/examples.json +++ b/wpilibcExamples/src/main/cpp/examples/examples.json @@ -310,12 +310,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": "AxisCameraSample", + "foldername": "HttpCamera", "gradlebase": "cpp", "commandversion": 2 }, diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/examples.json b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/examples.json index 4dcc45d3a5..720ab3c0be 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/examples.json +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/examples.json @@ -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 diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/axiscamera/Main.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/httpcamera/Main.java similarity index 93% rename from wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/axiscamera/Main.java rename to wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/httpcamera/Main.java index cb1423d5e6..9af9e7d068 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/axiscamera/Main.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/httpcamera/Main.java @@ -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; diff --git a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/axiscamera/Robot.java b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/httpcamera/Robot.java similarity index 80% rename from wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/axiscamera/Robot.java rename to wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/httpcamera/Robot.java index 65eafaaec2..dd4bcda326 100644 --- a/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/axiscamera/Robot.java +++ b/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/httpcamera/Robot.java @@ -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);