Socket
Socket
Sign inDemoInstall

opencv

Package Overview
Dependencies
186
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0 to 6.0.0

examples/files/car1_template.jpg

29

CHANGELOG.md
# Changelog
## 6.0.0
# Enhancements
- @wenq added `contour.moments` method.
- @andreasgal added `matrix.substract` method.
- @jainanshul added `matrix.mean` method.
- @idubinskiy restored `contour.points` method.
- @danschultzer updated node-pre-gyp to fix load of node-opencv in electron runtime.
- @andreasgal made `matrix.getData` work with RGB images.
- @Evilcat325 added `matrix.MatchTemplateByMatrix` method.
- @danschultzer added code coverage.
# Bug fixes
- @dominikdolancic fixed image load issue in `matrix.matchTemplate()`.
- @AwooOOoo fixed `type_info` errors in Visual Studio with std namespace pollution.
- @mvines fixed issue that prevented `AsyncSaveWorker` from using de-allocated memory.
- @mcwhittemore fixed dissimilarity example image load.
- @saoron fixed dead index.html documentup source.
- @andreasgal fixed an issue with `matrix.crop` (and potentially others), where `matrix.getData` ends up returning less than full matrix.
- @danschultzer fixed `examples/test.js` channel issue, and problematic Vec3b casting (instead of Vec3f) in `matrix.set`.
## Backwards incompatible changes
- @dxprog changed readImage to load image with `CV_LOAD_IMAGE_UNCHANGED` instead of `CV_LOAD_IMAGE_COLOR`. The latter returned the image as 3-channel.
- @danschultzer changed `VideoCapture.close` to `VideoCapture.release`.
Thanks to all, also a massive thanks to @danschultzer for helping get the open
tickets and PR's under control.
## 5.0.0 (Feb 9 2016)

@@ -5,0 +34,0 @@

4

examples/dissimilarity.js

@@ -8,6 +8,6 @@ var cv = require('../lib/opencv');

