Zivid C++ API 2.14.0+e4a0c4a9-1
|
A frame captured by a Zivid camera. More...
#include <Zivid/Frame.h>
Public Member Functions | |
ZIVID_CORE_EXPORT | Frame () |
Construct a new frame. | |
ZIVID_CORE_EXPORT | Frame (const std::string &fileName) |
Creates a frame by loading data from a file. | |
ZIVID_CORE_EXPORT PointCloud | pointCloud () const |
Get the point cloud. | |
ZIVID_CORE_EXPORT std::optional< Frame2D > | frame2D () const |
Get 2D frame from 2D+3D frame. | |
ZIVID_CORE_EXPORT CameraState | state () const |
Get the camera state data at the time of the frame capture. | |
ZIVID_CORE_EXPORT Settings | settings () const |
Get the settings used to capture this frame. | |
ZIVID_CORE_EXPORT FrameInfo | info () const |
Get information collected at the time of the frame capture. | |
ZIVID_CORE_EXPORT CameraInfo | cameraInfo () const |
Get information about the camera used to capture the frame. | |
ZIVID_CORE_EXPORT void | save (const std::string &fileName) const |
Save the frame to file. | |
ZIVID_CORE_EXPORT void | load (const std::string &fileName) |
Load a frame from a Zivid data file. | |
ZIVID_CORE_EXPORT std::string | toString () const |
Get string representation of the frame. | |
ZIVID_CORE_EXPORT Frame | clone () const |
Returns a clone of the frame. The clone will include a copy of all of the point cloud data on the compute device memory. This means that the returned frame will not be affected by subsequent modifications on the original frame or point cloud. | |
A frame captured by a Zivid camera.
Contains the point cloud (stored on compute device memory) as well as calibration data, settings and state used by the API at time of the frame capture. Use Frame::pointCloud() to access point cloud data.
Note that if this Frame object was returned from a call to Camera::capture, then there may still be remaining data transfer and processing going on in the background. When you call a method on the Frame object that requires the capture to be finished, for example Frame::pointCloud(), the method will block until the point cloud is available.
ZIVID_CORE_EXPORT Zivid::Frame::Frame | ( | ) |
Construct a new frame.
|
explicit |
Creates a frame by loading data from a file.
ZIVID_CORE_EXPORT CameraInfo Zivid::Frame::cameraInfo | ( | ) | const |
Get information about the camera used to capture the frame.
This method returns instantly, even if the capture is still in-progress.
ZIVID_CORE_EXPORT Frame Zivid::Frame::clone | ( | ) | const |
Returns a clone of the frame. The clone will include a copy of all of the point cloud data on the compute device memory. This means that the returned frame will not be affected by subsequent modifications on the original frame or point cloud.
This function incurs a performance cost due to the copying of the compute device memory. When performance is important we recommend to avoid using this method, and instead modify the existing frame or point cloud.
ZIVID_CORE_EXPORT std::optional< Frame2D > Zivid::Frame::frame2D | ( | ) | const |
Get 2D frame from 2D+3D frame.
If the frame is the result of a 2D+3D capture, this method returns the 2D frame contained in the 2D+3D frame. In the case of a 3D-only capture, this method returns an empty std::optional.
If the frame was captured by an SDK version prior to 2.14.0, then this method will return an empty std::optional.
If the 2D frame is not yet available because the capture is still in-progress, then this method will block until acquisition of the entire 2D+3D capture is done. If you need to access the 2D frame before the 3D acquisition has finished, then it is required to do separate 2D and 3D captures.
In a 2D+3D capture, the 2D color image and 3D point cloud may have different resolutions depending on the pixel sampling settings used. The 2D pixel sampling setting determines the resolution of the 2D color image whereas the 3D pixel sampling setting and the resampling setting determines the resolution of the 3D point cloud. The 2D color image returned in this 2D frame will always have the same resolution as the 2D color image that was captured. On the other hand, the point cloud colors will be sampled from the 2D color image to match the resolution of the 3D point cloud. The point cloud colors will always have a 1:1 correspondence with the 3D point cloud resolution. See PointCloud for more information.
ZIVID_CORE_EXPORT FrameInfo Zivid::Frame::info | ( | ) | const |
Get information collected at the time of the frame capture.
If the capture is still in-progress, then this method will block until the capture completes.
ZIVID_CORE_EXPORT void Zivid::Frame::load | ( | const std::string & | fileName | ) |
Load a frame from a Zivid data file.
ZIVID_CORE_EXPORT PointCloud Zivid::Frame::pointCloud | ( | ) | const |
Get the point cloud.
If the point cloud is not yet available because the capture is still in-progress, then this method will block until the point cloud is available.
The PointCloud instance returned is a handle to the actual point cloud data stored on the compute device memory. See PointCloud for more information.
ZIVID_CORE_EXPORT void Zivid::Frame::save | ( | const std::string & | fileName | ) | const |
Save the frame to file.
The file type is determined from the file extension. Supported extensions are .zdf, .ply (ordered), .xyz and .pcd.
If the capture is still in-progress, then this method will block until the capture completes.
This method will copy the necessary point cloud data from the compute device (GPU) memory into host memory (RAM), unless that data has already been copied to host memory by an earlier function call.
This method saves the RGB colors in linear color space for .ply, .xyz and .pcd file formats. To store colors in sRGB color space, use Zivid::Experimental::PointCloudExport::exportFrame(const Zivid::Frame &, const Zivid::Experimental::PointCloudExport::FileFormat::PLY &) or Zivid::Experimental::PointCloudExport::exportFrame(const Zivid::Frame &, const Zivid::Experimental::PointCloudExport::FileFormat::XYZ &) or Zivid::Experimental::PointCloudExport::exportFrame(const Zivid::Frame &, const Zivid::Experimental::PointCloudExport::FileFormat::PCD &).
ZIVID_CORE_EXPORT Settings Zivid::Frame::settings | ( | ) | const |
Get the settings used to capture this frame.
This method returns instantly, even if the capture is still in-progress.
ZIVID_CORE_EXPORT CameraState Zivid::Frame::state | ( | ) | const |
Get the camera state data at the time of the frame capture.
If the capture is still in-progress, then this method will block until the capture completes.
ZIVID_CORE_EXPORT std::string Zivid::Frame::toString | ( | ) | const |
Get string representation of the frame.
If the capture is still in-progress, then this method will block until the capture completes.