How to use the opencv4nodejs-prebuilt.TM_SQDIFF_NORMED function in opencv4nodejs-prebuilt

To help you get started, we’ve selected a few opencv4nodejs-prebuilt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nut-tree / nut.js / lib / provider / opencv / match-image.function.ts View on Github external
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,
    ),
  );
}