Closed ripytide closed 3 months ago
It looks like you’re missing the change to actually use range
in normalise_linear
.
Range
is a bit of a confusing name here as users will think of the standard library’s Range types. Maybe MinMax
?
The existing stretch_contrast
and the new normalize_linear
are both special cases of a function that specifies both the desired input and output ranges so I’d like them to be unified rather than adding a similar-but-different parallel implementation.
Thanks for the work reviewing and updating old PRs :-)
I didn't see stretch_contrast()
but you're right it's very similar. I've combined both normalize_linear()
and stretch_contrast()
into scale_linear()
which takes both the input_min/max and output_min/max which should allow the user to easily accomplish either goal.
range()
and Range
have been renamed to minmax()
and MinMax
to prevent confusion with std
range types as suggested.
I've also removed normalize_nonlinear()
as it used f64
and was quite complicated and I don't think many users are likely to use it so it is best left up to the users that do want it to implement themselves.
Can I ask why the unused_imports
lint is allowed? I likely would have caught them before committing had the compiler told me they existed.
Good question. It was added in https://github.com/image-rs/imageproc/pull/549 and I didn’t spot it at the time. cc @cospectrum
Thanks!
Good question. It was added in #549 and I didn’t spot it at the time. cc @cospectrum
Because there are many places with unused imports, and it will take a lot of time to remove them away
Seems easy enough to fix - I'll create a PR to remove them.
I'm working through testing/reviewing all the PRs currently.
This PR is a rebase+refactor of #471. #471 seems like a fairly standard and objective image processing function. I've refactored it to use
map()
as well as adding arange()
function to thestats.rs
module which is used innormalize_linear()
.I also refactored the tests and added benches for the new normalize functions.
Merging this would close #471 and #470.