returns dominant colors in image.

returns at most n dominant colors in image.

returns the specified property prop for the regions that belong to the same dominant color.

returns the output in the specified format.

returns dominant colors in each imagei.

Details and OptionsDetails and Options

  • DominantColors[image] returns a list of colors that represent clusters of colors that appear in the image. The colors are represented by GrayLevel or RGBColor.
  • DominantColors works with arbitrary 2D and 3D images.
  • The returned colors are ordered based on the size of the clusters they represent.
  • DominantColors uses the LABColor to find color clusters.
  • The following properties can be used to return dominant colors in different forms:
  • "Color"color for each cluster given in RGB or grayscale (default)
    "HexRGBColor"RGB color in the hexadecimal form
    "LABColor"Lab color
    "NearestHTMLColor"name of the nearest HTML color
  • Other supported properties include:
  • "Count"total number of pixels covered by each cluster
    "Coverage"fraction of the whole image covered by each cluster
    "CoverageImage"image representing the region covered by each cluster
    "MaskCoverage"fraction of the specified mask covered by each cluster
  • DominantColors[image,n,{"prop1","prop2",}] computes multiple properties.
  • DominantColors[image,n,"Properties"] returns a list of supported properties.
  • The format argument specifies the output format. Possible settings are:
  • Automaticdetermine the output automatically
    "ColorAssociation"an association of coli{,valj,}
    "ColorPropertyAssociation"an association of coli<|,propjvalj,|>
    "Dataset"a Dataset of cluster properties
    "List"a nested list
    "PropertyAssociation"an association of propj{,vali,}
  • DominantColors accepts the following options:
  • ColorCoverageAutomaticfraction of the image covered
    DistanceFunctionAutomaticany distance supported in ColorDistance
    MaskingAllregion of interest
    MinColorDistanceAutomaticminimum color distance
  • With MinColorDistance->d, clusters represented by colors c1 and c2 are merged if ColorDistance[c1,c2]<d. The color with the larger coverage is assigned to the new cluster.
  • With ColorCoverage->f, colors that cover less than a fraction f of the image are returned. With ColorCoverage->{fmin,fmax} a range of coverage fractions can be specified.
  • With Masking->roi, "CoverageImage" and "MaskCoverage" return properties with respect to the specified region of interest roi.  »
Introduced in 2012
| Updated in 2016