OpenCV 4.1.1 Template Matching Image Finder
![Supported node LTS versions](https://img.shields.io/badge/node@arch64-12%2C%2013%2C%2014%2C%2015%2C%2016%2C%2017%2C%2018%2C%2019%2C%2020-green)
It's either standalone or plugin for nutjs project
Standalone findMatch,findMatches
npm i @udarrr/template-matcher
import finder from "@udarrr/template-matcher";
(async () => {
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'});
})();
@udarrr/template-matcher standalone API
{
haystack?: string | Image,
needle: string | Image,
confidence?: number,
searchMultipleScales?: boolean,
customOptions?: {
methodType?: MethodNameType;
scaleSteps?: Array<number>;
roi?: Region;
debug?: boolean
},
}
Nutjs v3 find,findAll
npm i @udarrr/template-matcher
import { imageResource, screen } from '@nut-tree/nut-js';
import {OptionsSearchParameterType} from '@udarrr/template-matcher/lib/types'
import "@udarrr/template-matcher";
(async () => {
const img = await screen.find<OptionsSearchParameterType>(imageResource("path"),{ providerData: {...}}F);
const imgs = await screen.findAll<OptionsSearchParameterType>(imageResource("path"),{ providerData: {...}});
})();
@udarrr/template-matcher providerData nutjs v3 Api
{
providerData?: {
searchMultipleScales?: boolean;
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 v2.3.0
npm i @udarrr/template-matcher@2.1.3
"@udarrr/template-matcher": "~2.1.3",