You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current implementation of the Geotrellis Sigmoidal contrast, the following formula is used to calculate the contrast for a given raster value (source) :
val numer = 1/(1+math.exp(beta*(alpha-u))) - 1/(1+math.exp(beta))
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))
When you look at the sigmoidal contrast formula that is defined by ImageMagick, we get the following equation:
As you can see, the numer part of the original equation is missing a multiplication by alpha in its second diff term.The correct calculation of the numer part should be:
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))
Screenshots
The first screenshot shows the original equation, the second one the updated formula as defined by ImageMagick. As you can see, when applying a lower contrast value of beta, the higher values of the rasters will be cut off. This behaviour is less apparent when using higher beta values. However the consequence is that it makes the sigmoidal contrast function very unpredictable.
The text was updated successfully, but these errors were encountered:
JanssenBrm
added a commit
to JanssenBrm/geotrellis
that referenced
this issue
Dec 22, 2020
Describe the bug
In the current implementation of the Geotrellis Sigmoidal contrast, the following formula is used to calculate the contrast for a given raster value (source) :
When you look at the sigmoidal contrast formula that is defined by ImageMagick, we get the following equation:
( 1/(1+exp(β*(α-u))) - 1/(1+exp(β*(α)) ) / ( 1/(1+exp(β*(α-1))) - 1/(1+exp(β*α)) )
As you can see, the numer part of the original equation is missing a multiplication by alpha in its second diff term.The correct calculation of the numer part should be:
Screenshots
The first screenshot shows the original equation, the second one the updated formula as defined by ImageMagick. As you can see, when applying a lower contrast value of beta, the higher values of the rasters will be cut off. This behaviour is less apparent when using higher beta values. However the consequence is that it makes the sigmoidal contrast function very unpredictable.
The text was updated successfully, but these errors were encountered: