Viam C++ SDK current
|
A Camera
represents any physical hardware that can capture frames.
More...
#include "components/camera.hpp"
Classes | |
struct | distortion_parameters |
The distortion parameters of the camera. More... | |
struct | image_collection |
a collection of images that were collected from a camera all at the same time. More... | |
struct | intrinsic_parameters |
struct | point_cloud |
The points and mime type of a point cloud. More... | |
struct | properties |
The camera's supported features and settings. More... | |
struct | raw_image |
the raw bytes, mime type of an image, and name of the source that produced it. More... | |
Public Types | |
using | mime_types = std::vector<std::string> |
The supported mime types of the camera— a type alias. | |
using | depth_map = xt::xarray<uint16_t> |
Public Member Functions | |
virtual ProtoStruct | do_command (const ProtoStruct &command)=0 |
Send/receive arbitrary commands to the resource. | |
raw_image | get_image (std::string mime_type) |
Get the next image from the camera as a raw image. | |
virtual raw_image | get_image (std::string mime_type, const ProtoStruct &extra)=0 |
Get the next image from the camera as a raw image. | |
virtual image_collection | get_images ()=0 |
Get the next images from the camera as a vector of raw images with names and metadata. | |
point_cloud | get_point_cloud (std::string mime_type) |
Get the next point_cloud from the camera. | |
virtual point_cloud | get_point_cloud (std::string mime_type, const ProtoStruct &extra)=0 |
Get the next point_cloud from the camera. | |
std::vector< GeometryConfig > | get_geometries () |
Returns GeometryConfig s associated with the calling camera. | |
virtual std::vector< GeometryConfig > | get_geometries (const ProtoStruct &extra)=0 |
Returns GeometryConfig s associated with the calling camera. | |
virtual properties | get_properties ()=0 |
Get the camera's properties. | |
API | api () const override |
Returns the API associated with a particular resource. | |
Public Member Functions inherited from viam::sdk::Component | |
Name | get_resource_name () const override |
Returns the Name for a particular resource. | |
Public Member Functions inherited from viam::sdk::Resource | |
Resource (std::string name) | |
virtual std::string | name () const |
Return the resource's name. | |
Static Public Member Functions | |
static std::vector< unsigned char > | encode_depth_map (const Camera::depth_map &m) |
static Camera::depth_map | decode_depth_map (const std::vector< unsigned char > &data) |
static std::string | normalize_mime_type (const std::string &str) |
remove any extra suffix's from the mime type string. | |
Static Public Attributes | |
static const std::string | lazy_suffix |
Protected Member Functions | |
Camera (std::string name) | |
Protected Member Functions inherited from viam::sdk::Component | |
Component (std::string name) | |
Protected Member Functions inherited from viam::sdk::Resource | |
Name | get_resource_name (const std::string &type) const |
A Camera
represents any physical hardware that can capture frames.
This acts as an abstract base class to be inherited from by any drivers representing specific camera implementations. This class cannot be used on its own.
|
overridevirtual |
Returns the API
associated with a particular resource.
Implements viam::sdk::Resource.
|
static |
Decode image data of custom MIME type FORMAT_RAW_DEPTH into a depth_map structure.
This function processes a binary blob representing a depth map in a specific format and extracts the dimensions and depth values contained within.
data | A vector of unsigned chars representing the binary data of the depth map. |
Exception | if the data is misformatted e.g. doesn't contain valid depth information, or if the data size does not match the expected size based on the width and height. |
|
pure virtual |
Send/receive arbitrary commands to the resource.
Command | the command to execute. |
Implemented in viam::sdk::impl::CameraClient.
|
static |
Encodes the dimensions and depth values of a depth map into a raw binary format (MIME type FORMAT_RAW_DEPTH).
This function takes a depth_map, and encodes this information into a binary blob. The binary format consists of "magic number" header (UTF-8 encoding for 'DEPTHMAP' in big-endian), then the width and height encoded as 64-bit unsigned integers, followed by the depth values encoded as 16-bit unsigned integers (big-endian format). This format is suitable for serialization and transmission of depth map data through gRPC.
depth_map | A type alias for a 2D xtensor array |
Exception | if the depth map is not 2D |
|
inline |
Returns GeometryConfig
s associated with the calling camera.
GeometryConfig
s associated with the component.
|
pure virtual |
Returns GeometryConfig
s associated with the calling camera.
extra | Any additional arguments to the method. |
GeometryConfig
s associated with the component. Implemented in viam::sdk::impl::CameraClient, and viam::sdk::impl::CameraClient.
|
inline |
Get the next image from the camera as a raw image.
mime_type | the desired mime_type of the image (does not guarantee output type). |
raw_image
.
|
pure virtual |
Get the next image from the camera as a raw image.
mime_type | the desired mime_type of the image (does not guarantee output type). |
extra | any additional arguments to the method. |
raw_image
. Implemented in viam::sdk::impl::CameraClient, and viam::sdk::impl::CameraClient.
|
pure virtual |
Get the next images from the camera as a vector of raw images with names and metadata.
Implemented in viam::sdk::impl::CameraClient.
|
inline |
Get the next point_cloud
from the camera.
mime_type | the desired mime_type of the point_cloud (does not guarantee output type). |
point_cloud
.
|
pure virtual |
Get the next point_cloud
from the camera.
mime_type | the desired mime_type of the point_cloud (does not guarantee output type). |
extra | any additional arguments to the method. |
point_cloud
. Implemented in viam::sdk::impl::CameraClient, and viam::sdk::impl::CameraClient.
|
pure virtual |
Get the camera's properties.
Implemented in viam::sdk::impl::CameraClient.