cv.readImage("./examples/files/car1.jpg", function(err, car1) {
cv.readImage("./files/car1.jpg", function(err, car1) {
if (err) throw err;
cv.readImage("./examples/files/car2.jpg", function(err, car2) {
cv.readImage("./files/car2.jpg", function(err, car2) {
if (err) throw err;

@@ -14,0 +14,0 @@

var cv = require('../lib/opencv');
var mat = new cv.Matrix(1, 2, cv.Constants.CV_8U, [1]);
var mat = new cv.Matrix(1, 2, cv.Constants.CV_8UC3, [1]);
var row = mat.pixelRow(0);
console.log("mat: " + row[0] + row[1]);
var binary = require('node-pre-gyp');
var path = require('path');
var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));
var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')), { debug: !!process.env.DEBUG });
var binding = require(binding_path);

@@ -5,0 +5,0 @@

{
"name": "opencv",
"version": "5.0.0",
"version": "6.0.0",
"description": "Node Bindings to OpenCV",

@@ -8,4 +8,5 @@ "author": "Peter Braden <peterbraden@peterbraden.co.uk>",

"buffers": "^0.1.1",
"istanbul": "0.4.5",
"nan": "^2.0.9",
"node-pre-gyp": "^0.6.11"
"node-pre-gyp": "^0.6.30"
},

@@ -12,0 +13,0 @@ "devDependencies": {

# node-opencv
[![Build Status](https://secure.travis-ci.org/peterbraden/node-opencv.png)](http://travis-ci.org/peterbraden/node-opencv)
[![Coverage](http://codecov.io/github/peterbraden/node-opencv/coverage.svg?branch=master)](https://codecov.io/gh/peterbraden/node-opencv)
[OpenCV](http://opencv.org) bindings for Node.js. OpenCV is

@@ -226,4 +226,18 @@ the defacto computer vision library - by interfacing with it natively in node,

## Test
Using [tape](https://github.com/substack/tape). Run with command:
`npm test`.
## Code coverage
Using [istanbul](http://gotwarlost.github.io/istanbul/) and [lcov](http://ltp.sourceforge.net/coverage/lcov.php). Run with command:
`make cover`
Build version of `opencv.node` will be generated, and coverage files will be put in `coverage/` directory. These files can be remvoved automatically by running `make clean`.
## MIT License
The library is distributed under the MIT License - if for some reason that
doesn't work for you please get in touch.

@@ -64,4 +64,4 @@ var fs = require('fs')

var mat = new cv.Matrix(1, 2);
mat.set(0,0,3)
mat.set(0,1,5000)
mat.set(0,0,3);
mat.set(0,1,5000);
assert.deepEqual(mat.row(0), [3,5000]);

@@ -131,3 +131,2 @@

assert.equal(errorL2, 7295.591339980605);
errorL2 = im.norm(im, cv.Constants.NORM_L2);

@@ -210,8 +209,9 @@ assert.equal(errorL2, 0);

test("Image read from file", function(assert){
cv.readImage("./examples/files/mona.png", function(err, im){
cv.readImage("./examples/files/opencv.png", function(err, im){
assert.ok(im);
assert.equal(im.width(), 500);
assert.equal(im.height(), 756)
assert.equal(im.empty(), false)
assert.end()
assert.equal(im.width(), 82);
assert.equal(im.height(), 99);
assert.equal(im.channels(), 4);
assert.equal(im.empty(), false);
assert.end();
})

@@ -222,8 +222,9 @@ })

test("read Image from buffer", function(assert){
cv.readImage(fs.readFileSync('./examples/files/mona.png'), function(err, im){
cv.readImage(fs.readFileSync('./examples/files/opencv.png'), function(err, im){
assert.ok(im);
assert.equal(im.width(), 500);
assert.equal(im.height(), 756)
assert.equal(im.empty(), false)
assert.end()
assert.equal(im.width(), 82);
assert.equal(im.height(), 99);
assert.equal(im.channels(), 4);
assert.equal(im.empty(), false);
assert.end();
})

@@ -249,3 +250,3 @@ })

var s = new cv.ImageDataStream()
s.on('load', function(im){
s.on('load', function(im){
assert.ok(im)

@@ -342,3 +343,3 @@ assert.equal(im.empty(), false);

test('Native Matrix', function(assert) {
var nativemat = require('../build/Release/test_nativemat.node');
var nativemat = require('../build/' + (!!process.env.DEBUG ? 'Debug' : 'Release') + '/test_nativemat.node');
var mat = new cv.Matrix(42, 8);

@@ -350,6 +351,52 @@

test('Subtract', function(assert) {
var a = new cv.Matrix.Zeros(1,1);
a.set(0, 0, 3);
var b = new cv.Matrix.Zeros(1,1);
b.set(0, 0, 1);
a.subtract(b);
assert.deepEqual(a.get(0, 0), 2);
assert.end();
});
test('Mean', function(assert) {
var a = new cv.Matrix.Zeros(2, 2, cv.Constants.CV_8UC3);
// Set [0, 0] element to 1 for all three channels
a.set(0, 0, 1, 0);
a.set(0, 0, 1, 1);
a.set(0, 0, 1, 2);
var means = a.mean();
assert.deepEqual(means, [0.25, 0.25, 0.25, 0]);
assert.end();
});
test('MatchTemplateByMatrix', function(assert) {
var cv = require('../lib/opencv');
var targetFilename = "./examples/files/car1.jpg";
var templateFilename = "./examples/files/car1_template.jpg";
cv.readImage(targetFilename, function(err, target){
cv.readImage(templateFilename, function(err, template){
var TM_CCORR_NORMED = 3;
var res = target.matchTemplateByMatrix(template, TM_CCORR_NORMED);
var minMax = res.minMaxLoc();
var topLeft = minMax.maxLoc;
assert.ok(topLeft, "RGB Found Match");
assert.equal(topLeft.x, 42, "match location x === 42");
assert.equal(topLeft.y, 263, "match location y === 263");
target.canny(5,300);
template.canny(5,300);
res = target.matchTemplateByMatrix(template, TM_CCORR_NORMED);
minMax = res.minMaxLoc();
topLeft = minMax.maxLoc;
assert.ok(topLeft, "Canny edge Found Match");
assert.equal(topLeft.x, 42, "match location x === 42");
assert.equal(topLeft.y, 263, "match location y === 263");
assert.end();
});
})
});
// Test the examples folder.
require('./examples')()

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc