ColorNegate

ColorNegate[color]

gives the negative of a color.

ColorNegate[image]

gives the negative of image, in which all colors have been negated.

ColorNegate[video]

negates every frame of a video.

ColorNegate[{expr1,}]

gives a list of negative images or colors.

Details

  • ColorNegate, also known as color inversion, replaces every pixel in the image with the negative of that pixel.
  • ColorNegate maps every color v to 1-ν.
  • For images with defined color spaces, negation happens in the RGBColor space. »
  • ColorNegate works with colors as well as 2D and 3D images. The color space and data type of the input are preserved.

Examples

open allclose all

Basic Examples  (2)

Negative of the color red:

Color negate an image:

Scope  (7)

Negative of an Lab color:

Negative of the color Yellow:

Invert a binary image:

Negative of a black-and-white photo:

Negation of a color image:

Negate video frames:

Negative of a grayscale 3D image:

Negation of a 3D color volume:

Applications  (5)

Invert a color negative:

Create an image effect by only negating the luminance channel of an urban night skyline:

Create false colorizations of an image by negating only one of the three RGB channels:

DeleteSmallComponents deletes small white components:

Make it delete small black components instead:

Negate a region of interest to create an alpha channel. Detect the region of interest:

Negate the region and set it as the alpha channel:

Properties & Relations  (7)

Color negation of gray results in gray:

Color negation happens in the RGBColor space:

Color negation results in the same color regardless of representation:

Color negation is equivalent to subtracting the image from 1:

Histogram of the negated image is a mirror of the original image:

ColorNegate of an RGB image is equivalent to mapping every pixel v to 1-v:

This does not hold true for other color spaces:

Negate only the lightness while preserving color components in the LCH color space:

Negate by applying a 180° hue rotation while preserving chroma and lightness:

Perform both lightness negation and hue rotation:

Compare with color negation in RGB:

Wolfram Research (2008), ColorNegate, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorNegate.html (updated 2021).

Text

Wolfram Research (2008), ColorNegate, Wolfram Language function, https://reference.wolfram.com/language/ref/ColorNegate.html (updated 2021).

CMS

Wolfram Language. 2008. "ColorNegate." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ColorNegate.html.

APA

Wolfram Language. (2008). ColorNegate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ColorNegate.html

BibTeX

@misc{reference.wolfram_2024_colornegate, author="Wolfram Research", title="{ColorNegate}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ColorNegate.html}", note=[Accessed: 09-October-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_colornegate, organization={Wolfram Research}, title={ColorNegate}, year={2021}, url={https://reference.wolfram.com/language/ref/ColorNegate.html}, note=[Accessed: 09-October-2024 ]}