快速捕获教程

介绍

本教程介绍了使用Zivid SDK捕获点云的最基本方法。

如果您使用的是MATLAB,请查 看 Zivid Quick Capture Tutorial for MATLAB

先决条件

初始化

调用Zivid SDK中的任何API都需要初始化Zivid应用程序并在程序运行时使其保持活动状态。

跳转到源码

源码

Zivid::Application zivid;
跳转到源码

源码

var zivid = new Zivid.NET.Application();
跳转到源码

源码

app = zivid.Application()

连接

跳转到源码

源码

auto camera = zivid.connectCamera();
跳转到源码

源码

var camera = zivid.ConnectCamera();
跳转到源码

源码

camera = app.connect_camera()

配置

跳转到源码

源码

const auto suggestSettingsParameters = Zivid::CaptureAssistant::SuggestSettingsParameters{
    Zivid::CaptureAssistant::SuggestSettingsParameters::AmbientLightFrequency::none,
    Zivid::CaptureAssistant::SuggestSettingsParameters::MaxCaptureTime{ std::chrono::milliseconds{ 1200 } }
};

std::cout << "Running Capture Assistant with parameters:\n" << suggestSettingsParameters << std::endl;
auto settings = Zivid::CaptureAssistant::suggestSettings(camera, suggestSettingsParameters);
跳转到源码

源码

var suggestSettingsParameters = new Zivid.NET.CaptureAssistant.SuggestSettingsParameters
{
    AmbientLightFrequency =
        Zivid.NET.CaptureAssistant.SuggestSettingsParameters.AmbientLightFrequencyOption.none,
    MaxCaptureTime = Duration.FromMilliseconds(1200)
};

Console.WriteLine("Running Capture Assistant with parameters:\n{0}", suggestSettingsParameters);
var settings = Zivid.NET.CaptureAssistant.Assistant.SuggestSettings(camera, suggestSettingsParameters);
跳转到源码

源码

suggest_settings_parameters = zivid.capture_assistant.SuggestSettingsParameters(
    max_capture_time=datetime.timedelta(milliseconds=1200),
    ambient_light_frequency=zivid.capture_assistant.SuggestSettingsParameters.AmbientLightFrequency.none,
)

print(f"Running Capture Assistant with parameters: {suggest_settings_parameters}")
settings = zivid.capture_assistant.suggest_settings(camera, suggest_settings_parameters)

捕获

跳转到源码

源码

const auto frame = camera.capture(settings);
跳转到源码

源码

using (var frame = camera.Capture(settings))
跳转到源码

源码

with camera.capture(settings) as frame:

保存

跳转到源码

源码

const auto dataFile = "Frame.zdf";
frame.save(dataFile);
跳转到源码

源码

var dataFile = "Frame.zdf";
frame.Save(dataFile);
跳转到源码

源码

data_file = "Frame.zdf"
frame.save(data_file)

通过API选择要使用的格式。请查看 Point Cloud 获取支持格式的列表。

小技巧

您可以在 Zivid Studio 中打开并查看 Frame.zdf 文件 。

结论

本教程展示了使用Zivid SDK连接相机、捕获和保存图像的最基本的方法。

如需了解更深入的教程,请查看完整的 捕获教程