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

Does is support derivatives with respect to the extrinsic parameters? #165

Open
huameichen0523 opened this issue Aug 21, 2021 · 1 comment

Comments

@huameichen0523
Copy link

Just wondering if it is possible to fit a mesh to a depth image by changing extrinsic parameters of the camera? In other words, the object is rigid rather than deformable. If yes, can you provide an example? Thank you

@martinResearch
Copy link
Owner

In the camera projection backward pass I don't compute derivatives w.r.t the cameras extrinsic parameters ( in project_points_backward I compute only derivatives w.r.t the points positions points_3d_b) so we can't fit the mesh by changing the camera extrinsic parameters using this "hand coded" derivative backpropagation function as we don't have gradients for the extrinsic parameters.

However instead of fitting the mesh by moving the camera by changing it extinsic parameters , you can move the mesh itself , which is what I do in the example https://github.com/martinResearch/DEODR/blob/master/deodr/examples/depth_image_hand_fitting.py.
In order to optimize over the rotation you need a representation that does not have singularities , which is why I use quaternions (that I normalize after each step). You can make the fitting rigid by commenting out the line

self.vertices = self.vertices + self.speed_vertices

(and then remove or comment part of code above it that becomes unused)

Alternatively, if you use either tensorflow or pytorch , then you can potentially get derivatives on the extrinsic parameters using the automatic differentiation they provide, in which case you could optimize over the extrinsic parameters. You will need to make sure the 3x3 submatrix of the extrinsic matrix corresponding to the rotation remains a rotation matrix through the iterative fitting updates (using a quaternion reparamterization for example or by reprojecting on the 3D rotation group after each step of the gradient descent, or moving along a geodesic on the 3D rotation group using exponential maps).

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