How error273/box-measurer works
Box Measurer turns one photograph into physical length and width estimates, using a known-size ArUco marker for scale and SAM 2.1 for the box outline. Users can run the same measurement workflow through CLI or HTTP; both produce quality metrics and optional annotated output. The graph follows documented stages and sampled wiring. Some domain and CLI/API internals were not excerpted, so uncertain implementation links are omitted; README-documented capabilities remain represented.
Main entry points: measure_box.py Measure box · main.py CLI commands · bootstrap.py Pipeline assembly · segment_box.py Segment box
Components 20
User interfaces
- CLI commands
src/box_measurer/cli/main.py - FastAPI endpoints
src/box_measurer/api/app.py - API service
src/box_measurer/api/service.py
Measurement workflow
- Measure box
src/box_measurer/application/measure_box.py - Inspect image
src/box_measurer/application/inspect_image.py - Detect marker
src/box_measurer/application/detect_marker.py - Map plane
src/box_measurer/application/map_plane.py - Segment box
src/box_measurer/application/segment_box.py
Vision adapters
- Safe image reader
src/box_measurer/adapters/image_reader.py - OpenCV image adapter
src/box_measurer/adapters/cv_image.py - SAM 2.1 segmenter
src/box_measurer/adapters/sam2_segmentation.py
Geometry and quality
- ArUco detection
src/box_measurer/domain/marker.py - Plane homography
src/box_measurer/domain/plane.py - Color segmentation
src/box_measurer/domain/segmentation.py - Dimension estimation
src/box_measurer/domain/measurement.py - Quality assessment
src/box_measurer/domain/quality.py
Runtime setup
- Application config
src/box_measurer/config.py - Pipeline assembly
src/box_measurer/bootstrap.py - Dataset manifest
src/box_measurer/dataset.py
Other components
- Image user
Connections 29
- Image user → CLI commands: runs command
README.md - Image user → FastAPI endpoints: uploads photo
README.md - CLI commands → Measure box: runs measurement
src/box_measurer/cli/main.py - FastAPI endpoints → API service: routes request
src/box_measurer/api/app.py - FastAPI endpoints → Pipeline assembly: builds pipeline
src/box_measurer/api/app.py - API service → Measure box: calls scenario
src/box_measurer/api/service.py - CLI commands → Inspect image: runs inspection
src/box_measurer/cli/main.py - CLI commands → Detect marker: runs detection
src/box_measurer/cli/main.py - CLI commands → Map plane: runs plane mapping
src/box_measurer/cli/main.py - CLI commands → Segment box: runs segmentation
README.md - Pipeline assembly → Measure box: assembles
src/box_measurer/bootstrap.py - Pipeline assembly → Segment box: assembles
src/box_measurer/bootstrap.py - Measure box → OpenCV image adapter: reads image
src/box_measurer/bootstrap.py - OpenCV image adapter → Safe image reader: checks metadata
src/box_measurer/adapters/cv_image.py - Measure box → ArUco detection: detects marker
src/box_measurer/bootstrap.py - Measure box → Quality assessment: validates and scores
src/box_measurer/bootstrap.py - Measure box → SAM 2.1 segmenter: locates box
src/box_measurer/bootstrap.py - Measure box → Dimension estimation: estimates dimensions
src/box_measurer/bootstrap.py - ArUco detection → Plane homography: sets reference scale
README.md - Measure box → Plane homography: maps corners
README.md - SAM 2.1 segmenter → Color segmentation: uses color hint
src/box_measurer/bootstrap.py - Segment box → ArUco detection: detects reference
src/box_measurer/application/segment_box.py - Segment box → SAM 2.1 segmenter: locates mask
src/box_measurer/bootstrap.py - Detect marker → ArUco detection: detects marker
src/box_measurer/application/detect_marker.py - Map plane → Detect marker: gets observation
src/box_measurer/application/map_plane.py - Map plane → Plane homography: maps reference
src/box_measurer/application/map_plane.py - Inspect image → Safe image reader: reads image info
- Measure box → OpenCV image adapter: writes debug image
src/box_measurer/bootstrap.py - Pipeline assembly → Application config: uses settings
src/box_measurer/bootstrap.py