JSPM

  • Created
  • Published
  • Downloads 129
  • Score
    100M100P100Q85400F
  • License Apache 2.0

Locate images on your screen using template matching in nut.js or standalone

Package Exports

  • @udarrr/template-matcher
  • @udarrr/template-matcher/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@udarrr/template-matcher) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

OpenCV 4.1.1 Template Matching Image Finder

Tested Released Supported node LTS versions

It's either standalone or plugin for nutjs project

Installation for standalone

npm i @udarrr/template-matcher

and connect finder to your project

import finder from "@udarrr/template-matcher";

//some examples
const matcheImages = await finder.findMatch({haystack: pathToImage, needle: pathToTemplate});
const matcheWithScreen = await finder.findMatch({needle: pathToTemplate});

const matchesImages = await finder.findMatches({haystack: pathToImage, needle: pathToTemplate});
const matchesWithScreen = await finder.findMatches({needle: pathToTemplate});

Installation for nutjs

npm i @udarrr/template-matcher

and then just use it in your project once

import "@udarrr/template-matcher"` or `require("@udarrr/template-matcher")

Options

Standalone

{
    haystack?: string | Image,
    needle: string | Image,
    confidence?: number,
    searchMultipleScales?: boolean,
    customOptions?: {
                       methodType: MethodNameType; 
                       scaleSteps: Array<number>; 
                       roi: Region; 
                       debug: boolean
                    },
}

Nutjs

//
{
    confidence?: number,
    searchMultipleScales?: boolean,
    customOptions?: {
                       methodType: MethodNameType; 
                       scaleSteps: Array<number>; 
                       roi: Region; 
                       debug: boolean
                    },
}

Values by default

methodType: "TM_CCOEFF" | "TM_CCOEFF_NORMED" | "TM_CCORR" | "TM_CCORR_NORMED" | "TM_SQDIFF" | "TM_SQDIFF_NORMED" by default "TM_CCOEFF_NORMED"
scaleSteps:  [0.9]; by default  [1, 0.9, 0.8, 0.7, 0.6, 0.5]
debug: true | false by default false
confidence: for "TM_SQDIFF" | "TM_SQDIFF_NORMED" confidence by default 0.98 for "TM_CCOEFF" | "TM_CCOEFF_NORMED" | "TM_CCORR" | "TM_CCORR_NORMED" by default 0.8

Disclaimer for nutjs v3

In case using the package with nutjs v3 or above please use precise 2.0.1 version of the package