I have an OBJ
file that has a structure similar to this:
$ cat mybed.obj | head -10
# This file uses centimeters as units for non-parametric coordinates.
v 90.646411 4.913757 79.774410
v 90.645129 6.884663 79.774410
v -91.197881 4.913074 79.774563
v -91.199155 6.883980 79.774563
v 90.651746 4.906044 52.059825
v 90.651709 4.906044 13.877269
v 90.650449 6.892189 52.059841
v 90.650427 6.892189 13.877281
And looks like this in MeshLab:
My goal is to convert this into a triangular mesh in OFF
format. When I convert OBJ
to OFF
using MeshLab
, even though I mark off the polygonal
option, still, I get an error from a program for which I am supposed to feed in triangular meshes.
So, my question is how can I convert my current OBJ file with the described format into a triangular mesh OFF
file (using any code or software)?
When I converted the OBJ
to OFF
, the beginning and end of OFF
file looks different:
(tsdf) mona@goku:~$ cat mybed1.off | head -10
OFF
7796 15564 0
90.64641 4.913757 79.77441
90.64513 6.884663 79.77441
-91.19788 4.913074 79.77457
-91.19916 6.88398 79.77457
90.65175 4.906044 52.05983
90.65171 4.906044 13.87727
90.65045 6.892189 52.05984
90.65043 6.892189 13.87728
(tsdf) mona@goku:~$ cat mybed1.off | tail -10
3 7331 7323 7566 192 192 192
3 7331 7566 7483 192 192 192
3 7324 7326 7571 192 192 192
3 7324 7571 7473 192 192 192
3 7328 7330 7577 192 192 192
3 7328 7577 7479 192 192 192
3 7326 7328 7574 192 192 192
3 7326 7574 7476 192 192 192
3 7330 7324 7568 192 192 192
3 7330 7568 7482 192 192 192
Here's the settings I chose:
The 'tail' section of that file contains RGB color values per triangle , which are those extra numbers "192 192 192". This is the information of color per face, and probably is misleading your program (mesh-fusion) when try to read the off file, because it is not expecting color per face information.
You have three possible solutions:
sed 's/192\ 192\ 192$//' mybed1.off > mybed2.off