2.0.4 • Published 2 years ago

waldo-lib v2.0.4

Weekly downloads
-
License
GPL-3.0-only
Repository
github
Last release
2 years ago

waldo-lib

npm version

Javascript library for fast and simple template matching without weird opencv bindings!

What is template matching?

"Template matching is a technique in digital image processing for finding small parts of an image which match a template image." - wikipedia.org

Quickstart

$ npm install waldo-lib
import { Waldo, WaldoImageData, Match } from 'waldo-lib'

const waldo = new Waldo()

const image: WaldoImageData = {
  data: Uint8ClampedArray.from([
    0,0,0,255,  0,0,0,255,        0,0,0,255,
    0,0,0,255,  255,255,255,255,  0,0,0,255, 
    0,0,0,255,  0,0,0,255,        0,0,0,255
  ]),
  width: 3,
  height: 3
}

const template: WaldoImageData = {
  data: Uint8ClampedArray.from([
    0,0,0,255,  0,0,0,255,
    0,0,0,255,  255,255,255,255
  ]),
  width: 2,
  height: 2
}

const match = waldo.highestSimilarity(image, template)
console.log(match)

/*
{
  location: { x: 1, y: 1 },
  similarity: 1, // Value goes from 0 to 1
}
*/

How to load in ImageData

The libary is designed to work with data in the format used by the Canvas Web API. For now just look at guides for loading that.

Docs

The full API Documentation can be found under https://tinkertoe.github.io/waldo-lib

2.0.3

2 years ago

2.0.4

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago