ImageEn, unit ievision

TIEVisionImage.matchTemplateAsMap

TIEVisionImage.matchTemplateAsMap


Declaration

function matchTemplateAsMap(templ: TIEVisionImage; matchMethod: TIEVisionTemplateMatchMethod): TIEVisionImage; safecall;


Description

Searches the image for the location of the template image and returns the map of comparison results (a ie32f bitmap).

Parameter Description
templ Template image to find. It must be not larger than the source image.
matchMethod Comparison method




Demo

Demo  Demos\IEVision\PatternMatchingMap\PatternMatchingMap.dpr


Example

procedure TMainForm.Button2Click(Sender: TObject);
var
  image, templ, map: TIEVisionImage;
  rect: TIEVisionRect;
begin
  ImageEnVect1.RemoveAllObjects();

  // get image to search
  image := ImageEnVect1.IEBitmap.GetIEVisionImage();

  // get the template image to find
  templ := IEVSource.IEBitmap.GetIEVisionImage();

  // perform template searching
  rect := image.matchTemplate(templ, TIEVisionTemplateMatchMethod(ComboBox1.ItemIndex));

  // draw a red box around the found rectangle
  ImageEnVect1.ObjPenWidth[-1] := 3;
  ImageEnVect1.AddNewObject(iekBOX, IEVisionRectToTRect(rect), clRed);

  // fill the resulting map
  map := image.matchTemplateAsMap(templ, TIEVisionTemplateMatchMethod(ComboBox1.ItemIndex));
  ImageEnVect2.IEBitmap.AssignIEVisionImage(map);
  ImageEnVect2.Update();
end;