Functions

Threshold Operations
[Image Processing]

Collaboration diagram for Threshold Operations:

Functions

int imProcessRangeContrastThreshold (const imImage *src_image, imImage *dst_image, int kernel_size, int min_range)
int imProcessLocalMaxThreshold (const imImage *src_image, imImage *dst_image, int kernel_size, int min_level)
void imProcessThreshold (const imImage *src_image, imImage *dst_image, double level, int value)
void imProcessThresholdByDiff (const imImage *src_image1, const imImage *src_image2, imImage *dst_image)
void imProcessHysteresisThreshold (const imImage *src_image, imImage *dst_image, int low_thres, int high_thres)
void imProcessHysteresisThresEstimate (const imImage *image, int *low_level, int *high_level)
int imProcessUniformErrThreshold (const imImage *src_image, imImage *dst_image)
void imProcessDiffusionErrThreshold (const imImage *src_image, imImage *dst_image, int level)
int imProcessPercentThreshold (const imImage *src_image, imImage *dst_image, double percent)
int imProcessOtsuThreshold (const imImage *src_image, imImage *dst_image)
double imProcessMinMaxThreshold (const imImage *src_image, imImage *dst_image)
void imProcessLocalMaxThresEstimate (const imImage *image, int *level)
void imProcessSliceThreshold (const imImage *src_image, imImage *dst_image, double start_level, double end_level)
void imProcessThresholdColor (const imImage *src_image, imImage *dst_image, double *src_color, double tol)
void imProcessThresholdSaturation (imImage *src_image, imImage *dst_image, double S_min)

Detailed Description

Operations that converts a usually IM_GRAY/IM_BYTE image into a IM_BINARY image using several threshold techniques.
See im_process_pnt.h

Function Documentation

int imProcessRangeContrastThreshold ( const imImage src_image,
imImage dst_image,
int  kernel_size,
int  min_range 
)

Threshold using a rank convolution with a range contrast function.
Supports all integer IM_GRAY images as source, and IM_BINARY as target.
Local variable threshold by the method of Bernsen.
Extracted from XITE, Copyright 1991, Blab, UiO
http://www.ifi.uio.no/~blab/Software/Xite/

  Reference:	
    Bernsen, J: "Dynamic thresholding of grey-level images"
		Proc. of the 8th ICPR, Paris, Oct 1986, 1251-1255.
  Author:     Oivind Due Trier

Returns zero if the counter aborted.

im.ProcessRangeContrastThreshold(src_image: imImage, dst_image: imImage, kernel_size: number, min_range: number) -> counter: boolean [in Lua 5] 
im.ProcessRangeContrastThresholdNew(image: imImage, kernel_size: number, min_range: number) -> counter: boolean, new_image: imImage [in Lua 5] 
int imProcessLocalMaxThreshold ( const imImage src_image,
imImage dst_image,
int  kernel_size,
int  min_level 
)

Threshold using a rank convolution with a local max function.
Returns zero if the counter aborted.
Supports all integer IM_GRAY images as source, and IM_BINARY as target.

im.ProcessLocalMaxThreshold(src_image: imImage, dst_image: imImage, kernel_size: number, min_level: number) -> counter: boolean [in Lua 5] 
im.ProcessLocalMaxThresholdNew(image: imImage, kernel_size: number, min_level: number) -> counter: boolean, new_image: imImage [in Lua 5] 
void imProcessThreshold ( const imImage src_image,
imImage dst_image,
double  level,
int  value 
)

Apply a manual threshold.
threshold = a <= level ? 0: value
Normal value is 1 but another common value is 255. Can be done in-place for IM_BYTE source.
Source color space must be IM_GRAY, and target color space must be IM_BINARY. complex is not supported.

im.ProcessThreshold(src_image: imImage, dst_image: imImage, level: number, value: number) [in Lua 5] 
im.ProcessThresholdNew(src_image: imImage, level: number, value: number) -> new_image: imImage [in Lua 5] 
void imProcessThresholdByDiff ( const imImage src_image1,
const imImage src_image2,
imImage dst_image 
)

Apply a threshold by the difference of two images.
threshold = a1 <= a2 ? 0: 1
Source color space must be IM_GRAY, and target color space must be IM_BINARY. complex is not supported. Can be done in-place for IM_BYTE source.

im.ProcessThresholdByDiff(src_image1: imImage, src_image2: imImage, dst_image: imImage) [in Lua 5] 
im.ProcessThresholdByDiffNew(src_image1: imImage, src_image2: imImage) -> new_image: imImage [in Lua 5] 
void imProcessHysteresisThreshold ( const imImage src_image,
imImage dst_image,
int  low_thres,
int  high_thres 
)

Apply a threshold by the Hysteresis method.
Hysteresis thersholding of edge pixels. Starting at pixels with a value greater than the HIGH threshold, trace a connected sequence of pixels that have a value greater than the LOW threhsold.
complex is not supported. Can be done in-place for IM_BYTE source.
Note: could not find the original source code author name.

im.ProcessHysteresisThreshold(src_image: imImage, dst_image: imImage, low_thres: number, high_thres: number) [in Lua 5] 
im.ProcessHysteresisThresholdNew(src_image: imImage, low_thres: number, high_thres: number) -> new_image: imImage [in Lua 5] 
void imProcessHysteresisThresEstimate ( const imImage image,
int *  low_level,
int *  high_level 
)

