Skip to content

Split 2D+3D capture - #149

Open
torbsorb wants to merge 1 commit into
ros1-sdk-2.15.0-backport-estimated-intrinsicsfrom
ros1-sdk-2.15.0-split-capture2d-3d
Open

Split 2D+3D capture#149
torbsorb wants to merge 1 commit into
ros1-sdk-2.15.0-backport-estimated-intrinsicsfrom
ros1-sdk-2.15.0-split-capture2d-3d

Conversation

@torbsorb

@torbsorb torbsorb commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

Zivid SDK will capture both 2D and 3D if Zivid::Settings contain Zivid::Settings::color. However, it will not return from the capture until both 2D and 3D has been acquired. In order to get 2D data as fast as possible we split the capture into two separate calls. This allows us to publish the 2D color image as soon as it is ready.

This has no impact on the subscriber, other than in which order the topics arrive.

Before: acquisition_done -> color/image_color -> points/xyz
After: color/image_color -> acquisition_done -> points/xyz

The order of color/image_color and acquisition_done depends on the 3D acquisition settings and the processing speed of 2D color.

Note! Previously the resolution of the 2D image, when published as part of the 3D capture service, was tied to the 3D point cloud. That also applied to intrinsics. Now it will only reflect the 2D settings. In other words, in order to have 1-to-1 mapping between the 2D color image and the point cloud one must set the same Zivid::Settings::Sampling in both. In other words:

Settings:
    Color:
        __version__: 7
        Settings2D:
            Sampling:
                Color: rgb
                Pixel: all

must equal

Settings:
    Sampling:
        Color: rgb
        Pixel: all

in order to have the same resolution on both.

This also means that there is no path to publish the point cloud
resolution mapped color image, which was previously published
even when Zivid::Settings2D::Sampling != Zivid::Settings::Sampling

In this commit we also cache the intrinsics in order to unblock
publishing 2D color image. This is because calculating intrinsics
requires the camera.

Zivid SDK will capture both 2D and 3D if `Zivid::Settings`
contain `Zivid::Settings::color`. However, it will not return
from the capture until both 2D and 3D has been acquired.
In order to get 2D data as fast as possible we split the capture
into two separate calls. This allows us to publish the 2D color
image as soon as it is ready.

This has no impact on the subscriber, other than in which order the
topics arrive.

Before: `acquisition_done` -> `color/image_color` -> `points/xyz`
After: `color/image_color` -> `acquisition_done` -> `points/xyz`

The order of `color/image_color` and `acquisition_done` depends on
the 3D acquisition settings and the processing speed of 2D color.

Note! Previously the resolution of the 2D image, when published
as part of the 3D capture service, was tied to the 3D point cloud.
That also applied to intrinsics. Now it will only reflect the 2D
settings. In other words, in order to have 1-to-1 mapping between
the 2D color image and the point cloud one must set the same
Zivid::Settings::Sampling in both. In other words:

```yml
Settings:
    Color:
        __version__: 7
        Settings2D:
            Sampling:
                Color: rgb
                Pixel: all
 ```
must equal

```yml
Settings:
    Sampling:
        Color: rgb
        Pixel: all
```
in order to have the same resolution on both.

This also means that there is no path to publish the point cloud
resolution mapped color image, which was previously published
even when `Zivid::Settings2D::Sampling` != `Zivid::Settings::Sampling`

In this commit we also cache the intrinsics in order to unblock
publishing 2D color image. This is because calculating intrinsics
requires the camera.
Comment thread zivid_camera/src/node.cpp
Comment on lines +40 to +44
// ros::spin();
ros::AsyncSpinner spinner(3); // Use 2 threads or more, depends on workload
spinner.start();

ros::waitForShutdown();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants