Vector Operations¶
Extracting 1-dimensional data from an image generates linear sets of data that are handled as vectors. Subsequent operations are fast thanks to the reduced amount of data. Extraction methods are:
Projection¶
Example of a projection on a column. Notice the peaks allowing to detect characters.¶
Projects the sum or average of all gray color-level values in a given direction, into various vector types:
Pixel values are summed when projecting into an
EBW32Vector.NET Python.Pixel values are averaged when projecting into an
EBW8Vector.NET Python,EBW16Vector.NET Python orEC24Vector.NET Python.
Two projections direction are supported:
EasyImage::ProjectOnAColumn.NET Python projects an image horizontally onto a column.EasyImage::ProjectOnARow.NET Python projects an image vertically onto a row.
Profile¶
Example of a profile alongside an arbitrarily oriented line segment.¶
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.NET Python 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.EasyImage::ImageToPath.NET Python copies the corresponding pixel values to the vector. Apath(EPathVector.NET Python) is a series ofpixel coordinates(EPath.NET Python) stored in a vector.EasyImage::Contour.NET Python 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.
Analyze the profile to find peaks or transitions
EasyImage::GetProfilePeaks.NET Python 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 apeaks vector(EPeakVector.NET Python). Apeak(EPeak.NET Python) 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:EPeak::Amplitude.NET Python: difference between the threshold value and the max [or min] signal value.EasyImage::Area.NET Python: 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.NET Python computes the first derivative of a profile extracted from a gray-level image. This derivative transforms transitions (edges) into peaks.EBW8.NET Python 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.NET Python 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.NET Python copies pixel values from a vector or a constant to the pixels of a given path.
See Also¶
Easy to understand, ready to copy code snippets.