1 | initial version |
ply format is simple, just a header, followed by your 3d points:
ply
format ascii 1.0
element vertex <FILL_IN_NUMBER_OF_POINTS_HERE>
property float x
property float y
property float z
end_header
1 17 2.3
22 2 1
...
obj is even more simple:
v 1 4 2
v 2 2 2
v 17 2 1.3
if you compiled opencv with opengl support (WITH_OPENGL, check cv::getBuildInformation()), you can use that:
void on_opengl(void* param)
{
glLoadIdentity();
glTranslated(0,0,-5); // -z points into screen !
glPointSize(2.0);
glBegin(GL_POINTS);
for (int i = 0; i < numPoints; i++) {
glColor3ub( 80, 30, 40 );
glVertex3d(points[i][0], points[i][1], points[i][2]);
}
glEnd();
}
String name = "ogl";
namedWindow(name, WINDOW_OPENGL);
setOpenGlDrawCallback(name, on_opengl);
while (1)
{
updateWindow(name); // this calls on_opengl
int k = waitKey(20);
}
well, doh, if you're doing this for the 1st time, you'll end up with the model being behind your camera, being topdown and whatnot. it's an art of its own (and quite some time sink ..)
can't help you with viz3d at all. (been exposed to vtk 20 years ago, and have sworn never to touch that again ;)
2 | No.2 Revision |
ply format is simple, just a header, followed by your 3d points:
ply
format ascii 1.0
element vertex <FILL_IN_NUMBER_OF_POINTS_HERE>
property float x
property float y
property float z
end_header
1 17 2.3
22 2 1
...
obj is even more simple:simple, just put a 'v' in front of your x y z points:
v 1 4 2
v 2 2 2
v 17 2 1.3
again, your point cloud has only 'vertices', there is no mesh(triangles or such), which makes it quite simple in above cases.
if you compiled opencv with opengl support (WITH_OPENGL, check cv::getBuildInformation()), you can also try to use that:
void on_opengl(void* param)
{
glLoadIdentity();
glTranslated(0,0,-5); // -z points into screen !
glPointSize(2.0);
glBegin(GL_POINTS);
for (int i = 0; i < numPoints; i++) {
glColor3ub( 80, 30, 40 );
glVertex3d(points[i][0], points[i][1], points[i][2]);
}
glEnd();
}
String name = "ogl";
namedWindow(name, WINDOW_OPENGL);
setOpenGlDrawCallback(name, on_opengl);
while (1)
{
updateWindow(name); // this calls on_opengl
int k = waitKey(20);
}
well, doh, if you're doing this for the 1st time, you'll end up with the model being behind your camera, being topdown and whatnot. it's an art of its own (and quite some time sink ..)
can't help you with viz3d at all. (been exposed to vtk 20 years ago, and have sworn never to touch that again ;)