diff --git a/src/Matrix.cc b/src/Matrix.cc index 72d54bd..0d3665f 100755 --- a/src/Matrix.cc +++ b/src/Matrix.cc @@ -35,6 +35,7 @@ void Matrix::Init(Local target) { Nan::SetPrototypeMethod(ctor, "pixel", Pixel); Nan::SetPrototypeMethod(ctor, "width", Width); Nan::SetPrototypeMethod(ctor, "height", Height); + Nan::SetPrototypeMethod(ctor, "type", Type); Nan::SetPrototypeMethod(ctor, "size", Size); Nan::SetPrototypeMethod(ctor, "clone", Clone); Nan::SetPrototypeMethod(ctor, "crop", Crop); @@ -497,6 +498,12 @@ NAN_METHOD(Matrix::Size) { info.GetReturnValue().Set(arr); } +NAN_METHOD(Matrix::Type) { + SETUP_FUNCTION(Matrix) + + info.GetReturnValue().Set(Nan::New(self->mat.type())); +} + NAN_METHOD(Matrix::Clone) { SETUP_FUNCTION(Matrix) diff --git a/src/Matrix.h b/src/Matrix.h index ee337e6..03fc112 100755 --- a/src/Matrix.h +++ b/src/Matrix.h @@ -36,6 +36,7 @@ public: JSFUNC(Size) JSFUNC(Width) JSFUNC(Height) + JSFUNC(Type) JSFUNC(Channels) JSFUNC(Clone) JSFUNC(Ellipse)