Reputation: 11
I have generated a .obj file from a scan of a 3d scanner. However, I am not sure how to interpret all this data. I have looked on wikipedia and understood the general structure of the .ibj file. My goal is to extract some information about the colour and I am not sure how to do that. What do the numbers in the vt line represent and how can I use those to come up with a colour? My end objective is to scan a foot and cancel out the floor "portion" of the scan. When scanning the foot, the floor is also part of the scan and I would like to disregard the floor and concentrate on the foot. Here is a small part of the .obj file:
Upvotes: 0
Views: 1452
Reputation: 51845
Look s like Wavefront obj ASCII fileformat ... so google a bit and you will find tons of descriptions. In Your example:
v x y z
means point coordinate (vertex) [x,y,z]
vn nx,ny,nz
means normal vector (nx,ny,nz)
of last point [x,y,z]
vt tx,ty
means texture coordinate [tx,ty]
Vertexes are the points of the polygonal mesh. Normals are used for lighting computations (shading) so if you do not use it you can skip it. The color is stored in some texture image and you will pick it as a pixel at [tx,ty]
the range is tx,ty=<-1,+1>
or <0,+1>
so you need to rescale to image resolution.
So you need to read all this data to some table and then find section with faces (starts with f
):
f v1,v2,v3
means render polygon with 3 vertexes where v1,v2,v3
are index of vertex from the table. Beware the indexing starts from 1 so for C++ style arrays you need to decrement the indexes by 1.There are a lot of deviations so without an example is hard to elaborate further (your example shows only the start of vertex table).
Upvotes: 1