TIEVisionImage.matchTemplateAsMap
Declaration
function matchTemplateAsMap(templ: TIEVisionImage; matchMethod: TIEVisionTemplateMatchMethod): TIEVisionImage; safecall;
Description
Search 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 |
Using Template matching to find the original location of a cropped portion of image:
Note: If a map is not required use
matchTemplate or
matchTemplateMulti | Demos\IEVision\PatternMatchingMap\PatternMatchingMap.dpr |
| Demos\ImageEditing\EveryMethod\EveryMethod.dpr |
procedure TMainForm.Button2Click(Sender: TObject);
var
image, templ, map: TIEVisionImage;
rect: TIEVisionRect;
begin
ImageEnView1.LayersClear( False );
// get image to search
image := ImageEnView1.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
ImageEnView1.LayersAdd( iesRectangle, IEVisionRectToTRect( rect ), clRed, 2 );
// fill the resulting map
map := image.matchTemplateAsMap(templ, TIEVisionTemplateMatchMethod(ComboBox1.ItemIndex));
ImageEnView2.IEBitmap.AssignIEVisionImage(map);
end;