Color Mode

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

  • ToneMapping

  • UseFirstAcquisition

  • Automatic

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

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

  • Automatic 是默认设置。

  • 在进行单次采集和所有采集项都具有相同(重复的)采集设置的多次采集时, Automatic 等同于 UseFirstAcquisition

  • 在进行具有不同采集设置的多次采集HDR时, Automatic 等同于 ToneMapping

备注

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

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

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

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

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

Single capture with Color Mode set to ToneMapping

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

颜色模式设置为 :code:`UseFirstAcquisition` 或 :code:`Automatic` (无色调映射)的三个HDR采集中的第一个的单次捕获

颜色模式设置为 :code:`UseFirstAcquisition` 或 :code:`Automatic` (无色调映射)的三个HDR采集中的第二个的单次捕获

颜色模式设置为 :code:`UseFirstAcquisition` 或 :code:`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)

颜色模式设置为 :code:`ToneMapping` 或 :code:`Automatic` 的具有三个采集项的HDR

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

使用UseFirstAcquisition的HDR捕获

如果您不想对多次采集HDR使用色调映射,而是使用其中一个采集项的彩色图像,这是可以实现的。确定您要使用哪个采集项中的颜色。然后,确保该采集项是HDR采集设置序列中的第一个,并将颜色模式设置为 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;
跳转到源

源码

Console.WriteLine("Configuring processing settings for capture:");
var settings = new Zivid.NET.Settings() {
    Experimental = { Engine = Zivid.NET.Settings.ExperimentalGroup.EngineOption.Phase },
    Processing = { Filters = { Smoothing = { Gaussian = { Enabled = true, Sigma = 1.5 } },
                               Noise = { Removal = { Enabled = true, Threshold = 7.0 } },
                               Outlier = { Removal = { Enabled = true, Threshold = 5.0 } },
                               Reflection = { Removal = { Enabled = true, Experimental = { Mode = ReflectionFilterModeOption.Global} } },
                               Experimental = { ContrastDistortion = { Correction = { Enabled = true,
                                                                                      Strength = 0.4 },
                                                                       Removal = { Enabled = true,
                                                                                   Threshold = 0.5 } } } },
                   Color = { Balance = { Red = 1.0, Green = 1.0, Blue = 1.0 },
                             Gamma = 1.0,
                             Experimental = { Mode = ColorModeOption.Automatic } } }
};
Console.WriteLine(settings.Processing);
跳转到源

source

print("Configuring processing settings for capture:")
settings = zivid.Settings()
settings.experimental.engine = "phase"
filters = settings.processing.filters
filters.smoothing.gaussian.enabled = True
filters.smoothing.gaussian.sigma = 1.5
filters.noise.removal.enabled = True
filters.noise.removal.threshold = 7.0
filters.outlier.removal.enabled = True
filters.outlier.removal.threshold = 5.0
filters.reflection.removal.enabled = True
filters.reflection.removal.experimental.mode = "global"
filters.experimental.contrast_distortion.correction.enabled = True
filters.experimental.contrast_distortion.correction.strength = 0.4
filters.experimental.contrast_distortion.removal.enabled = False
filters.experimental.contrast_distortion.removal.threshold = 0.5
color = settings.processing.color
color.balance.red = 1.0
color.balance.blue = 1.0
color.balance.green = 1.0
color.gamma = 1.0
settings.processing.color.experimental.mode = "automatic"
print(settings.processing)

版本历史

SDK

变更

2.7.0

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

2.3.0

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