View my account

Pointcloud data of L515

Comments

3 comments

  • Rizal Marzuki

    Hi Albert,

     

    You are printing out the pointer address.

    Here is an example for point cloud vertices.

    auto vertices = points.get_vertices();

    for (int i = 0; i < points.size(); i++) {
    rs2::vertex vertex = vertices[i];
    if (vertex.z) {
    std::cout << vertex.x << " " << vertex.y << " " << vertex.z << " " << std::endl;
    }
    }

    For depth you can use something like

    for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++)
    {
    auto dist = depth.get_distance(x, y);
    std::cout << (x + 1) << "," << (y + 1) << "," << dist << std::endl;
    }
    }

     

    Hope this helps.

     

    Regards,

    Rizal

    0
    Comment actions Permalink
  • Albert5065706

    Hi Rizal, thanks for your answer. It really helps a lot.

    But now I have a little problem, I use C++ to get the x&y&dist data, and the height(y) and width(x) of frame is 480 and 640.

    If I need to save it into a 2Darray and doing my calculate, it will cost a lot of time. Is there a solution about this problem?

     

     

    0
    Comment actions Permalink
  • Rizal Marzuki

    Hi Albert,

    You could try using unit transform to speed up extracting the distance.

    You could use the following template as a guide.

     ...
        rs2::units_transform ut;
        rs2::pipeline pipe;
        pipe.start();
        while (...)
        {
            rs2::frameset data = pipe.wait_for_frames();
            if (auto depth_raw_frame = data.get_depth_frame())
            {
                auto depth_metric_frame = ut.process(depth_raw_frame);
                // Add your code here
            }
        }

    Regards,

    Rizal

    0
    Comment actions Permalink

Please sign in to leave a comment.