Using ORBBEC Astra with PCL library

My goal is to create PointCloud visualization with PCL SDK but don’t know where to start.

At the moment I managed to create an application which does segmentation of human body and draws all the points using OpenGL.

I’m not sure how to convert my points from PointStream (in Astra SDK) to a PointCloud (in PCL SDK) or if I even need to do that. Because I already have all the points I need, is there a way to just visualize them using PCL? (although later I’ll try creating mesh out of those points).

PCD file format is pretty basic, I didn’t bother trying to use the PCL SDK to save data:

void savePCD(const astra::DepthFrame& depthFrame, const std::string& filename)
    std::unique_ptr<int16_t[]> depthData};
    const int width = depthFrame.width();
    const int height = depthFrame.height();
    const int size = width * height;

    const int byteLength = size * sizeof(uint16_t);
    depthData = DepthPtr(new int16_t[byteLength]);

    FILE* fp = fopen(filename.c_str(), "wt");
    fprintf(fp, "VERSION .7\n");
    fprintf(fp, "FIELDS x y z\n");
    fprintf(fp, "SIZE 4 4 4\n");
    fprintf(fp, "TYPE F F F\n");
    fprintf(fp, "COUNT 1 1 1\n");
    fprintf(fp, "WIDTH %d\n", width);
    fprintf(fp, "HEIGHT %d\n", height);
    fprintf(fp, "VIEWPOINT 0 0 0 1 0 0 0\n");
    fprintf(fp, "POINTS %d\n", size);
    fprintf(fp, "DATA ascii\n");

    for (int y = 0; y < height; y++)
        for (int x = 0; x < width; x++)
            const size_t index = (width * y) + x;
            const short point = depthData[index];
            if (point == 0)
                fprintf(fp, "%d %d nan\n", x, y);
                fprintf(fp, "%d %d %d\n", x, y, point);