Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function matchImages(haystack: cv.Mat, needle: cv.Mat): Promise {
const match = await haystack.matchTemplateAsync(
needle,
cv.TM_SQDIFF_NORMED,
);
const minMax = await match.minMaxLocAsync();
return new MatchResult(
1.0 - minMax.minVal,
new Region(
minMax.minLoc.x,
minMax.minLoc.y,
needle.cols,
needle.rows,
),
);
}