@udarrr/template-matcher
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -7,3 +7,2 @@ import { ImageFinderInterface, MatchRequest, MatchResult } from '@nut-tree/nut-js'; | ||
scaleSteps: Array<number>; | ||
searchWriteOverFounded: boolean; | ||
debug: boolean; | ||
@@ -10,0 +9,0 @@ }; |
@@ -50,18 +50,12 @@ "use strict"; | ||
async findMatches(matchRequest) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
var _a, _b, _c, _d; | ||
let matchResults = []; | ||
let { haystack, needle, confidence, scaleSteps } = await this.initData(matchRequest); | ||
if (!matchRequest.searchMultipleScales && !((_a = matchRequest.customOptions) === null || _a === void 0 ? void 0 : _a.searchWriteOverFounded)) { | ||
const overwrittenResults = await match_image_function_1.MatchTemplate.matchImagesByWriteOverFounded(haystack, needle, confidence, (_b = matchRequest.customOptions) === null || _b === void 0 ? void 0 : _b.methodType, (_c = matchRequest.customOptions) === null || _c === void 0 ? void 0 : _c.debug); | ||
if (!matchRequest.searchMultipleScales) { | ||
const overwrittenResults = await match_image_function_1.MatchTemplate.matchImagesByWriteOverFounded(haystack, needle, confidence, (_a = matchRequest.customOptions) === null || _a === void 0 ? void 0 : _a.methodType, (_b = matchRequest.customOptions) === null || _b === void 0 ? void 0 : _b.debug); | ||
matchResults.push(...overwrittenResults.results); | ||
} | ||
else { | ||
if (matchRequest.searchMultipleScales) { | ||
const scaledResults = await this.searchMultipleScales(haystack, needle, confidence, scaleSteps, (_d = matchRequest.customOptions) === null || _d === void 0 ? void 0 : _d.methodType, (_e = matchRequest.customOptions) === null || _e === void 0 ? void 0 : _e.debug); | ||
matchResults.push(...scaledResults); | ||
} | ||
if ((_f = matchRequest.customOptions) === null || _f === void 0 ? void 0 : _f.searchWriteOverFounded) { | ||
const restResult = await match_image_function_1.MatchTemplate.matchImagesByWriteOverFounded(haystack, needle, confidence, (_g = matchRequest.customOptions) === null || _g === void 0 ? void 0 : _g.methodType, (_h = matchRequest.customOptions) === null || _h === void 0 ? void 0 : _h.debug); | ||
matchResults.push(...restResult.results); | ||
} | ||
const scaledResults = await this.searchMultipleScales(haystack, needle, confidence, scaleSteps, (_c = matchRequest.customOptions) === null || _c === void 0 ? void 0 : _c.methodType, (_d = matchRequest.customOptions) === null || _d === void 0 ? void 0 : _d.debug); | ||
matchResults.push(...scaledResults); | ||
} | ||
@@ -68,0 +62,0 @@ return await this.getValidatedMatches(matchResults, matchRequest, confidence); |
{ | ||
"name": "@udarrr/template-matcher", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "dist/index", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index", |
# nut.js Template Matching Image Finder | ||
| |GitHub Actions| | ||
|:-: |:-: | | ||
| |GitHub Actions| | ||
|:-: |:-: | | ||
|Master |![Create tagged release](https://github.com/nut-tree/TemplateMatcher/workflows/Create%20tagged%20release/badge.svg)| | ||
@@ -10,1 +10,33 @@ |Develop|![Create snapshot release](https://github.com/nut-tree/TemplateMatcher/workflows/Create%20snapshot%20release/badge.svg)| | ||
![Supported Electron versions](https://img.shields.io/badge/electron-8.x.x%20--%2013.x.x-green) | ||
### It's plugin for [nutjs project](https://www.npmjs.com/package/@nut-tree/nut-js) with some features like | ||
#### installation | ||
`npm i @udarrr/template-matcher` | ||
and then just use it in your project once | ||
`import "@udarrr/template-matcher"` or `require("@udarrr/template-matcher")` | ||
#### Benefits | ||
- incresed accuracy (x10) | ||
- incresed perfomance (~x2) | ||
- added some customOptions for arguments `params?: OptionalSearchParameters` in [nutjs](https://github.com/nut-tree/nut.js/blob/develop/lib/optionalsearchparameters.class.ts) | ||
#### Options | ||
` | ||
{ | ||
customOptions: {methodType: MethodNameType; scaleSteps: Array<number>; debug: boolean}, | ||
} | ||
` | ||
- 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 | ||
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 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42
95073
948