frame_align — ASTROSTACK align op

Data kinds: image2d × image2dmatrix

Call: import astrostack; astrostack.frame_align(reference, frame, model='similarity', threshold_sigma=5.0, max_stars=60, tolerance_px=2.0, max_shift_px=None, ransac_iters=500, seed=0, min_inliers=3) (or opsastrostack.get("frame_align"))

Usage

Estimate the 2-D transform `framereference` from star correspondences.

> The detailed description below is the original text — the summary and the headings are translated.

工程は 3 段で、推定の本体はどれも既存 op:

1. :func:star_detect で両方の星を取る。

2. 粗い平行移動をオフセット投票で出す(`_vote_translation`)。

ここで :func:features.match_keypoints を使わないのは実測に基づく判断で、

星野の 9x9 パッチは互いにほとんど同じ形なので Lowe の比検定

(既定 ratio=0.8)がほぼ全部を捨てる。128x128 に 40 星、真のずれが

`(+0.590, -0.540) px のフレーム対での実測: match_keypoints` が

返した対応は 4 件、うち真値から 1 px 以内は 0 件(= 使えるものが

1 つも無い)。同じ対で投票法は 26 票 → 26 対応 → 26 内点、推定誤差

0.0155 px。星野は「特徴が無い」のではなく「特徴が全部同じ」なので、

記述子ではなく配置の幾何を使うのが正しい。

3. 粗い移動で最近傍の対応を作り、

:func:mosaic.proj_match_points_ransac で誤対応を落とし、

:func:fit_transform.vector_to_similarity(`model` に応じて

`vector_to_rigid / vector_to_hom_mat2d`)で当てはめる。

RANSAC ループも Umeyama もここには書いていない。

*model* `"translation"` は対応の差の中央値だけを使う(星が 1 個でも動く)。

`"rigid" = 回転 + 並進、"similarity"` = + 等方スケール、

`"affine" = 6 自由度。**視野が広くなければ "similarity"` で足りる**

(赤道儀の追尾誤差は回転と並進、大気差はスケールに一次で乗る)。

Returns `(matrix, info)`:

• `matrix —— (3, 3) float64。(row, col, 1)` に左から掛けると

`reference の座標になる(fit_transform` と同じ規約)。

• `info —— dict。n_stars_ref / n_stars_src / n_pairs` /

`n_inliers / inlier_ratio / shift_row / shift_col` /

`rotation_deg / scale / rms_px(内点の残差 RMS)/ model`。

fail-closed: 内点が *min_inliers* に満たなければ `ValueError` を送出

する。恒等変換を黙って返さない —— 位置合わせに失敗したフレームを

「ずれ 0」として合成に混ぜると、例外も警告も無しに二重像ができる。

Raises `ValueError`: 2-D でない / 形が違う / *model* が

:data:ALIGN_MODELS にない / どちらかで星が 1 つも見つからない /

対応が作れない / 内点が足りない場合。

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

astro_stackingpy -3.11 examples/astro_stacking.py

Ops the type connects to (they accept matrix as input)

Same category (align)

align_frames


*Provenance: astrostack.py — ASTROSTACK operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.