Metadata-Version: 2.4
Name: airo_camera_toolkit
Version: 2026.11.0
Summary: Interfaces and common functionality to work with RGB(D) cameras for robotic manipulation at the Ghent University AI and Robotics Lab
Author: Thomas Lips
Author-email: thomas.lips@ugent.be
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: numpy>=2.0
Requires-Dist: opencv-contrib-python==4.10.0.84
Requires-Dist: matplotlib
Requires-Dist: rerun-sdk>=0.23.4
Requires-Dist: click
Requires-Dist: open3d
Requires-Dist: loguru
Requires-Dist: airo-ipc>=0.1.0
Requires-Dist: airo-typing>=2026.1.0
Requires-Dist: airo-spatial-algebra>=2026.1.0
Requires-Dist: airo-dataset-tools>=2026.1.0
Provides-Extra: hand-eye-calibration
Requires-Dist: airo-robots; extra == "hand-eye-calibration"
Provides-Extra: luxonis
Requires-Dist: depthai>=3.0; extra == "luxonis"
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# airo-camera-toolkit
This package contains code for working with RGB(D) cameras, images and point clouds.


Overview of the functionality and the structure:
```cs
airo-camera-toolkit/
├── calibration/                # hand-eye extrinsics calibration
├── cameras/                    # actual camera drivers
├── image_transformations/      # reversible geometric 2D transforms
├── pinhole_operations/         # 2D-3D operations
├── point_clouds/               # conversions and operations
├── utils/                      # a.o. annotation tool and converter
├── interfaces.py
└── cli.py
```

## Installation
The `airo_camera_toolkit` package can be installed with pip by running (from this directory):
```
pip install .
```
This will already allow you to use the hardare-independent functionality of this package, e.g. image conversion and projection.
Depending on the hardware you are using, you might need to complete additional installation.
Instructions can be found in the following files:
* [ZED Installation](https://github.com/airo-ugent/airo-mono/blob/main/airo-camera-toolkit/airo_camera_toolkit/cameras/zed/installation.md)
* [RealSense Installation](https://github.com/airo-ugent/airo-mono/blob/main/airo-camera-toolkit/airo_camera_toolkit/cameras/realsense/realsense_installation.md)
* [Luxonis Installation](https://github.com/airo-ugent/airo-mono/blob/main/airo-camera-toolkit/airo_camera_toolkit/cameras/luxonis/luxonis_installation.md)

Additionally, to ensure you have `airo-robots` installed for the hand-eye calibration, install the extra dependencies:
```
pip install .[hand-eye-calibration]
```

## Getting started with cameras
Camera can be accessed by instantiating the corresponding class:, e.g. for a ZED camera:
```python
from airo_camera_toolkit.cameras.zed import Zed
from airo_camera_toolkit.utils import ImageConverter
import cv2

camera = Zed(Zed.RESOLUTION_720, fps=30)

while True:
    camera.grab_images()
    image_rgb_float = camera.retrieve_rgb_image()
    image_bgr = ImageConverter.from_numpy_format(image_rgb_float).image_in_opencv_format
    cv2.imshow("Image", image_bgr)
    key = cv2.waitKey(10)
    if key == ord('q'):
        break
```

Capture and retrieval are explicit and decoupled: call `grab_images()` once to capture
a frame, then any number of `retrieve_*` calls to read individual fields (RGB, depth,
point cloud, ...) from that *same* frame. This is the supported way to get synchronized
multi-modal data, e.g. an RGB image and depth map taken at the same instant:
```python
camera.grab_images()  # Gets a new frame from the hardware at timestamp T.
rgb = camera.retrieve_rgb_image_as_int()  # Read the frame from timestamp T.
depth = camera.retrieve_depth_map()  # Read the frame from timestamp T.
```

## Hand-eye calibration

Find the pose of a camera relative to a robot. In the [`calibration`](https://github.com/airo-ugent/airo-mono/tree/main/airo-camera-toolkit/airo_camera_toolkit/calibration) folder, run this to get started:

```shell
airo-camera-toolkit hand-eye-calibration --help
```

See [calibration/README.md](https://github.com/airo-ugent/airo-mono/blob/main/airo-camera-toolkit/airo_camera_toolkit/calibration/README.md) for more details.



## Utils

### Image format conversion
Camera by default return images as numpy 32-bit float RGB images with values between 0 to 1 through `retrieve_rgb_image()`.
This is most convenient for subsequent processing, e.g. with neural networks.
For higher performance, 8-bit unsigned integer RGB images are also accessible through `retrieve_rgb_image_as_int()`.

However, when using OpenCV, you will need conversion to BGR format.
For this you can use the `ImageConverter` class:
```python
from airo_camera_toolkit.utils import ImageConverter

camera.grab_images()
image_rgb_int = camera.retrieve_rgb_image_as_int()
image_bgr = ImageConverter.from_numpy_int_format(image_rgb_int).image_in_opencv_format
```


### Annotation tool

See [annotation_tool.md](https://github.com/airo-ugent/airo-mono/blob/main/airo-camera-toolkit/airo_camera_toolkit/utils/annotation_tool.md) for usage instructions.


## Pinhole Operations

2D - 3D geometric operations using the pinhole model. See [readme](https://github.com/airo-ugent/airo-mono/blob/main/airo-camera-toolkit/airo_camera_toolkit/pinhole_operations/Readme.md) for more information.


## Image Transforms

See the [README](https://github.com/airo-ugent/airo-mono/blob/main/airo-camera-toolkit/airo_camera_toolkit/image_transforms/README.md) in the `image_transforms` folder for more details.

## Real-time visualisation
For realtime visualisation of robotics data we  strongly encourage using [rerun.io](https://www.rerun.io/) instead of manually hacking something together with opencv/pyqt/... No wrappers are needed here, just pip install the SDK. An example notebook to get to know this tool and its potential can be found [here](https://github.com/airo-ugent/airo-mono/blob/main/airo-camera-toolkit/notebooks/rerun_tutorial.ipynb).
See this [README](https://github.com/airo-ugent/airo-mono/blob/main/airo-camera-toolkit/docs/rerun.md) for more details.

## Point clouds
See the tutorial notebook [here](https://github.com/airo-ugent/airo-mono/blob/main/airo-camera-toolkit/notebooks/point_cloud_tutorial.ipynb) for an introduction.

## Multiprocessing
Camera processing can be computationally expensive.
If this is a problem for your application, see [multiprocess/README.md](https://github.com/airo-ugent/airo-mono/blob/main/airo-camera-toolkit/airo_camera_toolkit/cameras/multiprocess/README.md).

## References
For more background on cameras, in particular on the meaning of intrinsics, extrinics, distortion coefficients, pinhole (and other) camera models, see:
- Szeliski - Computer vision: Algorithms and Applications, available [here](https://szeliski.org/Book/)
 - https://web.eecs.umich.edu/~justincj/teaching/eecs442/WI2021/schedule.html
 - https://learnopencv.com/geometry-of-image-formation/ (extrinsics & intrinsics)
 - http://www.cs.cmu.edu/~16385/s17/Slides/11.1_Camera_matrix.pdf (idem)
