peterbraden/node-opencv — pull request #169 by emallson (2014-09-18 17:36:06+00:00)
Title: Implement `new cv.Matrix(rows, cols, type)` constructor

I implemented the 3-param constructor for `Matrix` and added a `Constants` object which exposes the type constants that are used for the 3rd parameter. For example, to create a `CV_64F` typed Matrix:

var cv = require('opencv');
var mat = new cv.Matrix(3, 3, cv.Constants.CV_64F);

This is useful because it allows passing matrices constructed through other means to functions like `im.warpPerspective`. Previously, this would fail as the type of a matrix defaults to `CV_32FC3` while `warpPerspective` wants `CV_32F` or `CV_64F`. I need this feature because I'm computing a perspective transform with a different method.

The diffs are large because I have Emacs set to remove trailing whitespace and newlines in programming buffers. (Most 1-line changes are of this kind).

I did not implement tests for this constructor.