Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@udarrr/template-matcher

Package Overview
Dependencies
Maintainers
0
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@udarrr/template-matcher

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

  • 4.6.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
176
decreased by-3.3%
Maintainers
0
Weekly downloads
 
Created
Source

OpenCV 4.1.1 Template Matching Image Finder

Tested Released Supported node LTS versions

It's either standalone or plugin for nutjs project

The best template matcher for node js ever with handlers

  • Invariant Rotating
  • Over Writing
  • Scale Images
  • Non Maximum Suppression

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,
    providerData?: {
                       methodType?: MethodNameType; 
                       scaleSteps?: Array<number>; 
                       searchMultipleScales: boolean,
                       isRotation: boolean,
                       rotationOption?: { range?: number; overLap?: number; minDstLength?: number, subPixEstimation?: boolean };
                       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"; //once wherever

(async () => {
  const img = await screen.find<OptionsSearchParameterType>(imageResource("path"),{ providerData: {...}});
  const imgs = await screen.findAll<OptionsSearchParameterType>(imageResource("path"),{ providerData: {...}});
})();

@udarrr/template-matcher providerData nutjs v3 Api
{
  searchInput: RegionResultFindInput | Promise<RegionResultFindInput>
  params?: {
      searchRegion?: Region | Promise<Region> | undefined;
      confidence?: number | undefined;
      abort?: AbortSignal | undefined;
      providerData?: {
          methodType?: MethodNameType;
          scaleSteps?: Array<number>;
          searchMultipleScales: boolean,
          isRotation: boolean,
          rotationOption?: { range?: number; overLap?: number; minDstLength?: number, subPixEstimation?: boolean };
          debug?: boolean;
          roi?: Region;
      }
  }
};
Values by default
methodType: "TM_CCOEFF_NORMED"
scaleSteps: [1, 0.9, 0.8, 0.7, 0.6, 0.5]
debug: false
searchMultipleScales: true,
isRotation: false,
rotationOption: {
                 range: 180, //-180 +180
                 overLap: 0.1, //inverted scale 0.1 = scaleSteps[0.9]
                 minDstLength: 32, //quality matching up to 4096
                 subPixEstimation: false //for low quality pics
                }
confidence: 0.8 //0.98 for TM_SQDIFF

Keywords

FAQs

Package last updated on 01 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc