Created
November 27, 2024 12:17
-
-
Save oliver-batchelor/b18fdcbc533d205cf1527c7e6770b63a to your computer and use it in GitHub Desktop.
EWA Splatting Jacobian sympy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sympy as sp | |
fx, fy, cx, cy, x, y, z = sp.symbols('fx fy cx cy x y z') | |
K = sp.Matrix([[fx, 0, cx], | |
[0, fy, cy], | |
[0, 0, 1]]) | |
p = sp.Matrix([x, y, z]) | |
# project point | |
p_proj_ = K @ p | |
d = p_proj_[2] | |
p_proj = p_proj_ / p_proj_[2] | |
J = sp.diff(p_proj, p) | |
J_flat = sp.transpose(J.reshape(3, 3)) | |
print(sp.simplify(J_flat)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment