Skip to content

Add Canny magnitude ring - #48

Merged
rsasaki0109 merged 1 commit into
mainfrom
agent/canny-ring-buffer
Jul 15, 2026
Merged

Add Canny magnitude ring#48
rsasaki0109 merged 1 commit into
mainfrom
agent/canny-ring-buffer

Conversation

@rsasaki0109

Copy link
Copy Markdown
Owner

What changed

  • replace the full-frame Canny comparison-magnitude buffer with three rows per worker
  • preserve parallel row-stripe NMS and exact hysteresis
  • skip hysteresis traversal when classification finds no weak edges
  • expose reusable workspace allocated bytes in Rust/Python and focused receipts
  • update README and GitHub Pages results

Why

The remaining full i32 magnitude image consumed 31.6 MiB at 4K and added avoidable memory traffic. High-contrast inputs also paid for graph traversal even when every retained edge was already strong.

Impact

The fast path stays bit-exact with OpenCV across 300 randomized cases. Native 4K document lines improve from 96.914 ms with inspectable intermediates to 8.134 ms with ring reuse (11.92×). Python reuse measures 8.103 ms versus OpenCV 11.480 ms (SpatialRust 1.42×); 1080p is 1.36× faster. Dense sensor noise remains an OpenCV win and is documented as such.

Validation

  • cargo test -p spatialrust-vision --features imgproc-canny (26 passed)
  • targeted Clippy with -D warnings
  • Python crate check and Canny binding tests (2 passed)
  • focused OpenCV 4.13 harness, 300 randomized bit-exact cases
  • Criterion 4K document-line receipt

@rsasaki0109
rsasaki0109 marked this pull request as ready for review July 15, 2026 23:50
@rsasaki0109
rsasaki0109 merged commit ded2f5e into main Jul 15, 2026
86 of 92 checks passed
@rsasaki0109
rsasaki0109 deleted the agent/canny-ring-buffer branch July 15, 2026 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant