You're viewing an old version of the documentation. Click here to see the latest release.

Color Mode

Color Mode可以设置控制如何计算彩色图像,可设置为以下几种模式:

  • ToneMapping

  • UseFirstAcquisition

  • Automatic

ToneMapping(色调映射)使用了所有采集项来生成一个融合的和标准化过的彩色图像。对于HDR捕获,得到的图像动态范围通常高于8位彩色图像范围。色调映射将通过应用缩放因子将HDR颜色数据映射到8位颜色输出范围。色调映射也可用于单次采集捕获,以将捕获的彩色图像标准化为完整的8位输出。使用色调映射时,如果您移动、添加或移除了场景中的对象,重复捕获的颜色值可能会不一致。为了最大限度地控制颜色,请使用UseFirstAcquisition模式。

UseFirstAcquisition使用了第一个采集项获得的颜色数据。如果捕获包含多次采集,则其它采集获得的数据不会被用于生成彩色图像。该模式下不会执行色调映射。此模式将提供对彩色图像的最大控制,并且颜色值将在使用相同设置的重复捕获中保持一致。

Automatic是默认设置。在进行单次采集和所有采集项都具有相同(重复的)采集设置的多次采集时,Automatic模式会执行UseFirstAcquisition;在进行具有不同采集设置的多次采集HDR时,Automatic模式会执行ToneMapping。

备注

从SDK 2.7开始,可以通过将颜色模式设置为UseFirstAcquisition来禁用HDR捕获的色调映射。

对于单次采集捕获,色调映射可用于使暗图像变明亮。

色彩模式设置为UseFirstAcquisition或Automatic(无色调映射)的单次捕获

颜色模式设置为ToneMapping的单次捕获

Single capture with Color Mode set to UseFirstAcquisition or Automatic (no tone mapping)

Single capture with Color Mode set to ToneMapping

对于多次采集HDR,色调映射可用于将高动态范围颜色映射到更有限的动态范围输出。

Color Mode设置为UseFirstAcquisition或Automatic(无色调映射)的三个HDR采集中的第一个的单次捕获

Color Mode设置为UseFirstAcquisition或Automatic(无色调映射)的三个HDR采集中的第二个的单次捕获

Color Mode设置为UseFirstAcquisition或Automatic(无色调映射)的三个HDR采集中的第三个的单次捕获

Single capture of the first of three HDR acquisitions with Color Mode set to UseFirstAcquisition or Automatic (no tone mapping)

Single capture of the second of three HDR acquisitions with Color Mode set to UseFirstAcquisition or Automatic (no tone mapping)

Single capture of the third of three HDR acquisitions with Color Mode set to UseFirstAcquisition or Automatic (no tone mapping)

Color Mode设置为ToneMapping或Automatic的具有三个采集项的HDR

HDR with three acquisitions with Color Mode set to ToneMapping or Automatic

如果您不想对多次采集HDR使用色调映射,而是使用其中一个采集项的彩色图像,这是可以实现的。确定您要使用哪个采集项中的颜色。然后,确保该采集项是HDR采集设置序列中的第一个,并将Color Mode设置为UseFirstAcquisition。对于上面的示例,现在生成的彩色图像看起来就像使用三个HDR采集中的第一个采集项的单次捕获的彩色图像。

提示

在Zivid Studio的采集设置中依次点击 Move to top 即可将选定的采集项移动到序列中的第一个位置。

将采集移到顶部,使其成为序列中的第一个

如果要更改HDR捕获中获取彩色图像的采集项,只需重新排列采集设置即可。建议使用UseFirstAcquisition颜色模式以在重复捕获中保持颜色一致,这对诸如基于2D图像中的颜色或纹理的对象分类等应用非常有用。有关实现示例的详细说明,请查看 如何处理HDR中颜色不一致的问题

查看如何使用Zivid SDK设定processing settings(处理设置),包括Color Mode:

std::cout << "Configuring processing settings for capture:" << std::endl;
Zivid::Settings settings{
    Zivid::Settings::Experimental::Engine::phase,
    Zivid::Settings::Processing::Filters::Smoothing::Gaussian::Enabled::yes,
    Zivid::Settings::Processing::Filters::Smoothing::Gaussian::Sigma{ 1.5 },
    Zivid::Settings::Processing::Filters::Noise::Removal::Enabled::yes,
    Zivid::Settings::Processing::Filters::Noise::Removal::Threshold{ 7.0 },
    Zivid::Settings::Processing::Filters::Outlier::Removal::Enabled::yes,
    Zivid::Settings::Processing::Filters::Outlier::Removal::Threshold{ 5.0 },
    Zivid::Settings::Processing::Filters::Reflection::Removal::Enabled::yes,
    Zivid::Settings::Processing::Filters::Reflection::Removal::Experimental::Mode::global,
    Zivid::Settings::Processing::Filters::Experimental::ContrastDistortion::Correction::Enabled::yes,
    Zivid::Settings::Processing::Filters::Experimental::ContrastDistortion::Correction::Strength{ 0.4 },
    Zivid::Settings::Processing::Filters::Experimental::ContrastDistortion::Removal::Enabled::no,
    Zivid::Settings::Processing::Filters::Experimental::ContrastDistortion::Removal::Threshold{ 0.5 },
    Zivid::Settings::Processing::Color::Balance::Red{ 1.0 },
    Zivid::Settings::Processing::Color::Balance::Green{ 1.0 },
    Zivid::Settings::Processing::Color::Balance::Blue{ 1.0 },
    Zivid::Settings::Processing::Color::Gamma{ 1.0 },
    Zivid::Settings::Processing::Color::Experimental::Mode::automatic
};
std::cout << settings.processing() << std::endl;

版本历史

SDK

变更

2.3.0

添加了Tone mapping(色调映射)API。

2.7.0

Tone mapping(色调映射)API被Color Mode(颜色模式)API替代。