Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in write_obj_with_colors #138

Open
tetterl opened this issue Feb 12, 2020 · 3 comments · May be fixed by #139
Open

Bug in write_obj_with_colors #138

tetterl opened this issue Feb 12, 2020 · 3 comments · May be fixed by #139

Comments

@tetterl
Copy link

tetterl commented Feb 12, 2020

I'm testing main.py. It seems that the function write_obj_with_colors contains a bug. In particular the line:

s = 'v {:.4f} {:.4f} {:.4f} {} {} {}\n'.format(vertices[1, i], vertices[0, i], vertices[2, i], colors[i, 2],
                                               colors[i, 1], colors[i, 0])

We are writing yxz to the *.obj file instead of xyz.

*.ply file in meshlab:
image

*.obj file with yxz in meshlab:
image

If we simply change the indices: format(vertices[1, i], vertices[0, i], vertices[2, i], ... we don't get the correct vertex colors though (see white shirt of obama)
*.obj file with xyz in meshlab:
image

Original image:
0000

The 3 meshes don't seem to match in terms of the pose (and orientation). Is there a bug or anything I'm missing?

@tetterl
Copy link
Author

tetterl commented Feb 13, 2020

Some of the mismatch might stem from the fact that the transformation in ddfa.py

# transform to image coordinate space
            vertex[1, :] = std_size + 1 - vertex[1, :]

transforms from the right-handed world coordinate system to the image coordinate system which then becomes a left-handed system.

The incorrect switching of axes in the *.obj generation inverts this again leading to a correct right handed coordinate system.

@Matthewli623
Copy link

I'm testing main.py. It seems that the function write_obj_with_colors contains a bug. In particular the line:

s = 'v {:.4f} {:.4f} {:.4f} {} {} {}\n'.format(vertices[1, i], vertices[0, i], vertices[2, i], colors[i, 2],
                                               colors[i, 1], colors[i, 0])

We are writing yxz to the *.obj file instead of xyz.

*.ply file in meshlab:
image

*.obj file with yxz in meshlab:
image

If we simply change the indices: format(vertices[1, i], vertices[0, i], vertices[2, i], ... we don't get the correct vertex colors though (see white shirt of obama)
*.obj file with xyz in meshlab:
image

Original image:
0000

The 3 meshes don't seem to match in terms of the pose (and orientation). Is there a bug or anything I'm missing?

How can you get the obj file with texture?Thank you.

@cleardusk
Copy link
Owner

@Matthewli623 Sampling the texture by position correspondence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants