Camera Component
The camera component provides an API for getting images or point clouds.
If you have a physical camera or software that generates 2D images or 3D point clouds, use a camera component.
You can use the camera component to configure a webcam, lidar, time-of-flight sensor, or another type of camera. You can also use camera models to manipulate the output of other cameras to transform, crop, or otherwise change the output.
Configuration
To use a camera with your machine, you need to add it to your machine’s configuration. Go to your machine’s CONFIGURE page, and add a model that supports your camera.
The following list shows the available camera models. The configuration of your camera component depends on your camera model. For additional configuration information, click on the model name:
Add support for other models
If none of the existing models fit your use case, you can create a modular resource to add support for it.
Model | Description |
---|---|
fake | A camera model for testing. |
esp32-camera | A camera on an ESP32. |
Add support for other models
If none of the existing models fit your use case, you can create a modular resource to add support for it.
viam-micro-server
works differently from the RDK, so creating modular resources for it is different.
Refer to the Micro-RDK Module Template on GitHub for information on how to create custom resources for your viam-micro-server
machine.
You will need to recompile and flash your ESP32 yourself instead of using Viam’s prebuilt binary and installer.
API
The camera API supports the following methods:
Method Name | Description |
---|---|
GetImage | Return an image from the camera. |
GetImages | Get simultaneous images from different imagers, along with associated metadata. |
GetPointCloud | Get a point cloud from the camera as bytes with a MIME type describing the structure of the data. |
GetProperties | Get the camera intrinsic parameters and camera distortion, as well as whether the camera supports returning point clouds. |
DoCommand | Execute model-specific commands that are not otherwise defined by the component API. |
GetGeometries | Get all the geometries associated with the camera in its current configuration, in the frame of the camera. |
GetResourceName | Get the ResourceName for this camera with the given name. |
Close | Safely shut down the resource and prevent further use. |
Troubleshooting
If your camera is not working as expected, follow these steps:
Check your machine logs on the LOGS tab to check for errors.
Review your camera model’s documentation to ensure you have configured all required attributes.
Click on the TEST panel on the CONFIGURE or CONTROL tab and test if you can use the camera there.
If none of these steps work, reach out to us on the Community Discord and we will be happy to help.
Common errors
Next steps
For general configuration, development, and usage info, see:
You can also use the camera component with the following services:
- Data management service: To capture and sync the camera’s data
- Vision service: To use computer vision to interpret the camera stream
- SLAM service: for mapping
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!