Author image Dmitry Karasik


Prima::IPA::Point - single pixel transformations and image arithmetic


Single-pixel processing is a simple method of image enhancement. This technique determines a pixel value in the enhanced image dependent only on the value of the corresponding pixel in the input image. The process can be described with the mapping function

   s = M(r)

where r and s are the pixel values in the input and output images, respectively.

combine [ images, conversionType = conversionScale, combineType = combineSum, rawOutput = 0]

Combines set of images of same dimension and bit depth into one and returns the resulting image.

Supported types: Byte, Short, Long.


images ARRAY

Array of image objects.

conversionType INTEGER

An integer constant, one of the following, that indicates how the resulting image would be adjusted in accord to the minimal and maximal values of the result. Trunc constants cut off the output values to the bit maximum, for example, a result vector in 8-bit image [-5,0,100,300] would be transformed to [0,0,100,255]. Scale constants scale the whole image without the cutoff; the previous example vector would be transformed into [0,4,88,255]. The Abs suffix shows whether the range calculation would use the whole domain, including the negative values, or the absolute values only.


Default is conversionScale.

combineType INTEGER

An integer constant, indicates the type of action performed between pixels of same [x,y] coordinates.

   combineMaxAbs          - store the maximal absolute pixel value
   combineSignedMaxAbs    - compute the maximal absolute value, but store its original ( before abs()) value
   combineSumAbs          - store the sum of absolute pixel values
   combineSum             - store the sum of pixel values
   combineSqrt            - store the square root of the sum of the squares of the pixel values

Default is combineSum.

rawOutput BOOLEAN

Discards conversionType parameter and performs no conversion. If set to true value, the conversion step is omitted.

Default is 0.

threshold IMAGE [ minvalue, maxvalue = 255]

Performs the binary thresholding, governed by minvalue and maxvalue. The pixels, that are below minvalue and above maxvalue, are mapped to value 0; the other values mapped to 255.

Supported types: Byte

gamma IMAGE [ origGamma = 1, destGamma = 1]

Performs gamma correction of IMAGE by a product of origGamma and destGamma.

Supported types: Byte

remap IMAGE [ lookup ]

Performs image mapping by a passed lookup array of 256 integer values. Example:

   Prima::IPA::Point::remap( $i, lookup => [ (0) x 128, (255) x 127]);

is an equivalent of

   Prima::IPA::Point::threshold( $i, minvalue => 128);

Supported types: 8-bit

subtract IMAGE1, IMAGE2, [ conversionType = conversionScale, rawOutput = 0]

Subtracts IMAGE2 from IMAGE1. The images must be of same dimension. For description of conversionType and rawOutput see combine.

Supported types: Byte

mask IMAGE [ test, match, mismatch ]

Test every pixel of IMAGE whether it equals to test, and assigns the resulting pixel with either match or mismatch value. All test, match, and mismatch scalars can be either integers ( in which case mask operator is similar to threshold ), or image objects. If the image objects passed, they must be of the same dimensions and bit depth as IMAGE.

Supported types: Byte, Short, Long.

average LIST

Combines images of same dimensions and bit depths, passed as an anonymous array in LIST and returns the average image.

Supported types: Byte, Short, Long, 64-bit integer.

equalize IMAGE

Returns a histogram-equalized image.

Supported types: Byte

ab IMAGE, a, b

Returns IMAGE*a+b.


Retuns exp(IMAGE)


Retuns log(IMAGE)