The argument X
may be a vector, matrix,
array, or a pixel image (object of class "im"
).
The algorithm will first extract the entries or pixel values of
X
as a vector, and sort the values into ascending order.
If uniform=TRUE
, the entries in this vector will be replaced by the
corresponding cumulative probabilities (the k
th
smallest value will be replaced by the
number (k-0.5)/n
where n
is the total number of values).
If reverse=TRUE
, the resulting vector will be reversed
so that it is in descending order (so that the k
th smallest
value will be swapped with the k
th largest value).
Finally the transformed values will be replaced into the original
positions in the vector, matrix, array, or pixel image.
The case uniform=TRUE, reverse=FALSE
is called
transformation to uniformity, the
probability integral transformation,
histogram equalisation, or quantile transformation.
The resulting values are uniformly distributed between 0 and 1;
a histogram of the values in X
is flat.