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

imgThreshold

Contents

Menu Information

Threshold

Brief Information

Convert part of an image to black and white using threshold

Additional Information

This feature is for OriginPro only.

Command Line Usage

1. imgThreshold low:=10 high:=200 channel:=green flt:=min oimg:=<new>;

2. imgThreshold img:=mat(1) low:=10 high:=200 channel:=green flt:=min oimg:=mat(2);

Variables

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

Input

Image

<active>

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

Lower Bound low

Input

int

0

Specifies the lower bound of the range, within which the colors will be preserved.

Upper Bound high

Input

int

0

Specifies the upper bound of the range, within which the colors will be preserved. It should be greater than the Lower Bound.

Channel channel

Input

int

rgb

Specifies the color channel to be manipulated.
Option list

  • rgb:RGB
    Master channel
  • red:Red
    Red channel
  • green:Green
    Green channel
  • blue:Blue
    Blue channel
Reject Value flt

Input

int

clamp

Specifies how to define the new values for the rejected values or values outside the range defined by Lower Bound and Upper Bound.
Option list

  • min:Set to Min
    The rejected values are set to 0.
  • max:Set to Max
    The rejected values are set to the maximum value, according to the bits per pixel of the image.
  • clamp:Clamp
    The rejected values less that Lower Bound are set to 0, while the rejected values greater than Upper Bound are set to the maximum value, according to the bits per pixel of the 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 imgThreshold function resets the color outside the range specified by two variables, Lower Bound and Upper Bound. You can use this function to apply color adjustment or simple segmentation.

Examples

In this example, we use the imgThreshold function to segment the background from the cells in the input image:

  1. When the input image is active, select Image: Conversion: Threshold. 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:imgThreshold_help_English_files_image002.jpg
    A new image is created as a result.
Image:imgThreshold_help_English_files_image004.jpg
Image:imgThreshold_help_English_files_image006.jpg
The original image
The output image


Algorithm

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

References

LEADTOOLS Main API Help file, Version 14

Related X-Functions

imgAutoBinary, imgDynamicBinary