ImageEn, unit imageenproc

TImageEnProc.ConvertToBWLocalThreshold

TImageEnProc.ConvertToBWLocalThreshold

Declaration

procedure ConvertToBWLocalThreshold(WinSize: Integer = 4; Mode: TIEThreshMode = ietMean; Offset: Integer = 4; AllowAlpha: Boolean = False);

Description

Convert a true color image (24, 32 or 48 bit) to black & white (1 bit) using a local threshold algorithm (mean, median or min/max mean).
Set AllowAlpha to True to avoid losing the alpha channel.
Parameter Description
WinSize The size of the box to analyze when calculating the threshold algorithm, minimum value is 2
Mode ietMean, ietMedian or ietMeanMinMax
Offset Subtracts an offset from the calculated threshold

Note: Any selection is ignored. The whole image is converted to the specified palette

Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr

Example

Also see: Automated Samples
// Convert true color image to black & white using a local threshold algorithm (mean)
ImageEnView1.Proc.ConvertToBWLocalThreshold( 4, ietMean );

Black and White Conversion Comparison

ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

  


// Convert true color image to black & white using the Floyd-Steinberg algorithm
ImageEnView1.Proc.ConvertToBW_FloydSteinberg();

  


// Convert true color image to black & white using a local threshold algorithm (mean)
ImageEnView1.Proc.ConvertToBWLocalThreshold( 4, ietMean );

  


// Convert true color image to black & white with an ordered dithering method
ImageEnView1.Proc.ConvertToBWOrdered();

  


// Convert true color image to black & white using a thresholding algorithm
ImageEnView1.Proc.ConvertToBWThreshold( 128 );

  


// Convert true color image to black & white using a thresholding algorithm (using the average level)
ImageEnView1.Proc.ConvertToBWThreshold( -1 );

  


// Convert true color image to black & white using a thresholding algorithm (using maximum entropy)
ImageEnView1.Proc.ConvertToBWThreshold( -2 );

  

See Also

ConvertToBW_FloydSteinberg
ConvertToBWOrdered
ConvertToBWThreshold
adaptiveThreshold