Repository navigation
Conversation
The continuous-tone check exempts a neutral or single-curve picture when sixteen colors leave at most a fifth of the error of eight. The exemption is for flat art of up to sixteen clean levels, where sixteen colors leave no error. A gray photo with 0 to 2 levels of noise measures 0.19, under the cutoff, so it was classed as flat art and traced without smoothing, while its color original and the same photo with more noise were smoothed. The cutoff is now a tenth (VectorCraft's own value). Clean gray, sepia, single-hue and duotone art of up to sixteen levels stays flat art. Docs: docs/target-app-parity.md.
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 23 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Color and Grayscale smooth a picture before tracing it when
quantize::continuous_tone(crates/trace/src/quantize/cut_edge.rs) classes it as continuous tone. A neutral or one-curve picture is exempt when sixteen colors leave at most a fifth of the error of eight colors. The exemption is for flat art of up to sixteen clean levels, where sixteen colors leave no error. A gray photo with little noise also falls under that cutoff, so it was classed as flat art and traced without smoothing, while its color original and the same photo with more noise were smoothed.continuous_toneapplies it. The doc comment states the new value.docs/target-app-parity.mdhas one line for it. Its three neighboring Image Trace lines (gray photos, tinted photos, flat art of 10 to 16 levels) now give the cutoff as a tenth.Measured on
mainwith the synthetic photo the trace tests use (photo_scene), as the ratio of the sixteen-color error to the eight-color error:mainEvery existing flat-art test that reaches the exemption measures 0.000, and no existing test changed.
This changes existing behavior: a neutral or one-curve picture whose ratio is between a tenth and a fifth now counts as continuous tone and is smoothed before tracing.
How it was tested
New test in
crates/trace/src/tests.rs, failing without the change:a_clean_gray_photo_is_continuous_tone_as_its_color_original_is: the synthetic photo with 0, 1, 2 and 3 levels of noise is continuous tone in color and in gray. Onmainit fails at "gray, noise 0".Focused checks on
3de44da. The branch is two commits onmainat676f052, which was the latestmainwhen this was opened. The second commit,04df80f, changes onlydocs/target-app-parity.md.cargo test -p vectorcraft-trace --lib: 340 passed, 1 ignored.cargo clippy -p vectorcraft-trace --all-targets -- -D warnings: passed.cargo check --workspace --tests: passed.cargo fmt --all -- --check: passed.cargo xtask ciruns in this pull request's CI.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm).unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!outside tests, and no unchecked indexing on data from files, parameters ormessages. Errors are returned as
Resultand shown to the user(why and how).
ASSETS.md.