PANDORE Version 6 | GREYC-IMAGE |
ppowerlawtransform expands or compresses gray-levels of the input image using a power law transform of the gray-levels according to the value of the parameter gamma. Such transform often refers to the gamma correction.
The effect of the power-law transform is to map a narrow range of low gray-level values in the input image into a wider range of output levels when gamma < 1, and the opposite with gamma >1.
The power-law transform of pixel 'p' has the form:
im_out[p]=(c * (im_in[p]-smin)^gamma) + min; c=(max-min) / (smax-smin)
where smin and smax are the minimum and the maximum values of the input image, and c is a normalization factor for stretching output values between min and max.
For color and multispectral images, the transform uses the vectorial approach: the min and max values are calculed from all the bands, and then each band is stretched with the same transform.
gamma is a positive real value. It specifies the degree of transformation. Values < 1 compress low gray-levels while expand high gray-levels. Values >1 expand low gray-levels and compress high gray-levels. A value of gamma=1 leads to a linear transform. Typical values are 0.04, ... , 0.4, 1, 1.5, ... 25.0.
min and max specify the bounds of the output
pixel value. They are related to the type of the input image.
Note: if min < max then min and max are set with
the minimum and maximum values of the input image type:
for example, 0 and 255 for Uchar images.
Returns SUCCESS or FAILURE in case of invalid parameter values.
Applies a positive transform followed by a negative transform to create image b.pan. Because negative is the inverse transform of positive transform, b.pan is (almost) equal to tangram.pan (due to rounding error):
ppowerlawtransform 2 0 255 tangram.pan a.pan ppowerlawtransform 0.5 28 165 a.pan b.pan
Applies a logarithmic transform to create a.pan and uses the min and max values of the image type as new bounds:
ppowerlawtransform 0.4 1 -1 tangram.pan a.pan
Transformation des niveaux de gris par une loi de puissance.
Author: Régis Clouard