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

imgPalette

Contents

Menu Information

Image Palette

Brief Information

Apply palette to image

Command Line Usage

1. imgPalette palfile:=system.path.program$+"Palettes\green.pal";

2. imgPalette palfile:=system.path.program$+"Palettes\rainbow.pal" 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.

Palette File palfile

Input

string

"grayscale"

Specifies the palette file to use.

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 imgPalette function applies a palette to an 8-bit grayscale image. By doing this, we are actually applying pseudocolor to the grayscale image, where the palette file is used as the pseudocolor lookup table.

This X-Function works with 8-bit grayscale images only. If the image to be processed does not meet this requirement, you will have to convert it to an 8-bit grayscale image first. In Origin, you can use the imgC2gray X-Function to perform the conversion.

Note that some built-in palette files are saved in Palettes subfolder of the Origin 8 program folder.

Examples

In this example, we use the imgPalette function to apply pseudocolor to a grayscale image:

  1. When an 8-bit grayscale image is active, select Image: Conversion: Image Palette. This opens the dialog of the X-Function.
  2. In the X-Function dialog, change the settings as the screenshot below (If your palette file locates is another folder, click the Browse button to select the right path and filename) and click OK to close the dialog.
    Image:imgPalette_help_English_files_image002.jpg
    A new image is created. We can see that it is a color image.
Image:imgPalette_help_English_files_image004.jpg
Image:imgPalette_help_English_files_image006.jpg
The original image
The output image


For more examples, please refer to XF Script Dialog (press F11).

Algorithm

The gray levels of the original image are mapped to different colors according to the palette file.

References

Kenneth R.Castleman.1996. Digital Image Processing. Prentice Hall, Upper Saddle River, NJ, USA.

Related X-Functions

imgC2gray