Spaces:
Running on Zero
Running on Zero
Download src/utils/geometry.py from ritianyu/SplatAnything: direct link, hf CLI and curl.
- Browser
- Download file 659 Bytes
-
https://huggingface.co/spaces/ritianyu/SplatAnything/resolve/main/src/utils/geometry.py
- Command line
-
hf download hf://spaces/ritianyu/SplatAnything/src/utils/geometry.py
-
curl -L -o geometry.py https://huggingface.co/spaces/ritianyu/SplatAnything/resolve/main/src/utils/geometry.py
659 Bytes
| # Modified for SplatAnything: inference-only release. | |
| def colmap_to_opencv_intrinsics(K): | |
| """ | |
| Modify camera intrinsics to follow a different convention. | |
| Coordinates of the center of the top-left pixels are by default: | |
| - (0.5, 0.5) in Colmap | |
| - (0,0) in OpenCV | |
| """ | |
| K = K.copy() | |
| K[0, 2] -= 0.5 | |
| K[1, 2] -= 0.5 | |
| return K | |
| def opencv_to_colmap_intrinsics(K): | |
| """ | |
| Modify camera intrinsics to follow a different convention. | |
| Coordinates of the center of the top-left pixels are by default: | |
| - (0.5, 0.5) in Colmap | |
| - (0,0) in OpenCV | |
| """ | |
| K = K.copy() | |
| K[0, 2] += 0.5 | |
| K[1, 2] += 0.5 | |
| return K | |