ndarray-naive-zncc
v0.1.1
Published
A utility to calculate the Zero Mean Normalized Cross Correlation between two ndarrays.
Downloads
1
Readme
ndarray-naive-zncc
Calculates the ZNCC between a template and a reference ndarray at a given reference offset.
Implementation based on CSC320 Lec - Matching Image Patches.
Installation
npm install ndarray-naive-zncc
Usage
const zncc = require('ndarray-naive-zncc');
const pack = require('ndarray-pack');
let result = zncc(pack([
[0, 0, 0],
[120, 120, 120],
[0, 0, 0]
]),
pack([
[10, 10, 10],
[140, 140, 140],
[10, 10, 10]
]));
console.log(result);
If desired, offsets can also be given for the reference matrix:
const zncc = require('ndarray-naive-zncc');
const pack = require('ndarray-pack');
let result = zncc(pack([
[0, 0, 0],
[120, 120, 120],
[0, 0, 0]
]),
pack([
[600, 500, 200, 200],
[200, 200, 200, 200],
[300, 10, 10, 10],
[300, 140, 140, 140],
[300, 10, 10, 10]
]),
{referenceX: 1, referenceY: 2});
console.log(result);
Example
Run:
npm run example
This will generate the results from the preview image of this readme.