Prima::IPA::Global - methods that produce images where every pixel is a function of all pixels in the source image
Contains methods that produce images, where every pixel is a function of all pixels in the source image. The process can be described with the mapping function
s = M(R)
where s is the pixel value in the output images, and R is the source image.
s
Closes edges of shapes on IMAGE, according to specified gradient image. The unclosed shapes converted to the closed if the gradient spot between the suspected dents falls under maxlen maximal length increment, mingradient the minimal gradient value and the edge is longer than minedgelen.
gradient
maxlen
mingradient
minedgelen
Supported types: Byte
Parameters:
Specifies the gradient image
Maximal edge length
Minimal edge length
Minimal gradient value
Fills closed shapes to eliminate the contours with holes in IMAGE.
If true, the original image is changed
The edge breadth that is not touched by the algorithm
The pixel value used for determination whether a pixel belongs to the background.
The pixel value used for hole filling.
Must be either 4 or 8. Selects whether the algorithm must assume 4- or 8- pixel connection.
Identifies the objects on IMAGE and filters out these that have their area less than minArea and more than maxArea. The other parameters are identical to those passed to fill_holes.
minArea
maxArea
Identifies the objects on IMAGE and returns the contours as array of anonymous arrays of 4- or 8- connected pixel coordinates.
The parameters are identical to those passed to fill_holes.
See also Prima::IPA::Region.
Same as identify_contours but returns a set of scan lines.
identify_contours
Returns coordinates of all pixels that match (if eq is 1) or not match (eq is 0) color match.
eq
match
Performs direct and inverse ( governed by inverse boolean flag ) fast Fourier transform. IMAGE must have dimensions of power of 2. The resulted image is always of DComplex type.
inverse
Supported types: all
Performs direct and inverse ( governed by inverse boolean flag ) fast Fourier transform. If IMAGE dimensions not of power of 2, then IMAGE is scaled up to the closest power of 2, and the result is scaled back to the original dimensions.
The resulted image is always of DComplex type.
Performs band filtering of IMAGE in frequency domain. IMAGE must have dimensions of power of 2. The resulted image is always of DComplex type.
Boolean flag, indicates whether the low-pass or the high-pass is to be performed.
Boolean flag, indicates if IMAGE must be treated as if it is in the spatial domain, and therefore conversion to the frequency domain must be performed first.
Boolean flag, indicates if the homomorph ( exponential ) equalization must be performed. Cannot be set to true if the image is in frequency domain ( if spatial parameter set to true ).
spatial
Power operator applied to the input frequency.
Threshold value of the filter.
Multiplication factor used in homomorph equalization.
Performs band filtering of IMAGE in frequency domain. If IMAGE dimensions not of power of 2, then IMAGE is scaled up to the closest power of 2, and the result is scaled back to the original dimensions.
The parameters are same as those passed to band_filter.
Realizes Hough transform. If type is "line", linear transform is performed. With direct transform, resolution is width of the resulted image.
resolution
Note: Returns a 8-bit grayscale image, which means that for all practical purposes the image shouldn't possibly contain more than 256 line candidates.
Takes a Hough-transformed image, where each pixel is a line. For each non-zero pixel a line projection on a rectangle with given width and height is calculated. Returns array of quad values in format [x0,y0,x1,y2] where the coordinates stand for the start and the end of a line.
So, if the direct transform was called as
$h = hough( $i );
then plotting lines back (after $h was filtered) would be
$i-> line(@$_) for @{ hough2lines( $h, width => $i-> width, height => $i-> height ) };
Supported types: 8-bit (expects result from hough function).
hough
The following functions can draw lines on images, and are optimized for speed, because Prima doesn't support drawing on images outside begin_paint/end_paint scope.
begin_paint
end_paint
Fill the given rectangular area with COLOR.
Draws set of horizontal lines as defined by LINES with COLOR. LINES is an array of triplet integers, where each contains [X1, X2, Y] coordinates - beginning of hline, end of hline, and vline.
Draws a single line from X1,Y1 to X2,Y2 .
To install Prima::IPA, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Prima::IPA
CPAN shell
perl -MCPAN -e shell install Prima::IPA
For more information on module installation, please visit the detailed CPAN module installation guide.