Vector Operations
Extracting 1-dimensional data from an image generates linear sets of data that are handled as vectors. Subsequent operations are fast because of the reduced amount of data. The methods are either:
Projects the sum or average of all gray color-level values in a given direction, into various vector types (levels are added when projecting into an EBW32Vector and averaged when projecting into an EBW8Vector, EBW16Vector or EC24Vector). These functions support flexible mask.
- EasyImage::.ProjectOnAColumn projects an image horizontally onto a column.
- EasyImage::.ProjectOnARow projects an image vertically onto a row.
Samples a series of pixel values along a given segment, path or contour, then analyze and modify their Peaks and Transitions to make images clearer:
-
Obtain the profile of a line segment / path / contour.
EasyImage::.ImageToLineSegment copies the pixel values along a given line segment (arbitrarily oriented) to a vector. The line segment must be entirely contained within the image. The vector length is adjusted automatically. This function supports flexible mask.
EasyImage::.ImageToPath copies the corresponding pixel values to the vector. The function supports flexible mask. A path is a series of pixel coordinates stored in a vector.
EasyImage::.Contour follows the contour of an object, and stores its constituent pixels values inside a profile vector. A contour is a closed or not (connected) path, forming the boundary of an object.
-
Analyse the profile to find peaks or transitions.
EasyImage::.GetProfilePeaks detects max and min peaks in a gray-level profile. To eliminate false peaks due to noise, two selection criteria are used. The result is stored in a peaks vector.
A peak is a maximum or minimum of the signal which may correspond to the crossing of a white or black line or thin feature. It is defined by its:- Amplitude: difference between the threshold value and the max [or min] signal value.
- Area: surface between the signal curve and the horizontal line at the given threshold.
A transition corresponds to an object edge (black to white, or white to black). It can be detected by taking the first derivative of the signal and looking for peaks in it.
EasyImage::.ProfileDerivative computes the first derivative of a profile extracted from a gray-level image. This derivative transforms transitions (edges) into peaks.
EBW8 data type only handles unsigned values, so the derivative is shifted up by 128. Values under 128 correspond to negative derivative (decreasing slope), values above 128 correspond to positive derivative (increasing slope). -
Insert the profile into an image.
EasyImage::.LineSegmentToImage copies the pixel values from a vector or a constant to the pixels of a given line segment (arbitrarily oriented). The line segment must be wholly contained within the image.
EasyImage::.PathToImage copies pixel values from a vector or a constant to the pixels of a given path.