ImageEn, unit ievision

TIEVisionImage.threshold

TIEVisionImage.threshold


Declaration

function threshold(thresh: double; maxval: double; threshType: TIEVisionThresholdType): double; safecall;


Description

Applies a fixed-level threshold to each pixel element.

Returns the computed threshold value when ievTHRESH_OTSU or ievTHRESH_TRIANGLE is specified.

Note: Pixel format of input image must be ie8g.

Parameter Description
thresh Threshold value
maxval Maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types
threshType Thresholding type. Optionally, you can OR the type with ievTHRESH_OTSU to use the optimal threshold value determined by Otsuís algorithm


Example

begin
  ImageEnView.IO.LoadFromFile('input.jpg');
  ImageEnView.IEBitmap.PixelFormat := ie8g;
  ImageEnView.IEBitmap.GetIEVisionImage().threshold(0, 255, ievTHRESH_BINARY or ievTHRESH_OTSU);
  ImageEnView.Update();
end;