• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.4.3 Latest
Buy Hosting
V

VERITASLEE

@VERITASLEE
About
Posts
2
Topics
2
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

    I have some trouble with how to write native abstraction for nodejs
  • V VERITASLEE

    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>,
    std::vector<std::vector<cv::Point2f>.
    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.
    if(info.Length()!=1) return;
    char buffer = node::Buffer::Data(info[0]->ToObject());
    size_t size = node::Buffer::Length(info[0]->ToObject());
    std::vector<char> src(buffer, buffer + size);
    std::vector<uchar> dst = new std::vector<uchar>();
    //do some thing with it
    //return
    info.GetReturnValue().Set(
    Nan::NewBuffer((char
    )dst->data(), dst->size(), png_delete_callback, dst).ToLocalChecked()
    );
    //**This is how to convert a cv::Mat to v8 buffe
    r*/

    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

  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
  • Login

  • Don't have an account? Register

  • Login or register to search.