0.0.1 • Published 8 years ago

node-pastec v0.0.1

Weekly downloads
4
License
GPL-3.0
Repository
github
Last release
8 years ago

node-pastec

Contribute

To work on the code, first fetch the bundled pastec submodule, then build node-pastec and run the tests.

git submodule update --init
npm install
npm test

Dependencies

In order to compile pastec submodule, you need OpenCV. On Ubuntu 14.10, this package can be installed using the following command:

sudo apt-get install libopencv-dev

Usage

Simple example, included as examples/simple.js:

Import module

var nodePastec = new require("../");

Initialize module

var pastec = new nodePastec.Pastec("backwardIndex.dat", "visualWordsORB.dat");

Add Image to index

var imageData = ...//Buffer
var imageTag = "cocaCola";

console.log("####### Adding image from buffer with id: 111 #######");
var buf = new Buffer(imageData, 'base64');
console.log(pastec.addImage(111, buf, imageTag));

Search image from a buffer

console.log("####### Search Image from buffer #######");
var buf = new Buffer(imageData, 'base64');
console.log(pastec.searchImage(buf));

Remove image from index

console.log("####### Removing Image whit id: 111 #######");
console.log(pastec.removeImage(111));

Add Images