Feedback: Two days later, I'm totally in love with VSCode. It's really awesome and it made my life a lot easier! Thanks guys!
UNSOLVED I have some trouble with how to write native abstraction for nodejs
Hi,guys, I'm new to node.js and I have met some difficult problems. Now, I 'm writing a native abstraction for node.js to combine with my cpp code, which are some re-encapsulated function about OpenCV's camera calibration algorithm. The thing is I don't know how to convert opecv datatype to v8 datatype, such as std::vector<cv::Mat>,
I do know how to convert single cv::Mat datatype and a vector<Point2f> datatype to v8 Object, I`ll attach those code in the end, please give me some suggestion about how to convert vector<Mat> and vector<vector<Point2f>> to v8 object.
char buffer = node::Buffer::Data(info->ToObject());
size_t size = node::Buffer::Length(info->ToObject());
std::vector<char> src(buffer, buffer + size);
std::vector<uchar> dst = new std::vector<uchar>();
//do some thing with it
Nan::NewBuffer((char)dst->data(), dst->size(), png_delete_callback, dst).ToLocalChecked()
//**This is how to convert a cv::Mat to v8 buffer*/
v8::Localv8::Object obj = Nan::Newv8::Object();
Nan::Set(obj, Nan::New("x").ToLocalChecked(), Nan::New(pts[i].x));
Nan::Set(obj, Nan::New("y").ToLocalChecked(), Nan::New(pts[i].y));
Nan::Set(arr, i, obj);
//vector<Point2f> to jsArray