2D Image Capture Process

획득이 완료되면 2D 캡처 API가 반환됩니다.

소스로 이동

source

const auto frame2D = camera.capture2D(settings);
소스로 이동

소스

using (var frame2D = camera.Capture2D(settings))
소스로 이동

소스

frame_2d = camera.capture_2d(settings)

Frame2D 객체에서 이미지를 가져오는 메서드는 CPU 메모리에서 2D 이미지를 사용할 수 있게 된 후에 반환됩니다. 이 함수 호출은 처리 및 복사가 완료될 때까지 차단됩니다. 이미지 개체는 CPU 메모리의 이미지 데이터에 대한 핸들을 보유합니다.

팁

recommended hardware 를 사용해서 2D 이미지 처리 시간을 최소화하십시오.

소스로 이동

source

const auto imageSRGB = frame2D.imageRGBA_SRGB();
소스로 이동

소스

var imageSRGB = frame2D.ImageRGBA_SRGB();
소스로 이동

소스

image_srgb = frame_2d.image_rgba_srgb()

Linear RGB( BGRA 및 RGBA ) 및 sRGB( SRGB )와 같이 다양한 색상 공간에서 이미지를 얻을 수 있습니다. 자세한 내용은 2D Color Spaces, Lens Distortion, and Output Formats 을 참조하세요.

참고

C++ 및 C#에서 클래스 Image 는 Array2D 에서 상속받고, 추가로 PNG 파일 형식으로 이미지를 저장하는 메서드를 제공합니다.

CPU 메모리에서 이미지를 사용할 수 있으면 머신 비전 애플리케이션에서 활용하거나 디스크에 저장할 수 있습니다.

소스로 이동

source

const auto imageFile = "ImageRGBA_sRGB.png";
std::cout << "Saving 2D color image (sRGB color space) to file: " << imageFile << std::endl;
imageSRGB.save(imageFile);
소스로 이동

소스

var imageFile = "ImageRGBA_sRGB.png";
Console.WriteLine($"Saving 2D color image (sRGB color space) to file: {imageFile}");
imageSRGB.Save(imageFile);
소스로 이동

소스

image_file = "ImageRGBA_sRGB.png"
print(f"Saving 2D color image (sRGB color space) to file: {image_file}")
image_srgb.save(image_file)

팁

타이밍을 최적화하려면 2D 캡처 API가 반환된 후 장면에서 로봇을 이동하거나 개체를 이동하십시오. 이는 Frame2D 개체에서 이미지를 가져오기 위해 API를 호출하기 전 또는 동시에 발생해야 합니다.

2D 프레임은 .zdf 파일로 저장한 후 나중에 다시 메모리로 불러올 수 있습니다. 이는 주로 diagnostics 가 활성화되어 있을 때, 더 철저한 문제 해결을 위해 원시 프레임 데이터를 Zivid 지원팀과 공유하는 데 유용합니다.

소스로 이동

source

const auto dataFile2D = "Frame2D.zdf";
std::cout << "Saving 2D frame to file: " << dataFile2D << std::endl;
frame2D.save(dataFile2D);
소스로 이동

소스

var dataFile2D = "Frame2D.zdf";
Console.WriteLine("Saving 2D frame to file: " + dataFile2D);
frame2D.Save(dataFile2D);
소스로 이동

소스

data_file_2d = "Frame2D.zdf"
print(f"Saving 2D frame to file: {data_file_2d}")
frame_2d.save(data_file_2d)

저장된 파일은 파일 경로를 인수로 받는 Frame2D 생성자를 사용해서 불러올 수 있습니다.

소스로 이동

source

std::cout << "Loading 2D frame from file: " << dataFile2D << std::endl;
const auto loadedFrame2D = Zivid::Frame2D{ dataFile2D };
소스로 이동

소스

Console.WriteLine("Loading 2D frame from file: " + dataFile2D);
using (var loadedFrame2D = new Zivid.NET.Frame2D(dataFile2D))
소스로 이동

소스

print(f"Loading 2D frame from file: {data_file_2d}")
loaded_frame_2d = zivid.Frame2D(data_file_2d)

readFrameFileType returns whether a .zdf file contains a 3D Frame or a Frame2D. This is useful when a file path is given as input and the type is not known in advance.

소스로 이동

소스

const auto frameFileType2D = Zivid::readFrameFileType(dataFile2D);
std::cout << "Frame file type: " << (frameFileType2D == Zivid::FrameFileType::frame2D ? "Frame2D" : "Frame")
          << std::endl;
소스로 이동

소스

var frameFileType2D = Zivid.NET.FrameFile.ReadFrameFileType(dataFile2D);
Console.WriteLine("Frame file type: " + frameFileType2D);
소스로 이동

소스

frame_file_type_2d = zivid.read_frame_file_type(data_file_2d)
print(f"Frame file type: {frame_file_type_2d}")

Version History

SDK

Changes

2.18.0

Added support for saving and loading Frame2D to and from .zdf files, and readFrameFileType to identify the frame type in a file.

2.12.0

Zivid 2+에서는 2D 수집 시간이 최대 50%까지 단축됩니다.

2.11.0

SRGB 색 공간에 대한 지원이 추가되었습니다.

2.9.0

수집이 완료되면 캡처 기능이 반환되고 캡처 속도가 향상됩니다.

2.8.0

Zivid 2의 캡처 속도가 향상되었습니다.