From c4573104976b90ea7591ee1ee160b325c302695d Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Wed, 20 Jan 2016 20:42:41 -0800 Subject: [PATCH] Define a native interface for unwrapping the cv:Mat from a Matrix object --- inc/Matrix.h | 28 ++++++++++++++++++++++++++++ include_dirs.js | 14 ++++++++++++++ src/Matrix.cc | 8 ++++---- src/Matrix.h | 6 +++--- 4 files changed, 49 insertions(+), 7 deletions(-) create mode 100755 inc/Matrix.h create mode 100644 include_dirs.js diff --git a/inc/Matrix.h b/inc/Matrix.h new file mode 100755 index 0000000..beed998 --- /dev/null +++ b/inc/Matrix.h @@ -0,0 +1,28 @@ +/* + This file defines the public native interface into an node-opencv Matrix + object. This is used to retrieve the wrapped OpenCV cv:Mat object from other + native code: + + NAN_METHOD(UnwrapMatrix) { + cv::Mat mat = Nan::ObjectWrap::Unwrap(info[0]->ToObject())->mat; + // ... + } + + */ +#ifndef NODE_OPENCV_MATRIX_H +#define NODE_OPENCV_MATRIX_H +#include +#include + +namespace node_opencv { + +class Matrix: public Nan::ObjectWrap { +public: + cv::Mat mat; +protected: + Matrix(): Nan::ObjectWrap() {}; +}; + +} + +#endif // NODE_OPENCV_MATRIX_H diff --git a/include_dirs.js b/include_dirs.js new file mode 100644 index 0000000..8d72392 --- /dev/null +++ b/include_dirs.js @@ -0,0 +1,14 @@ +// Outputs the path to public node-opencv header files. This is used when +// building other native node modules that require access to the +// node-opencv Matrix base class. +// +// To use this file, add something like the following to your binding.gyp: +// +// "include_dirs": [ +// " constructor; static void Init(Local target); static NAN_METHOD(New);