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 acquisition capture with Color Mode set to UseFirstAcquisition or Automatic (no tone mapping)

Single acquisition capture with Color Mode set to ToneMapping

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

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

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

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

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

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

Single acquisition 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:

跳转到源码

source

std::cout << "Configuring settings for capture:" << std::endl;
Zivid::Settings settings{
    Zivid::Settings::Experimental::Engine::phase,
    Zivid::Settings::Sampling::Color::rgb,
    Zivid::Settings::Sampling::Pixel::all,
    Zivid::Settings::RegionOfInterest::Box::Enabled::yes,
    Zivid::Settings::RegionOfInterest::Box::PointO{ 1000, 1000, 1000 },
    Zivid::Settings::RegionOfInterest::Box::PointA{ 1000, -1000, 1000 },
    Zivid::Settings::RegionOfInterest::Box::PointB{ -1000, 1000, 1000 },
    Zivid::Settings::RegionOfInterest::Box::Extents{ -1000, 1000 },
    Zivid::Settings::RegionOfInterest::Depth::Enabled::yes,
    Zivid::Settings::RegionOfInterest::Depth::Range{ 200, 2000 },
    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::Noise::Suppression::Enabled::yes,
    Zivid::Settings::Processing::Filters::Noise::Repair::Enabled::yes,
    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::Cluster::Removal::Enabled::yes,
    Zivid::Settings::Processing::Filters::Cluster::Removal::MaxNeighborDistance{ 10 },
    Zivid::Settings::Processing::Filters::Cluster::Removal::MinArea{ 100 },
    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::Filters::Experimental::HoleFilling::Enabled::yes,
    Zivid::Settings::Processing::Filters::Experimental::HoleFilling::HoleSize{ 0.2 },
    Zivid::Settings::Processing::Filters::Experimental::HoleFilling::Strictness{ 1 },
    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 << std::endl;
跳转到源码

source

Console.WriteLine("Configuring settings for capture:");
var settings = new Zivid.NET.Settings()
{
    Experimental = { Engine = Zivid.NET.Settings.ExperimentalGroup.EngineOption.Phase },
    Sampling = { Color = Zivid.NET.Settings.SamplingGroup.ColorOption.Rgb, Pixel = Zivid.NET.Settings.SamplingGroup.PixelOption.All },
    RegionOfInterest = { Box = {
                            Enabled = true,
                            PointO = new Zivid.NET.PointXYZ{ x = 1000, y = 1000, z = 1000 },
                            PointA = new Zivid.NET.PointXYZ{ x = 1000, y = -1000, z = 1000 },
                            PointB = new Zivid.NET.PointXYZ{ x = -1000, y = 1000, z = 1000 },
                            Extents = new Zivid.NET.Range<double>(-1000, 1000),
                        },
                        Depth =
                        {
                            Enabled = true,
                            Range = new Zivid.NET.Range<double>(200, 2000),
                        }
    },
    Processing = { Filters = { Smoothing = { Gaussian = { Enabled = true, Sigma = 1.5 } },
                               Noise = { Removal = { Enabled = true, Threshold = 7.0 },
                                         Suppression = { Enabled = true },
                                         Repair ={ Enabled = true } },
                               Outlier = { Removal = { Enabled = true, Threshold = 5.0 } },
                               Reflection = { Removal = { Enabled = true, Experimental = { Mode = ReflectionFilterModeOption.Global} } },
                               Cluster = { Removal = { Enabled = true, MaxNeighborDistance = 10, MinArea = 100} },
                               Experimental = { ContrastDistortion = { Correction = { Enabled = true,
                                                                                      Strength = 0.4 },
                                                                       Removal = { Enabled = true,
                                                                                   Threshold = 0.5 } },
                                                HoleFilling = { Enabled = true,
                                                                HoleSize = 0.2,
                                                                Strictness = 1 } } },
                   Color = { Balance = { Red = 1.0, Green = 1.0, Blue = 1.0 },
                             Gamma = 1.0,
                             Experimental = { Mode = ColorModeOption.Automatic } } }
};
Console.WriteLine(settings);
跳转到源码

source

print("Configuring settings for capture:")
settings = zivid.Settings()
settings.experimental.engine = "phase"
settings.sampling.color = "rgb"
settings.sampling.pixel = "all"
settings.region_of_interest.box.enabled = True
settings.region_of_interest.box.point_o = [1000, 1000, 1000]
settings.region_of_interest.box.point_a = [1000, -1000, 1000]
settings.region_of_interest.box.point_b = [-1000, 1000, 1000]
settings.region_of_interest.box.extents = [-1000, 1000]
settings.region_of_interest.depth.enabled = True
settings.region_of_interest.depth.range = [200, 2000]
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.noise.suppression.enabled = True
filters.noise.repair.enabled = True
filters.outlier.removal.enabled = True
filters.outlier.removal.threshold = 5.0
filters.reflection.removal.enabled = True
filters.reflection.removal.experimental.mode = "global"
filters.cluster.removal.enabled = True
filters.cluster.removal.max_neighbor_distance = 10
filters.cluster.removal.min_area = 100
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
filters.experimental.hole_filling.enabled = True
filters.experimental.hole_filling.hole_size = 0.2
filters.experimental.hole_filling.strictness = 1
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)

版本历史

SDK

变更

2.7.0

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

2.3.0

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