Class CameraServer
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic AxisCameraaddAxisCamera(String host) Deprecated, for removal: This API element is subject to removal in a future version.Call startAutomaticCapture with a HttpCamera instead.static AxisCameraaddAxisCamera(String[] hosts) Deprecated, for removal: This API element is subject to removal in a future version.Call startAutomaticCapture with a HttpCamera instead.static AxisCameraaddAxisCamera(String name, String host) Deprecated, for removal: This API element is subject to removal in a future version.Call startAutomaticCapture with a HttpCamera instead.static AxisCameraaddAxisCamera(String name, String[] hosts) Deprecated, for removal: This API element is subject to removal in a future version.Call startAutomaticCapture with a HttpCamera instead.static voidaddCamera(VideoSource camera) Adds an already created camera.static voidAdds an already created server.static MjpegServerAdds a MJPEG server at the next available port.static MjpegServerAdds a MJPEG server.static MjpegServeraddSwitchedCamera(String name) Adds a virtual camera for switching between two streams.static VideoSinkGet server for the primary camera feed.static VideoSinkGets a server by name.static CvSinkgetVideo()Get OpenCV access to the primary camera feed.static CvSinkgetVideo(VideoSource camera) Get OpenCV access to the specified camera.static CvSinkgetVideo(VideoSource camera, PixelFormat pixelFormat) Get OpenCV access to the specified camera.static CvSinkGet OpenCV access to the specified camera.static CvSourceCreate a MJPEG stream with OpenCV input.static voidremoveCamera(String name) Removes a camera by name.static voidremoveServer(String name) Removes a server by name.static UsbCameraStart automatically capturing images to send to the dashboard.static UsbCamerastartAutomaticCapture(int dev) Start automatically capturing images to send to the dashboard.static MjpegServerstartAutomaticCapture(VideoSource camera) Start automatically capturing images to send to the dashboard from an existing camera.static UsbCamerastartAutomaticCapture(String name, int dev) Start automatically capturing images to send to the dashboard.static UsbCamerastartAutomaticCapture(String name, String path) Start automatically capturing images to send to the dashboard.
-
Field Details
-
kBasePort
CameraServer base port.- See Also:
-
-
Method Details
-
startAutomaticCapture
Start automatically capturing images to send to the dashboard.You should call this method to see a camera feed on the dashboard. If you also want to perform vision processing on the roboRIO, use getVideo() to get access to the camera images.
The first time this overload is called, it calls
startAutomaticCapture(int)with device 0, creating a camera named "USB Camera 0". Subsequent calls increment the device number (e.g. 1, 2, etc).- Returns:
- The USB camera capturing images.
-
startAutomaticCapture
Start automatically capturing images to send to the dashboard.This overload calls
startAutomaticCapture(String, int)with a name of "USB Camera {dev}".- Parameters:
dev- The device number of the camera interface- Returns:
- The USB camera capturing images.
-
startAutomaticCapture
Start automatically capturing images to send to the dashboard.- Parameters:
name- The name to give the cameradev- The device number of the camera interface- Returns:
- The USB camera capturing images.
-
startAutomaticCapture
Start automatically capturing images to send to the dashboard.- Parameters:
name- The name to give the camerapath- The device path (e.g. "/dev/video0") of the camera- Returns:
- The USB camera capturing images.
-
startAutomaticCapture
Start automatically capturing images to send to the dashboard from an existing camera.- Parameters:
camera- Camera- Returns:
- The MJPEG server serving images from the given camera.
-
addAxisCamera
Deprecated, for removal: This API element is subject to removal in a future version.Call startAutomaticCapture with a HttpCamera instead.Adds an Axis IP camera.This overload calls
addAxisCamera(String, String)with name "Axis Camera".- Parameters:
host- Camera host IP or DNS name (e.g. "10.x.y.11")- Returns:
- The Axis camera capturing images.
-
addAxisCamera
Deprecated, for removal: This API element is subject to removal in a future version.Call startAutomaticCapture with a HttpCamera instead.Adds an Axis IP camera.This overload calls
addAxisCamera(String, String[])with name "Axis Camera".- Parameters:
hosts- Array of Camera host IPs/DNS names- Returns:
- The Axis camera capturing images.
-
addAxisCamera
@Deprecated(forRemoval=true, since="2025") public static AxisCamera addAxisCamera(String name, String host) Deprecated, for removal: This API element is subject to removal in a future version.Call startAutomaticCapture with a HttpCamera instead.Adds an Axis IP camera.- Parameters:
name- The name to give the camerahost- Camera host IP or DNS name (e.g. "10.x.y.11")- Returns:
- The Axis camera capturing images.
-
addAxisCamera
@Deprecated(forRemoval=true, since="2025") public static AxisCamera addAxisCamera(String name, String[] hosts) Deprecated, for removal: This API element is subject to removal in a future version.Call startAutomaticCapture with a HttpCamera instead.Adds an Axis IP camera.- Parameters:
name- The name to give the camerahosts- Array of Camera host IPs/DNS names- Returns:
- The Axis camera capturing images.
-
addSwitchedCamera
Adds a virtual camera for switching between two streams. Unlike the other addCamera methods, this returns a VideoSink rather than a VideoSource. Calling setSource() on the returned object can be used to switch the actual source of the stream.- Parameters:
name- The name to give the camera- Returns:
- The MJPEG server serving images from the given camera.
-
getVideo
Get OpenCV access to the primary camera feed. This allows you to get images from the camera for image processing on the roboRIO.This is only valid to call after a camera feed has been added with startAutomaticCapture() or addServer().
- Returns:
- OpenCV sink for the primary camera feed
-
getVideo
Get OpenCV access to the specified camera. This allows you to get images from the camera for image processing on the roboRIO.- Parameters:
camera- Camera (e.g. as returned by startAutomaticCapture).- Returns:
- OpenCV sink for the specified camera
-
getVideo
Get OpenCV access to the specified camera. This allows you to get images from the camera for image processing on the roboRIO.- Parameters:
camera- Camera (e.g. as returned by startAutomaticCapture).pixelFormat- Desired pixelFormat of the camera- Returns:
- OpenCV sink for the specified camera
-
getVideo
Get OpenCV access to the specified camera. This allows you to get images from the camera for image processing on the roboRIO.- Parameters:
name- Camera name- Returns:
- OpenCV sink for the specified camera
-
putVideo
Create a MJPEG stream with OpenCV input. This can be called to pass custom annotated images to the dashboard.- Parameters:
name- Name to give the streamwidth- Width of the image being sentheight- Height of the image being sent- Returns:
- OpenCV source for the MJPEG stream
-
addServer
Adds a MJPEG server at the next available port.- Parameters:
name- Server name- Returns:
- The MJPEG server
-
addServer
Adds a MJPEG server.- Parameters:
name- Server nameport- Server port- Returns:
- The MJPEG server
-
addServer
Adds an already created server.- Parameters:
server- Server
-
removeServer
Removes a server by name.- Parameters:
name- Server name
-
getServer
Get server for the primary camera feed.This is only valid to call after a camera feed has been added with startAutomaticCapture() or addServer().
- Returns:
- The server for the primary camera feed
-
getServer
Gets a server by name.- Parameters:
name- Server name- Returns:
- The server
-
addCamera
Adds an already created camera.- Parameters:
camera- Camera
-
removeCamera
Removes a camera by name.- Parameters:
name- Camera name
-