scipy-cookbook
scipy-cookbook copied to clipboard
Update bundle adjustment
I have done some improvements on this notebook:
- Clarify definition of camera parameters
- Add a comment about relation between images and cameras for this particular setup
- Slightly reworked the core part
- Replace self-written function for rotation transform with
Rotationclass
Link to the updated notebook file
https://github.com/scipy/scipy-cookbook/blob/9e136daac9df507db7bf114bf319e6ade9723c21/ipython/bundle_adjustment.ipynb
Fixes #44
@rgommers
If you have time / interest check this too, I believe it is a clear improvement and safe to merge.
But let's wait for the people from the issues to comment.
That looks great! I was translating this notebook from scipy to PyTorch and the original Rodrigues vector to unit quaternion implementation introduced some numeric instabiliity that took me a while to hunt down. Your change will solve this issue.
The code that introduced numeric instability:
theta = np.linalg.norm(camera_params[:, :3], axis=1)[:, np.newaxis]
with np.errstate(invalid='ignore'):
v = camera_params[:, :3] / theta
v = np.nan_to_num(v)