public class CameraServer extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
kBasePort |
static int |
kSize160x120
Deprecated.
|
static int |
kSize320x240
Deprecated.
|
static int |
kSize640x480
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
AxisCamera |
addAxisCamera(java.lang.String host)
Adds an Axis IP camera.
|
AxisCamera |
addAxisCamera(java.lang.String[] hosts)
Adds an Axis IP camera.
|
AxisCamera |
addAxisCamera(java.lang.String name,
java.lang.String host)
Adds an Axis IP camera.
|
AxisCamera |
addAxisCamera(java.lang.String name,
java.lang.String[] hosts)
Adds an Axis IP camera.
|
void |
addCamera(VideoSource camera)
Adds an already created camera.
|
MjpegServer |
addServer(java.lang.String name)
Adds a MJPEG server at the next available port.
|
MjpegServer |
addServer(java.lang.String name,
int port)
Adds a MJPEG server.
|
void |
addServer(VideoSink server)
Adds an already created server.
|
static CameraServer |
getInstance()
Get the CameraServer instance.
|
VideoSink |
getServer()
Get server for the primary camera feed.
|
VideoSink |
getServer(java.lang.String name)
Gets a server by name.
|
CvSink |
getVideo()
Get OpenCV access to the primary camera feed.
|
CvSink |
getVideo(java.lang.String name)
Get OpenCV access to the specified camera.
|
CvSink |
getVideo(VideoSource camera)
Get OpenCV access to the specified camera.
|
CvSource |
putVideo(java.lang.String name,
int width,
int height)
Create a MJPEG stream with OpenCV input.
|
void |
removeCamera(java.lang.String name)
Removes a camera by name.
|
void |
removeServer(java.lang.String name)
Removes a server by name.
|
void |
setSize(int size)
Deprecated.
Use setResolution on the UsbCamera returned by startAutomaticCapture() instead.
|
UsbCamera |
startAutomaticCapture()
Start automatically capturing images to send to the dashboard.
|
UsbCamera |
startAutomaticCapture(int dev)
Start automatically capturing images to send to the dashboard.
|
UsbCamera |
startAutomaticCapture(java.lang.String name,
int dev)
Start automatically capturing images to send to the dashboard.
|
UsbCamera |
startAutomaticCapture(java.lang.String name,
java.lang.String path)
Start automatically capturing images to send to the dashboard.
|
void |
startAutomaticCapture(VideoSource camera)
Start automatically capturing images to send to the dashboard from
an existing camera.
|
public static final int kBasePort
@Deprecated public static final int kSize640x480
@Deprecated public static final int kSize320x240
@Deprecated public static final int kSize160x120
public static CameraServer getInstance()
public UsbCamera startAutomaticCapture()
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).
public UsbCamera startAutomaticCapture(int dev)
This overload calls startAutomaticCapture(String, int)
with
a name of "USB Camera {dev}".
dev
- The device number of the camera interfacepublic UsbCamera startAutomaticCapture(java.lang.String name, int dev)
name
- The name to give the cameradev
- The device number of the camera interfacepublic UsbCamera startAutomaticCapture(java.lang.String name, java.lang.String path)
name
- The name to give the camerapath
- The device path (e.g. "/dev/video0") of the camerapublic void startAutomaticCapture(VideoSource camera)
camera
- Camerapublic AxisCamera addAxisCamera(java.lang.String host)
This overload calls addAxisCamera(String, String)
with
name "Axis Camera".
host
- Camera host IP or DNS name (e.g. "10.x.y.11")public AxisCamera addAxisCamera(java.lang.String[] hosts)
This overload calls addAxisCamera(String, String[])
with
name "Axis Camera".
hosts
- Array of Camera host IPs/DNS namespublic AxisCamera addAxisCamera(java.lang.String name, java.lang.String host)
name
- The name to give the camerahost
- Camera host IP or DNS name (e.g. "10.x.y.11")public AxisCamera addAxisCamera(java.lang.String name, java.lang.String[] hosts)
name
- The name to give the camerahosts
- Array of Camera host IPs/DNS namespublic CvSink getVideo()
This is only valid to call after a camera feed has been added with startAutomaticCapture() or addServer().
public CvSink getVideo(VideoSource camera)
camera
- Camera (e.g. as returned by startAutomaticCapture).public CvSink getVideo(java.lang.String name)
name
- Camera namepublic CvSource putVideo(java.lang.String name, int width, int height)
name
- Name to give the streamwidth
- Width of the image being sentheight
- Height of the image being sentpublic MjpegServer addServer(java.lang.String name)
name
- Server namepublic MjpegServer addServer(java.lang.String name, int port)
name
- Server namepublic void addServer(VideoSink server)
server
- Serverpublic void removeServer(java.lang.String name)
name
- Server namepublic VideoSink getServer()
This is only valid to call after a camera feed has been added with startAutomaticCapture() or addServer().
public VideoSink getServer(java.lang.String name)
name
- Server namepublic void addCamera(VideoSource camera)
camera
- Camerapublic void removeCamera(java.lang.String name)
name
- Camera name@Deprecated public void setSize(int size)
size
- The size to use