OriginLab Corporation - Scientific Graphing and Data Analysis Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis

imgInvert

Contents

Menu Information

Invert

Brief Information

Invert image color

Command Line Usage

1. imgInvert oimg:=<new>;

2. imgInvert img:=mat(1) oimg:=mat(2);

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input Matrix img

Input

Image

<active>

Specifies the source image to be manipulated. The default input is the active image.

Output Image oimg

Output

Image

<input>

Specifies the output image. By default, the output image is the same as the input image.

See the syntax here.

Description

The imgInvert function inverts the colors in the specified bitmap, making it like a photographic negative. This function can also be used to invert the color of a 1-bit image, making the black white and the white black.

Examples

In this example, we use the imgInvert function to invert the color of the input image:

  1. When the input image is active, select Image: Adjustments: Invert. This opens the dialog of the X-Function.
  2. In the X-Function dialog, change the settings as the screenshot below and click OK to close the dialog.
    Image:imgInvert_help_English_files_image002.jpg
    A new image is created. We can see that the color is inverted.
Image:imgInvert_help_English_files_image004.jpg
Image:imgInvert_help_English_files_image006.jpg
The original image
The output image


Algorithm

For gray scale image,

O(x, y) = Image:imgInvert_help_English_files_image008.gif- I (x, y);

For color Image,

Image:imgInvert_help_English_files_image010.gif
Image:imgInvert_help_English_files_image012.gif
Image:imgInvert_help_English_files_image014.gif

where O(x, y) is the output pixel value, I(x, y) is the input pixel value, and Bits is Bits Per Pixel.

The computation uses L_InvertBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_InvertBitmap topic.

References

LEADTOOLS Main API Help file, Version 14

Related X-Functions

imgHue