| ImageEn, unit imageenproc |
|
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
procBmp: TIEBitmap;
msk: 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, procBmp, msk) then
exit;
for y := y1 to y2 - 1 do
begin
px := procBmp.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(procBmp);
end;
..
ImageEnView1.SelectEllipse( 100, 100, 100, 100 );
SearchWhitePixel( ImageEnView1.Proc );