ImageEn, unit imageenproc

TImageEnProc.Threshold

TImageEnProc.Threshold


Declaration

procedure Threshold(DownLimit, UpLimit, DownVal, UpVal: TRGB); overload;
procedure Threshold(LoThreshold, HiThreshold: Integer; Red, Green, Blue: Boolean); overload;


Description

Replace colors above and below a threshold.
First overload assigns the DownVal color to all colors smaller or equal to DownLimit, and UpVal to all colors greater than UpLimit.
With second overload, you specify the low and high pixel value (LoThreshold and HiThreshold). Red, Green and Blue specify where to apply the threshold operation.

Note:
 A UI for this is available to your users in the Image Processing dialog
 If the image PixelFormat is not ie24RGB or ie32RGB, it will be converted


Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Examples

// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

  

// Change all values less than R/G/B of 64 to black
ImageEnView1.Proc.Threshold( CreateRGB(64, 64, 64), CreateRGB(255, 255, 255), CreateRGB(0, 0, 0), CreateRGB(255, 255, 255) );

  

// Change all values greater than R/G/B of 192 to white
ImageEnView1.Proc.Threshold( CreateRGB(0, 0, 0), CreateRGB(192, 192, 192), CreateRGB(0, 0, 0), CreateRGB(255, 255, 255) );

  


// Change values with a red value greater than 192 to pure red
ImageEnView1.Proc.Threshold( CreateRGB(0, 0, 0), CreateRGB(192, 0, 0), CreateRGB(0, 0, 0), CreateRGB(255, 0, 0) );


See Also

 CreateRGB
 TRGB2TColor
 TColor2TRGB