Remove Noise merged each small component into its most common neighbour in one pass. When a speck was merged into a small region that was itself merged away later, the region's flood fill skipped the speck's pixels (already seen), so they stayed behind as a new island of the region's old label. Higher Noise values merge more regions, so they left more such islands: on noisy images the path count rose with Noise (70 -> 126 -> 206 paths from Noise 50 to 200 on one test image). denoise now repeats its pass until one changes nothing; each merge joins two components, so it ends (with a cap of 64 passes as a backstop). Labels shorter than w x h are left alone instead of indexed past their end. Tests: the minimal one-row case, a property test on random blocky noise (no mergeable region under the minimum is left, and a larger minimum never leaves more regions), and two noisy images whose path count must not rise with Noise (both fail without the fix). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| logo | ||
| centerline.rs | ||
| contour.rs | ||
| fit.rs | ||
| lib.rs | ||
| mosaic.rs | ||
| quantize.rs | ||
| tests.rs | ||