https://github.com/alexflint/triangulation
High quality implementations of many triangulation algorithms in pure python.
https://github.com/alexflint/triangulation
Last synced: 3 months ago
JSON representation
High quality implementations of many triangulation algorithms in pure python.
- Host: GitHub
- URL: https://github.com/alexflint/triangulation
- Owner: alexflint
- Created: 2015-07-02T03:52:36.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-02T03:12:04.000Z (almost 10 years ago)
- Last Synced: 2025-04-06T06:52:30.222Z (3 months ago)
- Language: Python
- Homepage:
- Size: 145 KB
- Stars: 34
- Watchers: 3
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Triangulation
[ ](https://codeship.com/projects/89535)
High quality implementations of triangulation algorithms in pure python.
### Installation
```bash
pip install triangulation
```### Usage
```python
from rigidbody import pr, rotation, SE3
from triangulation import triangulatenoise = 1e-3
true_point = np.random.randn(3) + [0, 0, 10]positions = np.random.randn(num_frames, 3)
orientations = map(rotation.exp, np.random.randn(num_frames, 3)*.1)
poses = [SE3(r, p) for r, p in zip(orientations, positions)]features = []
for pose in poses:
z = pr(np.dot(pose.orientation, point - pose.position))
features.append(z + np.random.randn(2) * noise)triangulated_point = triangulate(features, poses, algorithm="midpoint")
```### Algorithms
**`triangulate_midpoint`**
Finds the 3D point minimizing the sum of squared distances to the rays from each camera.
**`triangulate_linear`**
Finds the 3D point minimizing the sum of squared alebraic errors.
**`triangulate_directional`**
Finds the 3D point minimizing the squared directional error in the first view and the view with longest baseline to the first view.
**`triangulate_directional_pair`**
Finds the 3D point minimizing the squared directional error in two views.
**`triangulate_infnorm`**
Finds the 3D point minimizing the infinity norm of the vector of reprojection errors in all views.
**`triangulate_infnorm_fixed`**
Finds any 3D point such that all reprojection errors are no greater than a given threshold.