PLY color data not working properly

I was previously able to load a ply file with full color data in OFXv8.4

However, now running the same code in 9.0 makes the point cloud colors all appear to be dark grey. The point cloud example still displays color, so I assume that 9.0 is retrieving the colors from a vertex incorrectly.

This is the basic code I’m using:

void ofApp::setup() {
	ofSetVerticalSync(true);
	
    mesh.setMode(OF_PRIMITIVE_POINTS);
    meshSlice.setMode(OF_PRIMITIVE_POINTS);
    mesh.load("1.ply");
    
    mesh.enableNormals();
    meshSlice.enableNormals();
    
    mesh.enableColors();
    meshSlice.enableColors();
    
    
    
    for(int i=0; i< mesh.getVertices().size(); i++){
        if((mesh.getVertex(i).x<.5) & (mesh.getVertex(i).x > 0) ){
            meshSlice.addColor(mesh.getColor(i));
            meshSlice.addVertex(mesh.getVertex(i));
        }
    }

	ofEnableDepthTest();
	glEnable(GL_POINT_SMOOTH); // use circular points instead of square points
	glPointSize(3); // make the points bigger
}

My other option is to download OFXv8.4, however I seem to have an issue with openssl being deprecated and cannot install 8.4 properly. Any suggestions?

Hi @michell3 is it possible to provide the PLY file you are using?

If you simply do mesh.load(“1.ply”);
and then later:
mesh.draw();

do you see the mesh drawing the points with color?

Thanks!
Theo

Hi Theo,

I attached the ply file. Simply displaying the mesh did not work. I have
tried other simple ply files as well. I replicated the problem on another
machine and confirmed that ofv9.0 seems to have an issue loading in colors
from ply files. Actually, if I look closely at the point cloud, lighter
values seem to be a very dark shade of green, although everything generally
looks like black.

I was able to go back to ofv8.4 to display my point cloud colors though. I
just hope there’s a fix for 9.0

Hi,

I know this is a pretty old topic but as I had the same problem and having found a hack (not really an elegant solution …), I’ll post it here :
-“ofMesh.cpp” line 922 : change ofColor c to ofFloatColor
-“ofMesh.cpp” line 925 : after getting the rgb values (line 923-925), add the following line : c*= 1./255.;

1 Like