Color Balance Mosaic Dataset (Data Management)
Summary
Color balances a mosaic dataset so that the tiles appear seamless.
Usage
-
Color balancing can only take place if the following is true about your data:
- All the bands have their statistics calculated.
- All the bands have their histograms built.
- All the raster datasets have the same number of bands.
- All the raster datasets have the same pixel type and pixel depth. Only 8-bit unsigned and 16-bit unsigned bit depths are supported.
- None of the raster datasets have an associated color map.
-
The Pre-processing Options are performed before any color balancing takes place.
-
There are three balancing algorithms available: Dodging, Histogram, and Standard deviation.
-
The target color surface is only available if the dodging balancing technique is chosen. When using the dodging technique, each pixel needs a target color, which is picked up from the target color surface. There are five types of target color surfaces that you can choose from: single color, color grid, first order surface, second order surface, and third order surface.
-
Target Raster allows you to specify the target to balance your rasters.
- When dodging balancing is used—The target color that will be derived depends on the target color surface type that was chosen. For single color, the average value of the reference target image is used. For color grid, the reference target image is resampled to a suitable grid. For the polynomial order surfaces, the coefficients of the polynomial are obtained by least square fitting, from the reference target image.
- When histogram balancing is used—The target histogram is obtained from the reference target image.
- When standard deviation balancing is used—The target standard deviation is obtained from the reference target image.
To remove a color correction, right-click the mosaic dataset in ArcCatalog or the Catalog window and click Remove > Remove Color Correction.
Syntax
Parameter | Explanation | Data Type |
in_mosaic_dataset |
Type or navigate to the mosaic dataset that you want to color balance. | Mosaic Layer; Mosaic Dataset |
balancing_method (Optional) |
Choose the balancing algorithm to use.
| String |
color_surface_type (Optional) |
The Target Color Surface Type is only available if the dodging balancing technique is chosen. When using the dodging technique, each pixel needs a target color, which is determined by which surface type is chosen.
| String |
target_raster (Optional) |
The target raster image allows you to specify the target raster to balance your rasters. When dodging balancing is used, the target color that will be derived depends on the target color surface type that was chosen. For Single Color, the average value of the reference target image is used. For Color Grid, the reference target image is resampled to a suitable grid. For the polynomial order surfaces, the coefficients of the polynomial are obtained by the Least Squares Fitting from the reference target image. When Histogram Balancing is used, the target histogram is obtained from the reference target image. When Standard Deviation balancing is used, the target standard deviation is obtained from the reference target image. | Raster Layer |
gamma (Optional) |
Type the gamma value to use in the pre-processing stretch. This is only available if the Standard Deviation or Minimum-Maximum prestretch type is chosen. By applying the gamma stretch, you can control the overall brightness of an image. If the gamma coefficient is set too low, the middle tones appear too dark; however, if the gamma coefficient is set too high, the middle tones appear too light. Gamma changes not only the brightness but also the ratios of red to green to blue. | Double |
exclude_raster (Optional) |
Navigate to the raster you would like to use as an exclude layer. The Generate Exclude Area tool can be used to create the exclude area. The exclude area is taken into consideration before any color balancing takes place. | Raster Layer |
stretch_type (Optional) |
Prestretching can be performed on each raster catalog item before any other color correction takes place. This means that the original raster catalog item will be using its stretched pixel values, rather than its raw pixel values, in the color correction process. You may want to use this option to change the color to an expected distribution before applying color correction.
| String |
Code Sample
This is a Python sample for ColorBalanceMosaicDataset.
import arcpy ColorBalanceMosaicDataset_management("C:/workspace/fgdb.gdb/mosData","DODGING",\ "COLOR_GRID", "C:/workspace/target.tif",\ "C:/temp/excludeArea.tif","NONE","1", \ "BlockName")
This is a Python script sample for ColorBalanceMosaicDataset.
##=========================== ##Color Balance Mosaic Dataset ##Usage: ColorBalanceMosaicDataset_management(in_mosaic_dataset, {DODGING | ## HISTOGRAM | STANDARD_DEVIATION}, ## {SINGLE_COLOR | COLOR_GRID | ## FIRST_ORDER | SECOND_ORDER | THIRD_ORDER}, ## {target_raster}, {exclude_raster}, ## {NONE | STANDARD_DEVIATION | MINIMUM_MAXIMUM ## | ADAPTIVE}, {gamma}), {block_field} try: import arcpy arcpy.env.workspace = "c:/workspace" # Color Correction Mosaic Dataset with target layer arcpy.ColorBalanceMosaicDataset_management("CC.gdb/cc1", "DODGING", "SINGLE_COLOR", "Aerial_photo.lyr", "#", "NONE", "#", "BlockName") # Color Correction Mosaic Dataset with exclude area dataset and prestretch arcpy.ColorBalanceMosaicDataset_management("CC.gdb/cc2", "DODGING", "COLOR_GRID", "#", "excludearea.tif", "STANDARD_DEVIATION", "3", "BlockName") except: print "Color Balance Mosaic Dataset example failed." print arcpy.GetMessages()