Skip to content

Normalize color band #250

Answered by jcupitt
mtiessen1175 asked this question in Q&A
Nov 4, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hello @mtiessen1175,

Do you have a sample image you could share?

If you want to find the min and exclude -99999, it's probably easiest to set the -99999s to 0 (or some very high value?) before searching for min. Perhaps (untested):

$min = $image->equal(-99999)->ifthenelse(0, $image)->min();

You can speed it up with stats(). This will make a single pass over the image and find max and min together.

You could also call linear() directly. This computes y = a * x + b, so you can replace your -, /, * with a single call.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mtiessen1175
Comment options

Answer selected by mtiessen1175
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants