Channels are the core of all processing done on the images in this package. They are part of the images, but also can act as independent entities. All available image processes can be applied to the entire image or a specific channel in the image. In fact, some features are only available (at present) for channels and not for images.
There is a set of classes to define and manipulate channels. TfiChannel is the abstract base class that defines the main methods and properties of channels. A channel contains a two-dimensional array of the type defined by the depth of channel. The property Map returns a reference to this array. You can also obtain a reference to a single line by the Row property.
TfiChannel8U : 8 bits channel (unsigned) TfiChannel16S: 16 bits channel (signed) TfiChannel32F: 32 bits channel (float)
Channels are designed primarily for use by the main class TFastImageEx, but can be manipulated independently. TFastImageEx can create the channels needed for the images, and eventually also create channels to store processes results. But in some cases can be useful to create channels out of images. So far, there are two ways to directly build channels out of images: the default constructor or copy constructor listed below.
constructor Create(fSize: TfiSize);
Constructs an empty channel with the dimensions indicated by fSize.
constructor Create(Channel: TfiChannel);
Copy constructor. The parameter Channel must be the same type of class of channel that is being constructed.
procedure Assign(Channel: TfiChannel);
Copy the channel informed. This procedure can change the channel dimensions to match with channel on parameter. The channel informed must be the same type.
procedure FillRow(index: integer; const value: single); procedure FillCol(index: integer; const value: single); procedure FillMap(const value: single); procedure FillRect(const value; Rt: TRect: single);
Fill row, column, entire map or rectangle with the value informed. Value must be in the range type of channel map. FillRect do not perform any range check.
procedure CopyRectTo(RtSrc: TRect; Dest: TfiChannel; x: integer=0; y: integer=0);
Copy a rectangle to an informed destination channel, starting at (x, y) position. Dest channel must be the same type of source channel. No range check is performed.
procedure MinMaxVals(out MinVal: single; out MaxVal: single);
Return then minimum and maximum values on channel.
property Row[index: integer]: PRow; property Map: PMap;
Return a reference to row or map. These properties are overridden to return the appropriate type depending of channel depth.
property Width: integer; property Height: integer; property Depth: integer; property iSize: TfiSize; property SizeAsRect: TRect;
Read only properties. Depth returns one of constants listed above on Channel maps topic. iSize return the size of channel and SizeAsRect return a TRect with channel dimensions.
Binary channels
For this implementation, is not defined any specific binary channel (1 bit depth), however any of the three defined types can be treated as a binary channel. Some processes only exists or only makes sense if applied to binary data. In this case, the general rule used by the package is considered the zero value as zero (!) and any value other than zero as one. Some other processes can be applied both to binary data and 8 or more bits data. For these processes will need to specify how they should work.
Most processes available for the images are actually implemented in channel’s classes. The class that manages the images (TFastImageEx) uses these implementations to provide access to these processes.
Use the images to run processes offers more options related to input and output. For example, from an image is possible to create new channels to store the process results, or select all the channels of image as input to process. But the process itself, with all options related to its operation mode, can be accessed directly from a channel. Below, the list of processes available form channels. To complete discussion about the processes and the parameters used, look the related topic on TFastImageEx reference (chapter 8).
Threshold
procedure Threshold(cDest: TfiChannel; ThreshType: integer; Thresh, MaxValue: single);
Convert
procedure Convert(cDest: TfiChannel; ScalingMode: integer; Param1: single=0; Param2: single=0);
BinaryInv
procedure BinaryInv(cDest: TfiChannel; MaxValue: single);
Arithmetic
procedure Arithmetic(cOper, cDest: TfiChannel; Operation: integer; Param1: single=1; Param2: single=1);
Convolution
procedure Convolve(cDst: TfiChannel; Mask: TfiGrayMask);
Match
procedure Match(cDst: TfiChannel; Operation: integer; Mask: TfiGrayMask; ValIfMatch, ValNoMatch: integer);
Erode
procedure Erode(cDst: tfiChannel; Iterations: integer; bMask: TfiBinMask; Binary: boolean);
Dilate
procedure Dilate(cDst: tfiChannel; Iterations: integer; bMask: TfiBinMask; Binary: boolean);
Morphology
procedure Morphology(cDst: tfiChannel; Operation, Iterations: integer; bMask: TfiBinMask; Binary: boolean);