Estimates hysteresis low and high threshold levels.
Image data type can be IM_BYTE, IM_SHORT or IM_USHORT.
Usefull for imProcessHysteresisThreshold.

im.ProcessHysteresisThresEstimate(image: imImage) -> low_level: number, high_level: number [in Lua 5] 
int imProcessUniformErrThreshold ( const imImage src_image,
imImage dst_image 
)

Calculates the threshold level for manual threshold using an uniform error approach.
Supports only IM_BYTE images. Extracted from XITE, Copyright 1991, Blab, UiO
http://www.ifi.uio.no/~blab/Software/Xite/

  Reference:
    S. M. Dunn & D. Harwood & L. S. Davis:
    "Local Estimation of the Uniform Error Threshold"
    IEEE Trans. on PAMI, Vol PAMI-6, No 6, Nov 1984.
  Comments: It only works well on images whith large objects.
  Author: Olav Borgli, BLAB, ifi, UiO
  Image processing lab, Department of Informatics, University of Oslo

Returns the used level.

im.ProcessUniformErrThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5] 
im.ProcessUniformErrThresholdNew(src_image: imImage)  -> level: number, new_image: imImage [in Lua 5] 
void imProcessDiffusionErrThreshold ( const imImage src_image,
imImage dst_image,
int  level 
)

Apply a dithering on each image channel by using a diffusion error method.
It can be applied on any IM_BYTE images. It will "threshold" each channel indivudually, so source and target must be of the same depth. Not using OpenMP when enabled.

im.ProcessDiffusionErrThreshold(src_image: imImage, dst_image: imImage, level: number) [in Lua 5] 
im.ProcessDiffusionErrThresholdNew(src_image: imImage, level: number) -> new_image: imImage [in Lua 5] 
int imProcessPercentThreshold ( const imImage src_image,
imImage dst_image,
double  percent 
)

Calculates the threshold level for manual threshold using a percentage of pixels that should stay bellow the threshold.
Image data type can be IM_BYTE, IM_SHORT or IM_USHORT.
Source color space must be IM_GRAY, and target color space must be IM_BINARY. Returns the used level.

im.ProcessPercentThreshold(src_image: imImage, dst_image: imImage, percent: number) -> level: number [in Lua 5] 
im.ProcessPercentThresholdNew(src_image: imImage, percent: number) -> level: number, new_image: imImage [in Lua 5] 
int imProcessOtsuThreshold ( const imImage src_image,
imImage dst_image 
)

Calculates the threshold level for manual threshold using the Otsu approach.
Image can be IM_BYTE, IM_SHORT or IM_USHORT.
Source color space must be IM_GRAY, and target color space must be IM_BINARY. Returns the used level.
Original implementation by Flavio Szenberg.

im.ProcessOtsuThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5] 
im.ProcessOtsuThresholdNew(src_image: imImage) -> level: number, new_image: imImage [in Lua 5] 
double imProcessMinMaxThreshold ( const imImage src_image,
imImage dst_image 
)

Calculates the threshold level for manual threshold using (max-min)/2.
Returns the used level.
Source color space must be IM_GRAY, and target color space must be IM_BINARY. complex is not supported. Can be done in-place for IM_BYTE source.

im.ProcessMinMaxThreshold(src_image: imImage, dst_image: imImage) -> level: number [in Lua 5] 
im.ProcessMinMaxThresholdNew(src_image: imImage) -> level: number, new_image: imImage [in Lua 5] 
void imProcessLocalMaxThresEstimate ( const imImage image,
int *  level 
)

Estimates Local Max threshold level for images. Image can be IM_BYTE, IM_SHORT or IM_USHORT.

im.ProcessLocalMaxThresEstimate(image: imImage) -> level: number [in Lua 5] 
void imProcessSliceThreshold ( const imImage src_image,
imImage dst_image,
double  start_level,
double  end_level 
)

Apply a manual threshold using an interval.
threshold = start_level <= a <= end_level ? 1: 0
Normal value is 1 but another common value is 255.
Source color space must be IM_GRAY, and target color space must be IM_BINARY. complex is not supported. Can be done in-place for IM_BYTE source.

im.ProcessSliceThreshold(src_image: imImage, dst_image: imImage, start_level: number, end_level: number) [in Lua 5] 
im.ProcessSliceThresholdNew(src_image: imImage, start_level: number, end_level: number) -> new_image: imImage [in Lua 5] 
void imProcessThresholdColor ( const imImage src_image,
imImage dst_image,
double *  src_color,
double  tol 
)

Threshold using a color and a tolerance value.
The color will be type casted to the image data type.
The color must have the same number of components of the images.
Supports all color spaces and all data types except complex.

im.ProcessThresholdColor(src_image: imImage, dst_image: imImage, src_color: table of numbers, tol: number) [in Lua 5] 
im.ProcessThresholdColorNew(src_image: imImage, src_color: table of numbers, tol: number) -> new_image: imImage [in Lua 5] 
void imProcessThresholdSaturation ( imImage src_image,
imImage dst_image,
double  S_min 
)

Threshold using a saturation minimum. (since 3.14)
Supports only IM_RGB+IM_BYTE as source.

im.ProcessThresholdSaturation(src_image: imImage, dst_image: imImage, S_min: number) [in Lua 5] 
im.ProcessThresholdSaturationNew(src_image: imImage, S_min: number) -> new_image: imImage [in Lua 5]