eos icon indicating copy to clipboard operation
eos copied to clipboard

Wrong modelview when using pip version

Open d4nst opened this issue 6 years ago • 6 comments

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)

d4nst avatar Aug 08 '18 14:08 d4nst

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 avatar Aug 08 '18 14:08 patrikhuber

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.

patrikhuber avatar Jan 19 '19 13:01 patrikhuber

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]

rstar000 avatar Jun 05 '19 10:06 rstar000

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!

patrikhuber avatar Jun 05 '19 11:06 patrikhuber

@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!

rstar000 avatar Jun 05 '19 12:06 rstar000

@rstar000 Great! :-)

patrikhuber avatar Jun 05 '19 13:06 patrikhuber