ColorMapping

使用查找表将标签图像映射到8位RGB。

描述

使用不同的方法将标签图像映射到8位RGB图像(双向):

  • Custom :使用自定义查找表。查找表从文本文件加载,其中每行描述一个条目。这种方法的典型用法是给分类图上色。
  • Continuous :使用连续查找表将标量输入图像中的一系列值映射到彩色图像,以增强图像解释。可以选择具有不同颜色范围的几个查找表。
  • Optimal :计算最优查找表。当处理分割标签图像(标签到颜色)时,最大化相邻分割区域之间的色差。当处理未知彩色图像(要标记的颜色)时,所有当前颜色被映射到连续的标签列表。
  • Support image :使用颜色支持图像将平均颜色与每个区域相关联。

参数

Input Image -in image Mandatory
Input image filename

Output Image -out image [dtype] Mandatory
Output image filename

Operation -op [labeltocolor|colortolabel] Default value: labeltocolor
Selection of the operation to execute (default is: label to color).

  • Label to color
  • Color to label

颜色到标签选项

Not Found Label -op.colortolabel.notfound int Default value: 404
Label to use for unknown colors.


Color mapping method -method [custom|continuous|optimal|image] Default value: custom
Selection of color mapping methods and their parameters.

  • Color mapping with custom labeled look-up table
    Apply a user-defined look-up table to a labeled image. Look-up table is loaded from a text file.
  • Color mapping with continuous look-up table
    Apply a continuous look-up table to a range of input values.
  • Compute an optimized look-up table
    [label to color] Compute an optimal look-up table such that neighboring labels in a segmentation are mapped to highly contrasted colors. [color to label] Searching all the colors present in the image to compute a continuous label list
  • Color mapping with look-up table calculated on support image

使用自定义标签查找表选项的颜色映射

Look-up table file -method.custom.lut filename [dtype] Mandatory
An ASCII file containing the look-up table with one color per line (for instance the line '1 255 0 0' means that all pixels with label 1 will be replaced by RGB color 255 0 0) Lines beginning with a # are ignored

具有连续查找表选项的颜色映射

Look-up tables -method.continuous.lut [red|green|blue|grey|hot|cool|spring|summer|autumn|winter|copper|jet|hsv|overunder|relief] Default value: red
Available look-up tables.

  • Red
  • Green
  • Blue
  • Grey
  • Hot
  • Cool
  • Spring
  • Summer
  • Autumn
  • Winter
  • Copper
  • Jet
  • HSV
  • OverUnder
  • Relief

Mapping range lower value -method.continuous.min float Default value: 0
Set the lower input value of the mapping range.

Mapping range higher value -method.continuous.max float Default value: 255
Set the higher input value of the mapping range.

计算优化的查找表选项

Background label -method.optimal.background int Default value: 0
Value of the background label

具有根据支持图像选项计算的查找表的颜色映射

Support Image -method.image.in image Mandatory
Support image filename. For each label, the LUT is calculated from the mean pixel value in the support image, over the corresponding labeled areas. First of all, the support image is normalized with extrema rejection

NoData value -method.image.nodatavalue float Default value: 0
NoData value for each channel of the support image, which will not be handled in the LUT estimation. If NOT checked, ALL the pixel values of the support image will be handled in the LUT estimation.

lower quantile -method.image.low int Default value: 2
lower quantile for image normalization

upper quantile -method.image.up int Default value: 2
upper quantile for image normalization


Available RAM (MB) -ram int Default value: 256
Available memory for processing (in MB).

实例

从命令行执行以下操作:

otbcli_ColorMapping -in ROI_QB_MUL_1_SVN_CLASS_MULTI.png -method custom -method.custom.lut ROI_QB_MUL_1_SVN_CLASS_MULTI_PNG_ColorTable.txt -out Colorized_ROI_QB_MUL_1_SVN_CLASS_MULTI.tif

来自Python的评论:

import otbApplication

app = otbApplication.Registry.CreateApplication("ColorMapping")

app.SetParameterString("in", "ROI_QB_MUL_1_SVN_CLASS_MULTI.png")
app.SetParameterString("method","custom")
app.SetParameterString("method.custom.lut", "ROI_QB_MUL_1_SVN_CLASS_MULTI_PNG_ColorTable.txt")
app.SetParameterString("out", "Colorized_ROI_QB_MUL_1_SVN_CLASS_MULTI.tif")

app.ExecuteAndWriteOutput()

局限性

分割优化方法不支持流,因此不支持大图像。对于连续LUT和支持图像LUT方法,没有实现颜色到标签的操作。

使用支持图像的Colormap不是线程的。

另请参阅

ImageSVMClassifier