ColorsNear

ColorsNear[color]

represents a region around color.

ColorsNear[color,d]

represents a region with maximum distance d around color.

ColorsNear[color,d,dfun]

uses the specified color distance function dfun.

Details

  • ColorsNear can be used to represent a region around a specific color.
  • The distance function dfun can be any valid ColorDistance metric. Possible settings include:
  • "CIE76"Euclidean distance in LABColor
    "CIE94"color difference defined in LCHColor
    "CIE2000"CIE94 with some corrections (default)
    {"CMC",{l,c}}Color Measurement Committee metric with lightness l and chroma c
    "DeltaL"luminance difference in LCHColor
    "DeltaC"chroma difference in LCHColor
    "DeltaH"hue-based difference in LCHColor
    ffunction f that is given two lists of Lab values
  • With the "CMC" metric, commonly used parameters are for perceptibility and for acceptability. If not specified, is used.

Examples

open allclose all

Basic Examples  (3)

Represent a region around red:

Show the region around red, green and blue:

Detect image regions with colors near green:

Scope  (3)

A region around red:

Colors near red with distances smaller than 0.2:

Colors near red using a specific distance metric:

Applications  (3)

Detect regions of an image with colors near red:

Recolor regions with colors near red in an image:

Use color neighborhoods for chroma keying:

Remove the green screen by setting the alpha channel:

Properties & Relations  (2)

Using "CIE76" distance in Lab color space; every color neighborhood is a sphere:

The shape of the neighborhood varies for each color with other color distances:

Introduced in 2019
 (12.0)