2D + 3D Capture Strategy

Many detection algorithms commonly used in piece-picking applications rely on 2D data to identify which object to pick. This article explains the different ways to acquire that 2D data, their tradeoffs in data quality and cycle time, and how external lighting affects the result.

If you do not care about color information, skip ahead to selecting 3D and 2D settings based on capture speed.

2D 데이터를 얻는 방법에는 두 가지가 있습니다.

  1. camera.capture2D(Zivid::Settings).imageRGBA() 통해 2D 캡처를 별도로 수행합니다. 2D Image Capture Process 를 참조하세요.

  2. 3D 캡처의 일부인 camera.capture2D3D(Zivid::Settings).pointCloud().copyImageRGBA() 대한 자세한 내용은 Point Cloud Capture Process 를 참조하세요.

Which one to use depends on your requirements and the machine vision pipeline. We advocate for a dedicated 2D capture as it can use multi-threading and optimized scheduling. Utilizing 2D data from the 3D capture is simpler, but you may have to compromise speed to get desired 2D quality.

When you capture 2D separately, disable RGB in the 3D capture. This saves both on acquisition and processing time. Disable RGB in 3D capture by setting Sampling::Color to disabled.

Our recommendation:
  • 전체 해상도와 프로젝터를 켜서 2D를 별도로 캡처합니다.

  • 색상이 비활성화된 하위 샘플링된 3D 캡처.

카메라 해상도 및 1:1 매핑

For accurate 2D segmentation and detection, it is beneficial with a high-resolution color image. Zivid 3 has a 8 MPx imaging sensor, Zivid 2+ a 5 MPx sensor, while Zivid 2 has a 2.3 MPx sensor. The following table shows the resolution outputs of the different cameras for both 2D and 3D captures.

2D capture resolutions

2D capture

Zivid 3

Zivid 2+

Zivid 2

Full resolution

2816 x 2816

2448 x 2048

1944 x 1200

2x2 subsampled

1408 x 1408

1224 x 1024

972 x 600

4x4 subsampled

704 x 704

612 x 512

Not available

3D capture resolutions

3D capture

Zivid 3

Zivid 2+

Zivid 2

Full resolution

2816 x 2816

2448 x 2048

1944 x 1200

2x2 subsampled

1408 x 1420

1224 x 1024

972 x 600

4x4 subsampled

704 x 704

612 x 512

Not available

capture2D3D() 캡처를 수행하면 2D와 3D 데이터가 모두 포함된 프레임이 생성됩니다.

2D 데이터는 두 가지 방법으로 추출할 수 있습니다.

frame.frame2D().imageRGBA_SRGB()

이는 2D를 독립적으로 캡처한 것과 같습니다.

frame.pointCloud().copyImageRGBA_SRGB()

이렇게 하면 2D와 3D의 해상도가 달라야 하는 설정에서도 1:1 매핑이 보장됩니다.

Output resolution of 2D captures is controlled via the Settings2D::Sampling::Pixel setting and the output resolution of 3D captures via the combination of the Settings::Sampling::Pixel and the Settings::Processing::Resampling settings. See Pixel Sampling (2D), Pixel Sampling (3D) and Resampling.

For accurate 2D segmentation and detection, it is common to require high-resolution 2D data. For example, our recommended preset for Consumer Goods Z2+ MR130 Quality preset uses Settings::Sampling::Pixel set to by2x2. In this case, either:

  • 3D 데이터를 업샘플링하여 1대1 대응을 복원하거나

  • 2D 인덱스를 하위 샘플링된 3D 데이터의 인덱스에 매핑하거나

  • frame.pointCloud().copyImageRGBA_SRGB() 통해 포인트 클라우드에서 2D 데이터를 가져옵니다.

Resampling

To match the resolution of the 2D capture, apply an upsampling which undoes the subsampling. This retains the speed advantages of the subsampled capture. For example:

auto settings2D = Zivid::Settings2D{
    Zivid::Settings2D::Acquisitions{ Zivid::Settings2D::Acquisition{} },
    Zivid::Settings2D::Sampling::Pixel::all,
};
auto settings = Zivid::Settings{
    Zivid::Settings::Engine::stripe,
    Zivid::Settings::Acquisitions{ Zivid::Settings::Acquisition{} },
    Zivid::Settings::Sampling::Pixel::blueSubsample2x2,
    Zivid::Settings::Sampling::Color::disabled,
    Zivid::Settings::Processing::Resampling::Mode::upsample2x2,
};
settings_2d = zivid.Settings2D()
settings_2d.acquisitions.append(zivid.Settings2D.Acquisition())
settings_2d.sampling.pixel = zivid.Settings2D.Sampling.Pixel.all
settings = zivid.Settings()
settings.engine = "stripe"
settings.acquisitions.append(zivid.Settings.Acquisition())
settings.sampling.pixel = zivid.Settings.Sampling.Pixel.blueSubsample2x2
settings.sampling.color = zivid.Settings.Sampling.Color.disabled
settings.processing.resampling.mode = zivid.Settings.Processing.Resampling.Mode.upsample2x2

자세한 내용은 Resampling 을 참조하세요.

