| matchTemplate | R Documentation |
matchTemplate compares a template against overlapping
image regions using the specified method. After the function finishes
the comparison, the best matches can be found as global minimums (when
methods "SQDIFF" or "SQDIFF_NORMED" are used) or maximums (when methods
"CCORR", "CCORR_NORMED", "CCOEFF" or "CCOEF_NORMED" are used) using the
minMaxLoc function.
matchTemplate(image, template, method, mask = NULL, target = "new")
image |
An |
template |
An |
method |
A string indicating the comparison method to use. It can be any of the following (see https://bit.ly/2RjELvJ for a full description of each comparison method):
|
mask |
An |
target |
The location where the results should be stored. It can take 2 values:
|
If target="new", the function returns an Image
object with (R-r+1) rows and (C-c+1) columns, where CxR
and cxr are the dimensions of image and template,
respectively. If target is an Image object, the
function returns nothing and modifies that Image object in
place.
Simon Garnier, garnier@njit.edu
Image, minMaxLoc
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
sub <- subImage(balloon, 290, 170, 150, 150)
match <- matchTemplate(balloon, sub, method = "SQDIFF")
mm <- minMaxLoc(match)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.