similarity
similarity
#
aligned and georeferenced — the similarity that carries a model onto its priors.
- Correspondence. Every registered camera (a key of
model.cameras) is matched to its prior, centre to centre:alignedto the pose at that index of anArray,georeferencedto the entry under that key of aMap— sparse fixes, as EXIF gives them. - Solve.
umeyamafinds the scale, rotation and translation that map the model's centres onto the priors' in the least-squares sense: in three dimensions foraligned, whose priors carry altitude and gravity; in the horizontal plane alone forgeoreferenced, whose model was levelled first and whose fixes know nothing of up. - Apply.
transformedmoves every camera pose (rotation composed, centre mapped) and every point by a similarity; observations are index-only and carry over.
aligned(model, priors)
#
model carried by the similarity mapping its camera centres onto priors.
The gauge lock for a scale-free model — one reconstructed from nothing, or
a multi-view network's output — before it is adjusted against priors or
used as a seed. A camera's key is its position in priors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Reconstruction
|
The reconstruction to move. |
required |
priors
|
Array[Pose]
|
The poses whose centres the model's cameras should land on, indexed like the images the model was built from. |
required |
Source code in capturegraph-recipes/capturegraph_recipes/sfm/alignment/similarity.py
georeferenced(model, priors)
#
model carried by the horizontal similarity landing its cameras on their fixes.
A yaw about y, one scale and a shift in x and z, solved over
the cameras both model and priors hold; heights are scaled with
the rest but never lifted or tilted, so level the model first. Fixes
without altitude are the point: only their horizontal positions count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Reconstruction
|
The levelled reconstruction to move. |
required |
priors
|
Map[String, Pose]
|
A prior pose per image position, sparse: typically |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If fewer than two cameras have a fix. |
Source code in capturegraph-recipes/capturegraph_recipes/sfm/alignment/similarity.py
transformed(model, scale, rotation, translation)
#
model under the similarity x ↦ scale · rotation · x + translation.
Every camera's centre is mapped and its orientation composed with
rotation; every point is mapped; the observations carry over.
Source code in capturegraph-recipes/capturegraph_recipes/sfm/alignment/similarity.py
umeyama(source, target, with_scale=True)
#
The least-squares similarity target ≈ scale · R · source + t (Umeyama, 1991).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
ndarray
|
N×D points to map. |
required |
target
|
ndarray
|
N×D points to land on, row for row. |
required |
with_scale
|
bool
|
Whether to solve the scale too, else it stays 1. |
True
|
Returns:
| Type | Description |
|---|---|
float
|
|
ndarray
|
a D-vector. Fewer than two distinct points make the problem degenerate |
ndarray
|
and yield a pure translation of the means. |