Create a mesh from blobs using depth camera (Kinect)

Hi,
I am basically trying to create a mesh from recognised object using a kinect.

Insofar, I have substracted the background, done a double thresholding and found my contours using contourfiner. I stored those contours in a vector of ofxCvBlob. The idea now is that I would like to generate a mesh using ofmesh based on the pixels located inside the blobs.

I’m fairly new so my code might look fairly wrong:

mesh.setMode(OF_PRIMITIVE_POINTS);
int step = 2;

    for(int y = 0; y < blobs.size(); y += step) {
        for(int x = 0; x < blobs.size(); x += step) {
            if(video.getDistanceAt(x, y) > 0) {
                mesh.addColor(video.getColorAt(x,y));
                mesh.addVertex(video.getWorldCoordinateAt(x, y));
            }
    }

}
glPointSize(3);
ofPushMatrix();
// the projected points are ‘upside down’ and ‘backwards’
ofScale(1, -1, -1);
ofTranslate(0, 0, -1000); // center the points a bit
ofEnableDepthTest();
mesh.draw();
ofDisableDepthTest();
ofPopMatrix();
}

Any advices more than welcome.