patrikhuber / eos

A lightweight 3D Morphable Face Model library in modern C++
Apache License 2.0
1.89k stars 596 forks source link

Python: Extracted texture has wrong rotation #301

Closed MatthewCaruana closed 3 years ago

MatthewCaruana commented 4 years ago

I was following and building upon your face fitting example (for Python) while also making my own implementation. When trying out your example code I decided to do the following in addition to the code that is provided in the demo.py file:

eos.core.write_textured_obj(mesh, "models/test.obj")

image = cv.imread('Images_Final/image_0010.png')
isomap = eos.render.extract_texture(mesh, pose, image)

cv.imshow("image", image)
cv.imshow("isomap", isomap)

cv.waitKey(0)
cv.destroyAllWindows()

The results that came with these commands (specifically the extracted texture) is the following:

image

As can be seen, it is orientated wrongly. I am using the latest pip version of the package, however, I also tried using 1.0.1 version as was discussed in #129 with the same result. Inherently, when I apply the texture to the model through MeshLab, it is keeping the same rotation as can be seen below.

image

Is there some sort of function that I have forgot to implement or call?

patrikhuber commented 4 years ago

Hi,

As you can see, the texture map is just 90° rotated. You can probably just rotate it and it should be fine.

I think this was an issue in the Image Python bindings which I fixed recently in the devel branch: https://github.com/patrikhuber/eos/compare/devel

Let me know how that goes. Thanks!

MatthewCaruana commented 4 years ago

Managed to acquire the rotated texture map. Sorry I did not try out the devel branch binding as I am running rather tight on getting things done with my studies.

patrikhuber commented 4 years ago

Great!

I'll leave this one open until the changes from the devel branch are merged.

patrikhuber commented 3 years ago

This has now been merged into the master branched (dc0fce864caf87648ac116d8ca1b2cf55435b65a) and released in eos 1.2.0/1.2.1! :-) Thanks again for pinging me on this issue here.