-
Notifications
You must be signed in to change notification settings - Fork 80
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
Optional gamma correction parameter #350
Open
biserhong
wants to merge
12
commits into
DHI:main
Choose a base branch
from
biserhong:optional-gamma-correction-param
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
eb5fe99
add gamma factor parameter
biserhong 501b742
gamma correction for both singleband and rgb
biserhong 4bcf79c
gamma_factor invalid values
biserhong 5bb6ccc
include singleband test
biserhong 2105538
add valid rgb gamma correction test
biserhong 873844a
test invalid gamma factor cases
biserhong f80789d
test singleband gamma correction
biserhong ec58a7d
test both gamma correction and stretch
biserhong 6efe415
use color-operations for gamma implementation and utils
biserhong 993ed66
use color_operations for custom color transforms
biserhong 21f2db2
remove gamma correction references
biserhong 4577289
color transform for singleband and rgb
biserhong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this assume a particular scaling already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, inputs have to be in the [0,1] range: https://github.com/vincentsarago/color-operations/?tab=readme-ov-file#color_operationsoperations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. It may be easier to apply stretching before color transform then. I.e., normalize to
[0,1]
usingstretch_range
and clamp spillover to0
/1
, then apply color transform, then convert touint8
. That way we don't rely on a transformation of the stretch range?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may not be a good idea since it would change the result.
The color stretch fills the [0, 1] range whereas the normalization
to_math_type
does is relative to the dtype range. So when you apply the color transform I think that would shift where values fall along the curve.This is what chatgpt said in the case of gamma correction:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but who says that the dtype range is appropriate? The user-provided stretch range is telling us how to map the values in the raster to a linear scale.
Summoning @vincentsarago in case you want to weigh in on the appropriate order of linear scaling (and clamping out of range values) vs. color correction :)