We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7032506 commit 1d1a864Copy full SHA for 1d1a864
lib/provider/opencv/template-matching-finder.class.ts
@@ -179,7 +179,12 @@ export class TemplateMatchingFinder implements FinderInterface {
179
const potentialMatches = matches
180
.filter(match => match.confidence >= matchRequest.confidence);
181
if (potentialMatches.length === 0) {
182
- reject(`Unable to locate ${matchRequest.pathToNeedle}, no match!`);
+ const bestMatch = matches.sort((a, b) => a.confidence - b.confidence).pop();
183
+ if (bestMatch) {
184
+ reject(`No match with required confidence ${matchRequest.confidence}. Best match: ${bestMatch.confidence} at ${bestMatch.location}`)
185
+ } else {
186
+ reject(`Unable to locate ${matchRequest.pathToNeedle}, no match!`);
187
+ }
188
}
189
resolve(potentialMatches[0]);
190
} catch (e) {
0 commit comments