# ColorMapping

## Brief Description

Maps an input label image to 8-bits RGB using look-up tables.

## Tags

Utilities,Image Manipulation,Image MetaData,Learning

## Long Description

This application allows one to map a label image to a 8-bits RGB image (in both ways) using different methods. -The custom method allows one to use a custom look-up table. The look-up table is loaded from a text file where each line describes an entry. The typical use of this method is to colorise a classification map. -The continuous method allows mapping a range of values in a scalar input image to a colored image using continuous look-up table, in order to enhance image interpretation. Several look-up tables can been chosen with different color ranges. -The optimal method computes an optimal look-up table. When processing a segmentation label image (label to color), the color difference between adjacent segmented regions is maximized. When processing an unknown color image (color to label), all the present colors are mapped to a continuous label list. - The support image method uses a color support image to associate an average color to each region.

## Parameters

- [param] -in <string> Input image filename. Mandatory: True. Default Value: ""
- [param] -out <string> Output image filename. Mandatory: True. Default Value: ""
- [param] -ram <int32> Available memory for processing (in MB). Mandatory: False. Default Value: "128"
- [param] -inxml <string> Load otb application from xml file. Mandatory: False. Default Value: ""
- [param] -outxml <string> Save otb application to xml file. Mandatory: False. Default Value: ""
[choice] -op Selection of the operation to execute (default is : label to color). labeltocolor,colortolabel. Mandatory: True. Default Value: "labeltocolor"

- [group] -labeltocolor

- [group] -colortolabel

- [param] -op.colortolabel.notfound <int32> Label to use for unknown colors.. Mandatory: False. Default Value: "404"

[choice] -method Selection of color mapping methods and their parameters. custom,continuous,optimal,image. Mandatory: True. Default Value: "custom"

- [group] -custom

- [param] -method.custom.lut <string> 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. Mandatory: True. Default Value: ""

- [group] -continuous

- [param] -method.continuous.lut <string> Available look-up tables.. Mandatory: True. Default Value: "red"
- [param] -method.continuous.min <float> Set the lower input value of the mapping range.. Mandatory: True. Default Value: "0"
- [param] -method.continuous.max <float> Set the higher input value of the mapping range.. Mandatory: True. Default Value: "255"

- [group] -optimal

- [param] -method.optimal.background <int32> Value of the background label. Mandatory: True. Default Value: "0"

- [group] -image

- [param] -method.image.in <string> 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. Mandatory: True. Default Value: ""
- [param] -method.image.nodatavalue <float> 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.. Mandatory: False. Default Value: "0"
- [param] -method.image.low <int32> lower quantile for image normalization. Mandatory: False. Default Value: "2"
- [param] -method.image.up <int32> upper quantile for image normalization. Mandatory: False. Default Value: "2"

## Limitations

The segmentation optimal method does not support streaming, and thus large images. The operation color to label is not implemented for the methods continuous LUT and support image LUT. ColorMapping using support image is not threaded.

## Authors

OTB-Team

## See Also

ImageSVMClassifier

## Example of use

- 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