Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sigmoidal contrast calculation #3328

Merged
merged 1 commit into from
Dec 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Remove explicit unused Scaffeine dependency from projects [#3314](https://github.com/locationtech/geotrellis/pull/3314)
- Remove an excessive close after the abort call in S3RangeReader [#3324](https://github.com/locationtech/geotrellis/pull/3324)
- Fix sigmoidal contrast calculation [#3328](https://github.com/locationtech/geotrellis/pull/3328)

## [3.5.1] - 2020-11-23

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ object SigmoidalContrast {
(intensity + (1<<(bits-1))) / ((1<<bits)-1)
}

val numer = 1/(1+math.exp(beta*(alpha-u))) - 1/(1+math.exp(beta))
// see https://legacy.imagemagick.org/Usage/color_mods/#sigmoidal
// and https://github.com/locationtech/geotrellis/issues/3326
val numer = 1/(1+math.exp(beta*(alpha-u))) - 1/(1+math.exp(beta*alpha))
val denom = 1/(1+math.exp(beta*(alpha-1))) - 1/(1+math.exp(beta*alpha))
val gu = math.max(0.0, math.min(1.0, numer / denom))

Expand Down