Ich kann 3D-Punkte in einer Farbe zeichnen, sagen wir grün. Aber ich versage es, einzelne Farbe auf jeden Punkt anzuwenden.Punktwolke mit individueller Farbe
bool applyColor = true;
glPointSize(3);
glBegin(GL_POINTS);
glColor3ub(0,255,0);
for(auto vpMP : vpMPs){
if(applyColor){
cv::Vec3b rgb = vpMP->rgb;
glColor3ub(rgb[2], rgb[1], rgb[0]);
cout << (int)rgb[0] << ", " << (int)rgb[1] << ", " << (int)rgb[2] << endl; // Prints out right values
}
cv::Mat pos = vpMP->GetWorldPos();
glVertex3f(pos.at<float>(0),pos.at<float>(1),pos.at<float>(2));
}
glEnd();
Irgendwelche Anhaltspunkte?
glVertex3f funktioniert gut, Punkte erscheinen dort, wo sie sein sollten.
Mit applyColor = false werden Punkte grün angezeigt.
Mit applyColor = true, zeigen Punkte schwarz, wenn sie rgb sein sollten. BTW, rgb [i] sind vorzeichenlose Zeichen.
Vielen Dank!
Also was siehst du in 'cout'? Welche Werte gibt es in 'vpMP-> rgb'? – ybungalobill
cout druckt Zeilen wie diese: '244, 98, 12' alle korrekten rgb-Werte von 0 bis 255. –
Das bedeutet, dass das Problem in dem Code liegt, den Sie nicht angezeigt haben. Bitte poste ein [MCVE] (http://stackoverflow.com/help/mcve). – ybungalobill