IImageOps
Description
- Extended by
Base interface that declares image operations that can be performed on IImage and IImageReader objects.
Image operations can be performed on IImage objects and IImageReader object.
Public / Methods
AlphaToCoverage
Converts the alpha channel (see PixelChannel.Alpha) of this image to a coverage layer (see PixelChannel.Void).
ChannelToIntensity
Returns an opaque grayscale image which pixel values are equal to the given pixel channel of this image.
Void pixels in this image will also be void in the resulting image.
- See also
Crop
Assumes the image holds a non-rectangular shape that is padded with a uniform color and replaces all padding pixels with void.
Since the source image is read scanline after scanline, cropping is performed locally for each scanline: Beginning at the left and right image borders, all pixels having the same color as the color opt parameter are replaced with void until a consecutive run of pixels having different colors is found (see skip opt). The following figures illustrates this: Pixels that have the same color as the color opt parameter are shown as '.'
characters, all others are indicated with X
:
+-----------------------------------------------------------------------+ |.......................................................................| |.......................................................................| |............................XXX........................................| |...........................XXXXX.......................................| |.........................XXXXXXX.......................................| |.......................XXXXXXXXX.......................................| |.....................XXXXXXXXXXX.......................................| |...................XXXXXXXXXXXXXX......................................| |.................XXXXXXXXXXXXXXXX......................................| |................XXXXXXXXXXXXXXXXX......................................| |...............XXXXXXXXXXXXXXXXXXX.....................................| |................XXXXXXXXXXXXXXXXXXX....................................| |.................XXXXXXXXXXXXXXXXXXXXX.................................| |...................XXXXXXXXXXXXXXXXXXXXXXX.....X.......................| |...............XXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXX.................| |..........XXXXXXXXXXXX.......XXXXXXXXXXXXXXXXXXXXXXXXXXX...............| |.............XXXXXXX..........XXXXXXXXXXXXXXXXXXXXXXXXXX...............| |...............XXX.............XXXXXXXXXXXXXXXXXXXXXXXX................| |................................XXXXXXXXXXXXXXXXXXXXX..................| |................................XXXXXXXXXXXXXXXXX......................| |...................................XXXXXXX.............................| |.......................................................................| |.......................................................................| |.......................................................................| |.......................................................................| +-----------------------------------------------------------------------+
The cropped image will look like this (whitespace represents void pixels):
+-----------------------------------------------------------------------+ | | | | | XXX | | XXXXX | | XXXXXXX | | XXXXXXXXX | | XXXXXXXXXXX | | XXXXXXXXXXXXXX | | XXXXXXXXXXXXXXXX | | XXXXXXXXXXXXXXXXX cropped because | | XXXXXXXXXXXXXXXXXXX of skipped pixels | | XXXXXXXXXXXXXXXXXXX | | | XXXXXXXXXXXXXXXXXXXXX V | | XXXXXXXXXXXXXXXXXXXXXXX | | XXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXX | | XXXXXXXXXXXX.......XXXXXXXXXXXXXXXXXXXXXXXXXXX | | XXXXXXX..........XXXXXXXXXXXXXXXXXXXXXXXXXX | | XXX.............XXXXXXXXXXXXXXXXXXXXXXXX | | ^ XXXXXXXXXXXXXXXXXXXXX | | | XXXXXXXXXXXXXXXXX | | not reachable XXXXXXX | | from left or | | right border | | | | | +-----------------------------------------------------------------------+
Cropping will not change the image size or modify the geo-reference.
Function
Transform linear pixel values using a custom function.
The given function is evaluated on linear pixel values, that is after raw pixels have been translated to normalized pixel values (see SetRange) and after gamma correction has been applied (see SetGamma). The expression may use all members of the default Tinman script (see ConfigScript.Tinman). The following arguments are available to the function expression:
-
raw
The input pixel value (raw). -
lin
The input pixel value (linear) in the range [0..1]. -
A, B, C, D, E, F
Coefficients that can be used to transform between raw and linear pixel values:lin = pow(raw * A + B, C) raw = pow(lin, D) * E + F D = 1 / C E = 1 / A F = -B / A
where
raw
is the raw pixel value that is actually stored in the source image (e.g. [0..255] for 8-bit images) andlin
is the linear pixel value that is stored in the image scanline buffer (see Scanline).A
andB
represent the transformation from raw pixel values to normalized pixel values (see SetRange);C
is the exponent that best approximates the performed gamma correction (see SetGamma).
IntensityToChannel
2 overloads
Returns an image that has a single pixel channel (see channel in parameter), initialized to the grayscale intensities of this image. All other pixel channels are initialized to their respective default values (see PixelChannel).
Void pixels in this image will also be void in the resulting image.
- See also
Replaces a pixel channel of the given image in with the grayscale intensities of this image.
Void pixels in the other image are ignored (i.e. the original pixel remains unchanged). Void pixels in this image are preserved (i.e. the other pixel is ignored).
- See also
Invert
Inverts the given pixel channel.
The PixelChannel.Void pixel channel cannot be inverted. The method will do nothing in this case.
Op
Combines this image (first
) with the given one (second
) using the specified color operation (see ColorOp).
Pad
Pads this image by adding pixels at the borders, using either regular or special padding.
Regular padding duplicates pixels at all four image borders. It can be used to reduce (but not eliminate) seams that will occur when tiled geodata is imported incrementally using on-the-fly projection. The correct solution would be to merge all geodata tiles into a dataset and then perform the projection on the whole geodata.
Special padding adds a new pixel column at the right border, using the pixels of the column at the left border. It can be used to restore the missing pixel column of a pixel-is-point grid that wraps around the X-axis.
SetCoverage
Updates the value of IImageInfo.Coverage, without modifying the image content.
To perform resampling between pixel-is-area and pixel-is point, use ToCoverage.
SetValues
Updates the value of IImageInfo.Values
Using this method does not modify the image data in any way. However, it may be used to avoid the additional pass over the image data when using ReadImageFlags.Range, if the calling code has up-front knowledge about the value range.