ImageEn, unit imageenproc

TImageEnProc.BeginImageAnalysis

TImageEnProc.BeginImageAnalysis


Declaration

function BeginImageAnalysis(allowedFormats: TIEPixelFormats; var x1, y1, x2, y2: Integer; var ProcBitmap: TIEBitmap; var mask: TIEMask): Boolean;


Description

BeginImageAnalysis and EndImageAnalysis allow you to create custom image analysis functions that automatically handle selection area and pixel format consistency.

Parameter Description
AllowedFormats The permitted pixel formats
x1, y1, x2, y2 The destination rectangle coordinates to apply the function
ProcBitmap The bitmap to process
mask The selection mask

By using BeginImageAnalysis/EndImageAnalysis, you can avoid considering if the selection is rectangle, elliptical, irregular or magic wand, just process the bitmap as a rectangle.


Example

procedure SearchWhitePixel( proc: TImageEnProc );
var
  ProcBitmap: TIEBitmap;
  mask: TIEMask;
  x1, y1, x2, y2: Integer;
  x, y: Integer;
  px: PRGB;
begin
  // we support only ie24RGB format
  if not proc.BeginImageAnalysis([ie24RGB], x1, y1, x2, y2, ProcBitmap, mask) then
    exit;
  for y := y1 to y2-1 do begin
    px := ProcBitmap.Scanline[y];
    for x := x1 to x2-1 do begin
      with px^ do
         if (r = 255) and (g = 255) and (b = 255) then
  ShowMessage('Found White Pixel!');
      inc(px);
    end;
  end;
  // finalize
  proc.EndImageAnalysis(ProcBitmap);
end;

..
ImageEnView1.SelectEllipse( 100, 100, 100, 100 );
SearchWhitePixel( ImageEnView1.Proc );