92 template<
typename Format>
96 std::is_same_v<Format, PointXYZ> || std::is_same_v<Format, PointXYZW> || std::is_same_v<Format, PointZ>
97 || std::is_same_v<Format, SNR> || std::is_same_v<Format, Disparity> || std::is_same_v<Format, NormalXYZ>
98 || std::is_same_v<Format, ColorRGBA> || std::is_same_v<Format, ColorRGBA_SRGB>
99 || std::is_same_v<Format, ColorBGRA> || std::is_same_v<Format, ColorBGRA_SRGB>
100 || std::is_same_v<Format, ColorRGBAf> || std::is_same_v<Format, ColorRGB>
101 || std::is_same_v<Format, ColorRGB_SRGB> || std::is_same_v<Format, ColorBGR>
102 || std::is_same_v<Format, ColorBGR_SRGB>,
103 "Format must be one of: PointXYZ, PointXYZW, PointZ, SNR, Disparity, NormalXYZ, "
104 "ColorRGBA, ColorRGBA_SRGB, ColorBGRA, ColorBGRA_SRGB, ColorRGBAf, ColorRGB, ColorRGB_SRGB, "
105 "ColorBGR, or ColorBGR_SRGB");
215 explicit DeviceArray(std::shared_ptr<class DeviceArrayInterface> impl);
216 const std::shared_ptr<class DeviceArrayInterface> &getImpl()
const;
220 std::shared_ptr<class DeviceArrayInterface> m_impl;
268 template<
typename Format>
272 std::is_same_v<Format, PointXYZ> || std::is_same_v<Format, PointXYZW> || std::is_same_v<Format, PointZ>
273 || std::is_same_v<Format, SNR> || std::is_same_v<Format, Disparity> || std::is_same_v<Format, NormalXYZ>
274 || std::is_same_v<Format, ColorRGBA> || std::is_same_v<Format, ColorRGBA_SRGB>
275 || std::is_same_v<Format, ColorBGRA> || std::is_same_v<Format, ColorBGRA_SRGB>
276 || std::is_same_v<Format, ColorRGBAf> || std::is_same_v<Format, ColorRGB>
277 || std::is_same_v<Format, ColorRGB_SRGB> || std::is_same_v<Format, ColorBGR>
278 || std::is_same_v<Format, ColorBGR_SRGB>,
279 "Format must be one of: PointXYZ, PointXYZW, PointZ, SNR, Disparity, NormalXYZ, "
280 "ColorRGBA, ColorRGBA_SRGB, ColorBGRA, ColorBGRA_SRGB, ColorRGBAf, ColorRGB, ColorRGB_SRGB, "
281 "ColorBGR, or ColorBGR_SRGB");
362 explicit DeviceArrayView(std::shared_ptr<class DeviceArrayInterface> impl);
363 const std::shared_ptr<class DeviceArrayInterface> &getImpl()
const;
367 std::shared_ptr<class DeviceArrayInterface> m_impl;
392 template<
typename ColorFormat>
393 struct SupportedImageDeviceArrayColorFormat : std::false_type
397 struct SupportedImageDeviceArrayColorFormat<ColorRGBA> : std::true_type
401 struct SupportedImageDeviceArrayColorFormat<ColorBGRA> : std::true_type
405 struct SupportedImageDeviceArrayColorFormat<ColorRGBA_SRGB> : std::true_type
409 struct SupportedImageDeviceArrayColorFormat<ColorBGRA_SRGB> : std::true_type
413 struct SupportedImageDeviceArrayColorFormat<ColorRGBAf> : std::true_type
417 struct SupportedImageDeviceArrayColorFormat<ColorRGB> : std::true_type
421 struct SupportedImageDeviceArrayColorFormat<ColorRGB_SRGB> : std::true_type
425 struct SupportedImageDeviceArrayColorFormat<ColorBGR> : std::true_type
429 struct SupportedImageDeviceArrayColorFormat<ColorBGR_SRGB> : std::true_type
432 template<
typename Format>
433 struct SupportedDeviceArrayViewFormat : std::bool_constant<SupportedImageDeviceArrayColorFormat<Format>::value>
450 template<typename ColorFormat, typename = std::enable_if_t<Detail::SupportedImageColorFormat<ColorFormat>::value>>
468 template<typename ColorFormat, typename = std::enable_if_t<Detail::SupportedImageColorFormat<ColorFormat>::value>>
#define ZIVID_CORE_EXPORT_NON_WIN32
Definition CoreExport.h:61
One-dimensional container of data.
Definition Array1D.h:72
Two-dimensional container of data.
Definition Array2D.h:83
Non-owning view of a device buffer.
Definition DeviceArray.h:270
void * devicePointer() const
Get the raw GPU device pointer to the data.
DeviceArrayView(const DeviceArray< Format > &source)
Borrow a view from an owning DeviceArray.
DeviceArrayView(DeviceArrayView &&other) noexcept=default
Move constructor.
std::vector< int > stridesInBytes() const
Get the strides of the data in bytes.
size_t size() const
Get the total number of elements in the data.
Array2D< Format > toArray2D(StreamOrQueue streamOrQueue) const
Enqueue a device-to-host copy and return as Array2D without synchronizing.
bool isValid() const
Check if the buffer is valid (not empty)
size_t sizeInBytes() const
Get the total size of the data in bytes.
ComputeBackend backend() const
Get the GPU compute backend type of this buffer.
bool isEmpty() const
Check if the buffer is empty.
~DeviceArrayView()=default
Destructor.
DeviceArrayView()=default
Default constructor - creates an empty view.
DeviceArrayView(const DeviceArrayView &other)=default
Copy constructor - shares the view.
std::vector< int > strides() const
Get the strides of the data in element count.
DeviceArrayView & operator=(DeviceArrayView &&other) noexcept=default
Move assignment.
DeviceArrayView & operator=(const DeviceArrayView &other)=default
Copy assignment.
Array1D< Format > toArray1D(StreamOrQueue streamOrQueue) const
Enqueue a device-to-host copy and return as Array1D without synchronizing.
std::vector< int > shape() const
Get the shape of the data.
void copyToHost(Format *destination, size_t sizeInBytes, StreamOrQueue streamOrQueue) const
Enqueue a device-to-host copy without synchronizing.
Reference-counted handle to data on a GPU device.
Definition DeviceArray.h:94
ComputeBackend backend() const
Get the GPU compute backend type of this buffer.
void * devicePointer() const
Get the raw GPU device pointer to the data.
DeviceArray & operator=(const DeviceArray &other)=default
Copy assignment - shares ownership of the buffer.
DeviceArray(DeviceArray &&other) noexcept=default
Move constructor.
bool isEmpty() const
Check if the buffer is empty.
DeviceArray & operator=(DeviceArray &&other) noexcept=default
Move assignment.
size_t size() const
Get the total number of elements in the data.
std::vector< int > strides() const
Get the strides of the data in element count.
void copyToHost(Format *destination, size_t sizeInBytes, StreamOrQueue streamOrQueue) const
Copy device buffer data to host memory.
Array2D< Format > toArray2D(StreamOrQueue streamOrQueue) const
Copy device buffer data to host and return as Array2D.
size_t sizeInBytes() const
Get the total size of the data in bytes.
DeviceArray(const DeviceArray &other)=default
Copy constructor - shares ownership of the buffer.
~DeviceArray()=default
Destructor - releases reference to the underlying buffer.
bool isValid() const
Check if the buffer is valid (not empty)
Array1D< Format > toArray1D(StreamOrQueue streamOrQueue) const
Copy device buffer data to host and return as Array1D.
std::vector< int > shape() const
Get the shape of the data.
std::vector< int > stridesInBytes() const
Get the strides of the data in bytes.
DeviceArray()=default
Default constructor - creates an empty DeviceArray.
A 2-dimensional image.
Definition Image.h:141
Definition EnvironmentInfo.h:74
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:85
Image< ColorFormat > toImage(const DeviceArray< ColorFormat > &buffer, StreamOrQueue streamOrQueue)
Enqueue a device-to-host copy and return as Image without synchronizing.
Definition DeviceArray.h:451
ComputeBackend
GPU compute backend type.
Definition ComputeWrappers.h:52
A user CUDA stream or OpenCL command queue, selected by which member is populated.
Definition ComputeWrappers.h:106