feat(imgproc): no_std support for the imgproc module (Phase 2) - #88
Merged
Conversation
Un-gates `imgproc` (and its prelude re-exports) for no_std builds; the module now compiles with only core + alloc. Refs #84 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Converts std:: paths to their core:: equivalents and adds alloc imports (vec/Vec/format/ToString) plus num_traits::Float where concrete f32/f64 math is used, so scalar fallbacks build without std. No behavior change. Refs #84 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Makes the
imgprocmodule compile underno_std + allocwith--no-default-features, using scalar fallbacks (parallel & SIMD disabled). Second step of #82, building on Phase 1 (#83).imgprocis un-gated inlib.rsand now builds with onlycore+alloc. The change is almost entirely mechanical:std::paths → theircore::equivalents (any::TypeId,iter::Sum,slice::from_raw_parts,f64::consts::PI,cmp::Ordering,cmp::Reverse)alloc::{vec, vec::Vec, format, string::ToString}imports where usedf32/f64math (sqrt,floor,round,exp,atan2, …) resolves throughnum_traits::Float(libm) in no_std builds, same pattern as corehough_lines_p(probabilistic Hough) is gated behindstd: it shuffles edge points with the thread-local RNG (rand_shuffle), which stays std-only until a no_std seedable RNG lands (a Phase-1 follow-up, see Feature request: no-std support so purecv can run on microcontrollers such a esp32 #82). The deterministichough_linesremains available on no_std.Rayon (
parallel) andpulp(simd) were already feature-gated and both implystdsince Phase 1, so they compile out on bare metal with no further work — the scalar path is the sequential branch that was always there.The
crates/no-std-smokeconsumer now also exercisesgaussian_blur, and the CIno_std Buildjob (already building--no-default-featuresforthumbv7em-none-eabihf) now covers imgproc too.Verified: 308 lib + 40 doctests pass with default features; clippy/fmt clean on no-default / default / simd+parallel; builds for
thumbv7em-none-eabihf; and the ESP32-S3 example runs correctly on real hardware against this tree.Out of scope (Phase 3, #85): video and calib3d.
Closes #84
Refs #82
🤖 Generated with Claude Code