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

Wrong modelview when using pip version #219

Open
d4nst opened this issue Aug 8, 2018 · 6 comments
Open

Wrong modelview when using pip version #219

d4nst opened this issue Aug 8, 2018 · 6 comments

Comments

@d4nst
Copy link

d4nst commented Aug 8, 2018

I am using eos 3D model to generate 2D depth maps. Initially, I used the python bindings compiled from source and everything worked fine. However, when using the version from pip, there is a problem with the modelview matrix that makes my code not work properly. Below you can see the difference between executing demo.py using the bindings compiled from source and the ones from pip (both of them are version 0.16.1):

  • Source:
ipdb> pose.get_modelview()
array([
[  0.87695104,   0.04230939,  -0.47871366, 309.55637   ],      
[ -0.09763256,   0.9910292 ,  -0.0912636 , 312.72763   ],       
[  0.4705579 ,   0.12677175,   0.87321484,   0.        ],      
[  0.        ,   0.        ,   0.        ,   1.        ]],  dtype=float32)
  • Pip:
ipdb> pose.get_modelview()
array([
[  0.     ,   0.     ,   0.     , 309.55637], 
[  0.     ,   0.     ,   0.     , 312.72763],       
[  0.     ,   0.     ,   0.     ,   0.     ],       
[  0.     ,   0.     ,   0.     ,   0.     ]], dtype=float32)
@patrikhuber
Copy link
Owner

Hi, thanks for the report!

I think this needs further investigation. I don't think I currently have time to investigate.
Can you just use the source-compiled version in the meantime?

@patrikhuber
Copy link
Owner

I've had one more person report issues with the projection being wrong in Release builds of the Python bindings. I am marking this as potential bug and will try to find the time to debug.

@rstar000
Copy link

rstar000 commented Jun 5, 2019

Hi! Maybe i'm a bit late, but it seems like the model-view matrix is actually inverted. This is the result of projecting model-space axes using the returned model-view matrix, but inverted.
image

Code for reference:

def project_axis(matrix):   
    axis = np.float32([[500,0,0], 
                          [0,500,0], 
                          [0,0,500]])
    proj_points = matrix[:3,:3].T @ axis
    return proj_points[:3,:2]

@patrikhuber
Copy link
Owner

Hi @rstar000,

I think this is a different (potential) issue from the one that was originally reported here.

With "inverted", do you mean transposed? I would be quite surprised if the model-view matrix was transposed. Is it possible that you got fooled by the depiction of the three coloured drawn axes? They can often look like they point in the "wrong" direction, our brain's interpretation can fool us when only looking at a static image. I would suggest that you run it on a video where someone turns their head (or e.g. the live cam), it's much easier to see then whether the axes are drawn correctly.

If you still think there is an issue, could you open a separate issue for it to continue the discussion there?

Thanks!

@rstar000
Copy link

rstar000 commented Jun 5, 2019

@patrikhuber Hey, sorry, I just found a silly bug in my projection code. I was using row vectors instead of column vectors for some reason. The matrix returned from pose.get_modelview() is absolutely correct!

@patrikhuber
Copy link
Owner

@rstar000 Great! :-)

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

No branches or pull requests

3 participants