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

Camera space origin is not at screen center #30

Open
pekkavaa opened this issue Sep 17, 2021 · 2 comments
Open

Camera space origin is not at screen center #30

pekkavaa opened this issue Sep 17, 2021 · 2 comments

Comments

@pekkavaa
Copy link

When a face is centered on camera the reported translation X and Y coordinates are not zeros. A possible reason for this is that the camera intrinsic matrix has offsets computed for the wrong axis when doing the position solving.

The camera matrix is

self.camera = np.array([[width, 0, width/2], [0, width, height/2], [0, 0, 1]], np.float32)

so that means c_x = width/2 and c_y = height/2 but then later image_pts that is passed to solvePnP() is a vector of (y,x) points so self.camera translates the Y coordinates with width/2 and vice-versa for the point X coordinates.

I'd submit a patch to fix this but the code is somewhat tricky so I'm not sure I'd get it right.

@emilianavt
Copy link
Owner

Thank you for the report. I'll look into it.

@emilianavt
Copy link
Owner

There does definitely seem something off, but like you noted, it's the code is a bit tricky and trying to adjust it in a simple way breaks things. I'll get back to it again.

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

No branches or pull requests

2 participants