Zivid C++ API 2.13.1+18e79e79-1
|
Interface to one Zivid camera. More...
#include <Zivid/Camera.h>
Public Member Functions | |
ZIVID_CORE_EXPORT | Camera () |
Constructor. | |
ZIVID_CORE_EXPORT | ~Camera () |
Destructor. | |
ZIVID_CORE_EXPORT | Camera (const Camera &other) noexcept |
Copy constructor. | |
ZIVID_CORE_EXPORT Camera & | operator= (const Camera &other) noexcept |
Copy assignment. | |
ZIVID_CORE_EXPORT | Camera (Camera &&other) noexcept |
Move constructor. | |
ZIVID_CORE_EXPORT Camera & | operator= (Camera &&other) noexcept |
Move assignment operator. | |
ZIVID_CORE_EXPORT Camera & | connect () |
Connect to the camera. | |
ZIVID_CORE_EXPORT void | disconnect () |
Disconnect from the camera and free all resources associated with it. | |
ZIVID_CORE_EXPORT void | closeAperture () |
Close the camera's aperture. | |
ZIVID_CORE_EXPORT CameraState | state () const |
Get the current camera state. | |
ZIVID_CORE_EXPORT Frame | capture (const Settings &settings) |
Capture a single frame. | |
ZIVID_CORE_EXPORT Frame2D | capture (const Settings2D &settings2D) |
Capture a single 2D frame. | |
ZIVID_CORE_EXPORT CameraInfo | info () const |
Get information about camera model, serial number etc. | |
ZIVID_CORE_EXPORT void | writeUserData (const std::vector< uint8_t > &data) |
Write user data to camera. The total number of writes supported depends on camera model and size of data. | |
ZIVID_CORE_EXPORT std::vector< uint8_t > | userData () const |
Read user data from camera. | |
ZIVID_CORE_EXPORT NetworkConfiguration | networkConfiguration () const |
Get the network configuration from the camera. | |
ZIVID_CORE_EXPORT void | applyNetworkConfiguration (const NetworkConfiguration &networkConfiguration) |
Applies the specified network configuration to the camera. | |
ZIVID_CORE_EXPORT std::string | toString () const |
Get string representation of the camera info. | |
ZIVID_CORE_EXPORT bool | operator== (const Camera &other) const |
Check if two camera instances represent the same device. | |
ZIVID_CORE_EXPORT bool | operator!= (const Camera &other) const |
Check if two camera instances represent different devices. | |
Interface to one Zivid camera.
See Settings and Settings2D for a list of settings that can be configured in the camera. Capture frames by calling capture.
ZIVID_CORE_EXPORT Zivid::Camera::Camera | ( | ) |
Constructor.
ZIVID_CORE_EXPORT Zivid::Camera::~Camera | ( | ) |
Destructor.
|
noexcept |
Copy constructor.
|
noexcept |
Move constructor.
ZIVID_CORE_EXPORT void Zivid::Camera::applyNetworkConfiguration | ( | const NetworkConfiguration & | networkConfiguration | ) |
Applies the specified network configuration to the camera.
networkConfiguration | The network configuration to apply to the camera. |
applyNetworkConfiguration
will block until the camera has finished applying the network configuration, or throw an exception if the camera does not reappear on the network before a timeout occurs.
applyNetworkConfiguration
can be used even if the camera is inaccessible via TCP/IP, for example a camera that is on a different subnet to the PC, or a camera with an IP conflict, as it uses UDP multicast to communicate with the camera.
applyNetworkConfiguration
can also be used to configure cameras that require a firmware update, as long as the firmware supports network configuration via UDP multicast. This has been supported on all firmware versions included with SDK 2.10.0 or newer. This method will throw an exception if the camera firmware is too old to support UDP multicast.
applyNetworkConfiguration
will throw an exception if the camera status (see CameraState::Status) is "busy", "connected", "connecting" or "disconnecting". If the status is "connected", then you must first call disconnect() before calling this method.
ZIVID_CORE_EXPORT Frame Zivid::Camera::capture | ( | const Settings & | settings | ) |
Capture a single frame.
settings | Settings to use for the capture |
This method returns right after the acquisition of the images is complete, and the camera has stopped projecting patterns. Therefore, after this method has returned, the camera can be moved, or objects in the scene can be moved, or a capture from another camera with overlapping field of view can be triggered, without affecting the point cloud.
When this method returns, there is still remaining data to transfer from the camera to the PC, and the processing of the final point cloud is not completed. Transfer and processing of the point cloud will continue in the background. When you call a method on the returned Frame object that requires the capture to be finished, for example Frame::pointCloud(), that method will block until the processing is finished and the point cloud is available. If an exception occurs after the acquisition of images is complete (during transfer or processing of the capture), then that exception is instead thrown when you access the Frame object.
The capture
function can be invoked back-to-back, for doing rapid back-to-back acquisition of multiple (2D or 3D) captures on the same camera. This is for example useful if you want to do one high-resolution 2D capture followed by a lower-resolution 3D capture. The acquisition of the next capture will begin quickly after acquisition of the previous capture completed, even when there is remaining transfer and processing for the first capture. This allows pipelining several 2D and/or 3D captures, by doing acquisition in parallel with data transfer and processing.
Note: There can be maximum of two in-progress uncompleted 3D captures simultaneously per Zivid camera. If you invoke capture
when there are two uncompleted 3D captures in-progress, then the capture will not start until the first of the in-progress 3D captures has finished all transfer and processing. There is a similar limit of maximum two in-process 2D captures per camera.
capture
can be called from multiple threads at the same time, for example by using std::async
. Multiple capture commands on the same camera object from different threads will be queued and executed in order (first in, first out).
capture
can also be called on multiple cameras simultaneously. However, if the cameras have overlapping field-of-view then you need to take consideration and sequence the capture calls to avoid the captures interfering with each other.
Note that all of these remarks apply for both 3D and 2D captures.
ZIVID_CORE_EXPORT Frame2D Zivid::Camera::capture | ( | const Settings2D & | settings2D | ) |
Capture a single 2D frame.
settings2D | Settings2D to use for the capture |
This method returns right after the acquisition of the images is complete, and the camera has stopped projecting patterns. For more information, see the remarks section of capture(const Settings &settings) above. Those remarks apply for both 2D and 3D capture.
ZIVID_CORE_EXPORT void Zivid::Camera::closeAperture | ( | ) |
Close the camera's aperture.
The aperture will be opened again on the next call to capture.
ZIVID_CORE_EXPORT Camera & Zivid::Camera::connect | ( | ) |
Connect to the camera.
ZIVID_CORE_EXPORT void Zivid::Camera::disconnect | ( | ) |
Disconnect from the camera and free all resources associated with it.
ZIVID_CORE_EXPORT CameraInfo Zivid::Camera::info | ( | ) | const |
Get information about camera model, serial number etc.
ZIVID_CORE_EXPORT NetworkConfiguration Zivid::Camera::networkConfiguration | ( | ) | const |
Get the network configuration from the camera.
ZIVID_CORE_EXPORT bool Zivid::Camera::operator!= | ( | const Camera & | other | ) | const |
Check if two camera instances represent different devices.
|
noexcept |
Move assignment operator.
|
noexcept |
Copy assignment.
ZIVID_CORE_EXPORT bool Zivid::Camera::operator== | ( | const Camera & | other | ) | const |
Check if two camera instances represent the same device.
ZIVID_CORE_EXPORT CameraState Zivid::Camera::state | ( | ) | const |
Get the current camera state.
ZIVID_CORE_EXPORT std::string Zivid::Camera::toString | ( | ) | const |
Get string representation of the camera info.
ZIVID_CORE_EXPORT std::vector< uint8_t > Zivid::Camera::userData | ( | ) | const |
Read user data from camera.
ZIVID_CORE_EXPORT void Zivid::Camera::writeUserData | ( | const std::vector< uint8_t > & | data | ) |
Write user data to camera. The total number of writes supported depends on camera model and size of data.