#ifndef __CV_MAT_H__ #define __CV_MAT_H__ #include "node.h" class CVMat : public Napi::ObjectWrap { public: friend class CVVideoCapture; public: static Napi::Object Init(Napi::Env env, Napi::Object exports); CVMat(const Napi::CallbackInfo &info); static Napi::Value ImRead(const Napi::CallbackInfo &info); static Napi::Value ImDecode(const Napi::CallbackInfo &info); static Napi::Value ImWrite(const Napi::CallbackInfo &info); static Napi::Value ImEncode(const Napi::CallbackInfo &info); Napi::Value IsEmpty(const Napi::CallbackInfo &info); Napi::Value GetCols(const Napi::CallbackInfo &info); Napi::Value GetRows(const Napi::CallbackInfo &info); Napi::Value GetType(const Napi::CallbackInfo &info); Napi::Value GetDepth(const Napi::CallbackInfo &info); Napi::Value GetChannels(const Napi::CallbackInfo &info); Napi::Value GetFlags(const Napi::CallbackInfo &info); Napi::Value GetDims(const Napi::CallbackInfo &info); Napi::Value GetIsContinuous(const Napi::CallbackInfo &info); Napi::Value GetIsSubmatrix(const Napi::CallbackInfo &info); Napi::Value GetElemSize(const Napi::CallbackInfo &info); Napi::Value GetElemSize1(const Napi::CallbackInfo &info); Napi::Value GetTotal(const Napi::CallbackInfo &info); Napi::Value GetTotalWithDim(const Napi::CallbackInfo &info); Napi::Value GetSize(const Napi::CallbackInfo &info); Napi::Value GetData(const Napi::CallbackInfo &info); Napi::Value Col(const Napi::CallbackInfo &info); Napi::Value ColRange(const Napi::CallbackInfo &info); Napi::Value Row(const Napi::CallbackInfo &info); Napi::Value RowRange(const Napi::CallbackInfo &info); Napi::Value Diag(const Napi::CallbackInfo &info); Napi::Value Clone(const Napi::CallbackInfo &info); Napi::Value CopyTo(const Napi::CallbackInfo &info); static Napi::Value Crop(const Napi::CallbackInfo &info); static Napi::Value Resize(const Napi::CallbackInfo &info); static Napi::Value WarpAffine(const Napi::CallbackInfo &info); static Napi::Value Blur(const Napi::CallbackInfo &info); static Napi::Value CopyMakeBorder(const Napi::CallbackInfo &info); static Napi::Value Flip(const Napi::CallbackInfo &info); static Napi::Value GetRotationMatrix2D(const Napi::CallbackInfo &info); static Napi::Value Rectangle(const Napi::CallbackInfo &info); static Napi::Value Circle(const Napi::CallbackInfo &info); static Napi::Value Line(const Napi::CallbackInfo &info); static Napi::Value Ellipse(const Napi::CallbackInfo &info); static Napi::Value Polylines(const Napi::CallbackInfo &info); static Napi::Value FillPoly(const Napi::CallbackInfo &info); static Napi::Value FillConvexPoly(const Napi::CallbackInfo &info); static Napi::Value DrawMarker(const Napi::CallbackInfo &info); static Napi::Value PutText(const Napi::CallbackInfo &info); private: inline static Napi::Object EmptyMat(Napi::Env env) { return constructor->New({}).As(); } inline static CVMat &GetMat(Napi::Object obj) { return *ObjectWrap::Unwrap(obj); } inline static Napi::Object CreateMat(Napi::Env env, std::function callback) { auto obj = EmptyMat(env); callback(GetMat(obj)); return obj; } private: static Napi::FunctionReference *constructor; cv::Mat mat_; }; #endif