b9a4d51fac
Programma standalone Pattern Matching 2D con GUI cv2/tk + algoritmo puro riusabile. Due backend: - LineShapeMatcher (default): porting Python di line2Dup (linemod-style) - Gradient orientation quantized 8-bin modulo π + spreading - Feature sparse top-magnitude con spacing minimo - Score via shift-add vettorizzato numpy (O(N_features·H·W)) - Piramide multi-risoluzione con pruning varianti al top-level - Supporto mask binaria per modello non-rettangolare - EdgeShapeMatcher (fallback): Canny + matchTemplate multi-rotazione GUI separata da algoritmo. Benchmark clip.png (13 istanze): - Edge backend: 84s, 6/13 score ~0.3 - Line backend: 4.1s, 13/13 score 0.98-1.00 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
27 lines
622 B
Python
27 lines
622 B
Python
"""Entry-point standalone Pattern Matching 2D shape-based.
|
|
|
|
Esegui: uv run python main.py
|
|
"""
|
|
from pathlib import Path
|
|
|
|
from pm2d.gui import run
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_dir = Path(__file__).parent / "Test"
|
|
run(
|
|
initial_dir=str(test_dir) if test_dir.is_dir() else None,
|
|
angle_range_deg=(0.0, 360.0),
|
|
angle_step_deg=5.0,
|
|
scale_range=(1.0, 1.0),
|
|
scale_step=0.1,
|
|
num_features=96,
|
|
weak_grad=30.0,
|
|
strong_grad=60.0,
|
|
spread_radius=5,
|
|
pyramid_levels=3,
|
|
min_score=0.55,
|
|
max_matches=25,
|
|
backend="line",
|
|
)
|