다른 옵션은 2D 인덱스를 서브샘플링된 3D 데이터의 인덱스에 매핑하는 것입니다. 이 옵션은 조금 더 복잡하지만, 잠재적으로 더 효율적입니다. 포인트 클라우드는 서브샘플링된 상태로 유지될 수 있으므로 메모리와 처리 능력을 덜 소모합니다.

전체 해상도 2D 데이터와 하위 샘플링된 포인트 클라우드 간의 상관관계를 확립하려면 특정 매핑 기법이 필요합니다. 이 과정은 베이어 그리드의 파란색 또는 빨간색 픽셀에 해당하는 픽셀에서 RGB 값을 추출하는 과정을 포함합니다.

Zivid::Experimental::Calibration::pixelMapping(camera, settings); 사용하면 이 매핑을 수행하는 데 필요한 매개변수를 얻을 수 있습니다. 다음은 이 함수를 사용하는 예입니다.

const auto pixelMapping = Zivid::Experimental::Calibration::pixelMapping(camera, settings);
std::cout << "Pixel mapping: " << pixelMapping << std::endl;
cv::Mat mappedBGR(
    fullResolutionBGR.rows / pixelMapping.rowStride(),
    fullResolutionBGR.cols / pixelMapping.colStride(),
    CV_8UC3);
std::cout << "Mapped width: " << mappedBGR.cols << ", height: " << mappedBGR.rows << std::endl;
for(size_t row = 0; row < static_cast<size_t>(fullResolutionBGR.rows - pixelMapping.rowOffset());
    row += pixelMapping.rowStride())
{
    for(size_t col = 0; col < static_cast<size_t>(fullResolutionBGR.cols - pixelMapping.colOffset());
        col += pixelMapping.colStride())
    {
        mappedBGR.at<cv::Vec3b>(row / pixelMapping.rowStride(), col / pixelMapping.colStride()) =
            fullResolutionBGR.at<cv::Vec3b>(row + pixelMapping.rowOffset(), col + pixelMapping.colOffset());
    }
}
return mappedBGR;
pixel_mapping = calibration.pixel_mapping(camera, settings)
return rgba[
    int(pixel_mapping.row_offset) :: pixel_mapping.row_stride,
    int(pixel_mapping.col_offset) :: pixel_mapping.col_stride,
    0:3,
]

참고

Intrinsics 함수를 사용하고 2D 및 3D 캡처의 해상도가 서로 다른 경우, 해당 함수를 올바르게 사용해야 합니다. 자세한 내용은 Camera Intrinsics 참조하세요.

External light considerations

2D 캡처에 이상적인 광원은 강하면서도 확산성이 있는 빛입니다. 강한 빛은 변화하는 주변광의 영향을 줄여주며, 확산광은 블루밍 현상 를 제한해 줍니다. Zivid 카메라에서는 내장 프로젝터가 이 광원 역할을 하므로, 로봇 셀에 별도의 조명이 필요하지 않습니다.

You can encounter blooming when using the internal projector as light source. Tilting the camera, changing the background, or tuning the 2D acquisition settings can mitigate the blooming effect.

Exposure variations caused by changes in ambient light, such as transitions from day to night, doors opening and closing, or changes in ceiling lighting, affects 2D and 3D data differently. For 2D data, they can impact segmentation performance, especially when it is trained on specific datasets. For 3D data, exposure variations may affect point cloud completeness due to varying noise levels. Zivid cameras are robust to such exposure variations.

아래 표는 2D 품질과 관련하여 Zivid 카메라를 사용하는 장단점을 요약한 것입니다.

Internal projector

Robot Cell setup

Simple

Resilience to ambient light variations

Strong

Blooming in 2D images

Likely

2D color balance needed

No

Capture strategies

먼저 어떤 데이터(2D 또는 3D)가 필요한지에 따라 세 가지 캡처 전략이 있습니다.

  • 2D data before 3D data

  • 2D data as part of 3D data

  • 2D data after 3D data

Which strategy fits best depends on your machine vision algorithms and pipeline. We recommend 2D data before 3D data (taking a 2D capture first, followed by a 3D capture with color disabled). This approach allows you to process the color image (e.g., segmentation) in parallel with capturing 3D data, thus achieving the best pick rates on the system level.

Below we summarize the performance of the different strategies. For a more in-depth understanding and ZividBenchmarks, please see 2D + 3D Capture Strategy.

다음은 다양한 하드웨어에 대한 실제 측정값을 보여주는 표입니다.

Zivid 3

(Z3 XL250 Fast)

Zivid 2+

(Z2+ LR110 Fast)

(Z2+ L110 Fast)

Zivid 2

(Z2 M70 Matte)

PC에서 다양한 2D-3D 전략을 테스트하려면 YML 파일에서 로드된 설정으로 ZividBenchmark.cpp 샘플을 실행할 수 있습니다. Samples 로 이동하고 튜토리얼을 보려면 C++를 선택합니다.

Next, see selecting 3D and 2D settings based on capture speed.

Version History

SDK

Changes

2.12.0

Zivid 2+의 경우 2D 캡처의 경우 최대 50%, 3D 캡처의 경우 최대 5%까지 획득 시간이 단축됩니다. Zivid One+는 지원이 종료되어 더 이상 지원되지 않습니다.

2.11.0

redSubsample4x4blueSubsample4x4 에 대한 지원이 추가되었습니다.