| |
| """ |
| Registry of shape-specific secondary validators, dispatched by the |
| exemplar's classified shape_type (see classical_cv_detector.classify_shape). |
| |
| Shape types with no registered validator (square, triangle, pentagon, |
| polygon, unknown) fall back to geometry+OCR only, same as Phase 1. |
| """ |
|
|
| from . import circle, diamond, hexagon |
|
|
| VALIDATORS = { |
| "diamond": diamond.validate, |
| "circle": circle.validate, |
| "hexagon": hexagon.validate, |
| } |
|
|
| |
| |
| |
| |
| |
| |
| PIPELINES = { |
| "diamond": diamond.detect_page, |
| "hexagon": hexagon.detect_page, |
| } |
|
|
|
|
| def get_validator(shape_type: str): |
| """Return the validate(binary_orig, binary_cleaned, cx, cy, r) -> bool function for shape_type, or None.""" |
| return VALIDATORS.get(shape_type) |
|
|
|
|
| def get_pipeline(shape_type: str): |
| """Return the detect_page(bgr, tile_size, overlap, ocr_upscale) -> list[dict] function for shape_type, or None.""" |
| return PIPELINES.get(shape_type) |
|
|