- Home
- Installation
- Using Livekeys
- Plugins
- Developer
Plugin lcvimgproc
This module contains elements for image processing. It resembles open cv's imgproc module.
import lcvimgproc 1.0
Summary
Type PanAndZoom | UI component to perform panning and zooming on a given Mat object. |
Type Blur | Blurs an image using the normalized box filter. |
Type Canny | Finds edges within an image. |
Type GaussianBlur | Blurs an image using a Gaussian filter. |
Type HoughLinesP | Finds line segments in a binary image using the probabilistic Hough transform. |
Type HoughLines | Finds line segments in a binary image using the Hough transform. |
Type Sobel | Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. |
Type CvtColor | Converts an image from one color space to another. |
Type Threshold | Applies a fixed-level threshold to each element. |
Type ChannelSelect | Selects an image channel by its index. |
Type StructuringElement | Creates a structuring element of the specified size and shape for morphological operations. |
Type Resize | Resizes an image. |
Type Filter2D | Converts an image with the specified kernel. |
Type Dilate | Erodes an image by using a specific structuring element. |
Type Erode | Dilates an image by using a specific structuring element. |
Type CopyMakeBorder | Copies the source image into the middle of the destination image. |
Type Draw | Draws an ellipse. |
Type GetPerspectiveTransform | Calculates a perspective transform from four pairs of the corresponding points. |
Type warpPerspective | Applies a perspective transformation to an image. |
Type QCachedWarpPerspective | Applies a perspective transformation to an image. |
PanAndZoom
type
Inherits | MatFilter |
Property | Mat input |
Property | int regionWidth |
Property | int regionWidth |
Property | int regionX |
Property | int regionY |
Property | color SelectionColor |
UI component to perform panning and zooming on a given Mat object.
Mat input
property
input matrix to perform PanAndZoom on
int regionWidth
property
width of the region to select out of the matrix
int regionWidth
property
height of the region to select out of the matrix
int regionX
property
x coordinate to start the selection from
int regionY
property
y coordinate to start the selection from
color SelectionColor
property
color for selection rectangle
Blur
type
Inherits | MatFilter |
Property | Size ksize |
Property | Point anchor |
Property | int borderType |
Blurs an image using the normalized box filter.
The function smoothes an image using the normalized box filter.
quotefile imgproc/blur.qml
Size ksize
property
Blurring kernel size.
Point anchor
property
Anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.
int borderType
property
Border mode used to extrapolate pixels outside of the image.
See also CopyMakeBorder::BorderType
Canny
type
Inherits | MatFilter |
Property | int threshold1 |
Property | Size threshold2 |
Property | Size apertureSize |
Property | Size l2gradient |
Finds edges within an image.
Canny finds edges in the input image image and marks them in the output map edges using the Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The largest value is used to find initial segments of strong edges
quotefile imgproc/canny.qml
int threshold1
property
First threshold for the hysteresis procedure.
Size threshold2
property
Second threshold for the hysteresis procedure.
Size apertureSize
property
Aperture size for the Sobel() operator.
Size l2gradient
property
A flag indicating whether a more accurate L2 norm should be used to calculate the image gradient magnitude.
GaussianBlur
type
Inherits | MatFilter |
Property | size ksize |
Property | real sigmaX |
Property | real sigmaY |
Property | int borderType |
Blurs an image using a Gaussian filter.
imgproc/gaussianblur.qml
size ksize
property
Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. Or, they can be zero’s and then they are computed from sigma.
real sigmaX
property
Gaussian kernel standard deviation in X direction.
real sigmaY
property
Gaussian kernel standard deviation in Y direction.
int borderType
property
Pixel extrapolation method (see CopyMakeBorder::BorderType for details).
HoughLinesP
type
Inherits | MatFilter |
Property | real rho |
Property | real theta |
Property | int threshold |
Property | real minLineLength |
Property | real maxLineGap |
Property | color lineColor |
Property | int lineThickness |
Finds line segments in a binary image using the probabilistic Hough transform.
imgproc/houghlinesp.qml
real rho
property
Distance resolution of the accumulator in pixels.
real theta
property
Angle resolution of the accumulator in radians.
int threshold
property
Accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold ).
real minLineLength
property
Minimum line length. Line segments shorter than that are rejected.
real maxLineGap
property
Maximum allowed gap between points on the same line to link them.
color lineColor
property
Color of the lines being drawn.
int lineThickness
property
Thickness of the lines being drawn.
HoughLines
type
Inherits | MatFilter |
Property | int threshold |
Property | real srn |
Property | real stn |
Property | color lineColor |
Property | int lineThickness |
Finds line segments in a binary image using the Hough transform.
imgproc/houghlines.qml
Distance resolution of the accumulator in pixels.
Angle resolution of the accumulator in radians.
int threshold
property
Accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold ).
real srn
property
For the multi-scale Hough transform, it is a divisor for the distance resolution rho . The coarse accumulator distance resolution is rho and the accurate accumulator resolution is rho/srn . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these parameters should be positive.
real stn
property
For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
color lineColor
property
Color of the lines being drawn.
int lineThickness
property
Thickness of the lines being drawn.
Sobel
type
Inherits | MatFilter |
Property | Mat Type ddepth |
Property | int xorder |
Property | int yorder |
Property | int ksize |
Property | real scale |
Property | real delta |
Property | real borderType |
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
imgproc/sobeloperator.qml
Mat Type ddepth
property
Output image depth, the following combinations of input depth and ddepth are supproted:
input.depth = Mat.CV8U, ddepth = -1 / Mat.CV16S / Mat.CV32F / Mat.CV64F
input.depth = Mat.CV16U / Mat.CV16S, ddepth = -1 / Mat.CV32F / Mat.CV64F
input.depth = Mat.CV32F, ddepth = -1 / Mat.CV32F / Mat.CV64F
input.depth = Mat.64F, ddepth = -1 / Mat.CV64F
When ddepth = -1, the destination image will have the same depth as the source. In case of 8-bit input images, it will result in truncated derivatives.
int xorder
property
Order of the derivative in x.
int yorder
property
Order of the derivative in y.
int ksize
property
Size of the extended Sobel kernel; ( must be 1, 3, 5, 7 )
real scale
property
Optional scale factor for the computed derivative values; by default, no scaling is applied.
real delta
property
Optional delta value that is added to the results prior to storing them in output.
real borderType
property
Pixel extrapolation method.
See also CopyMakeBorder::BorderType
CvtColor
type
Inherits | MatFilter |
Property | enumeration CvtType |
Property | CvtType code |
Property | int dstCn |
Converts an image from one color space to another.
imgproc/threshold.qml
enumeration CvtType
property
Conversion method:
CV_BGR2BGRA
CV_RGB2RGBA
CV_BGRA2BGR
CV_RGBA2RGB
CV_BGR2RGBA
CV_RGB2BGRA
CV_RGBA2BGR
CV_BGRA2RGB
CV_BGR2RGB
CV_RGB2BGR
CV_BGRA2RGBA
CV_RGB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2BGR_YUNV
CV_YUV2RGBA_YUY2
CV_YUV2BGRA_YUY2
CV_YUV2RGBA_YVYU
CV_YUV2BGRA_YVYU
CV_YUV2RGBA_YUYV
CV_YUV2BGRA_YUYV
CV_YUV2RGBA_YUNV
CV_YUV2BGRA_YUNV
CV_YUV2GRAY_UYVY
CV_YUV2GRAY_YUY2
CV_YUV2GRAY_Y422
CV_YUV2GRAY_UYNV
CV_YUV2GRAY_YVYU
CV_YUV2GRAY_YUYV
CV_YUV2GRAY_YUNV
CV_RGBA2mRGBA
CV_mRGBA2RGBA
CV_COLORCVT_MAX
CvtType code
property
Color space conversion code.
int dstCn
property
Number of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from input and code.
Threshold
type
Inherits | MatFilter |
Property | enumeration Type |
Property | int thresh |
Property | int maxVal |
Property | Type thresholdType |
Applies a fixed-level threshold to each element.
The function applies fixed-level thresholding to a single-channel array. The function is typically used to get a bi-level (binary) image out of a grayscale image ( compare() could be also used for this purpose) or for removing a noise, that is, filtering out pixels with too small or too large values.
imgproc/threshold.qml
enumeration Type
property
Extrapolation method border type:
- Threshold.BINARY if ( input(x, y) > thresh ) output(x, y) = maxVal; else output(x, y) = 0
- Threshold.BINARY_INV if ( input(x, y) > thresh ) output(x, y) = 0; else output(x, y) = maxVal
- Threshold.TRUNC if ( input(x, y) > thresh ) output(x, y) = threshold; else output(x, y) = input(x, y)
- Threshold.TOZERO if ( input(x, y) > thresh ) output(x, y) = input(x, y); else output(x, y) = 0
- Threshold.TOZERO_INV if ( input(x, y) > thresh ) output(x, y) = 0; else output(x, y) = input(x, y)
- Threshold.OTSU The function determines the optimal threshold value using the Otsu’s algorithm and uses it instead of the specified thresh
int thresh
property
Threshold value
int maxVal
property
Maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types.
Type thresholdType
property
Maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types.
ChannelSelect
type
Inherits | MatFilter |
Property | int channel |
Selects an image channel by its index.
imgproc/framedifference.qml
int channel
property
Channel number.
StructuringElement
type
Inherits | Item |
Property | ElementShape shape |
Property | size ksize |
Property | point anchor |
Property | Mat output |
Property | enumeration ElementShape |
Creates a structuring element of the specified size and shape for morphological operations.
imgproc/erodedilate.qml
ElementShape shape
property
Element shape.
size ksize
property
Size of the structuring element.
point anchor
property
Anchor position within the element. The default value (-1, -1) means that the anchor is at the center. Note that only the shape of a cross-shaped element depends on the anchor position. In other cases the anchor just regulates how much the result of the morphological operation is shifted
Mat output
property
Created element.
enumeration ElementShape
property
Extrapolation method border type:
- StructuringElement.MORPH_RECT A rectangluar structuring element.
- StructuringElement.MORPH_ELLIPSE An elliptic structuring element, that is, a filled ellipse inscribed into the rectangle Rect(0, 0, ksize.width, ksize.height)
- StructuringElement.MORPH_CROSS A cross-shaped structuring element.
Resize
type
Inherits | MatFilter |
Property | Size matSize |
Property | real fx |
Property | real fy |
Property | Interpolation interpolation |
Property | enumeration Interpolation |
Resizes an image.
Resizes an image according to the specified filter.
imgproc/resize.qml
Size matSize
property
Size of the resized matrix. An unspecified size or a size of (0, 0) will make the element look into the fx and fy resize factors.
real fx
property
Factor by which to resize on x axis.
real fy
property
Factor by which to resize on y axis.
Interpolation interpolation
property
Interpolation method.
enumeration Interpolation
property
Interpolation method:
- Resize.INTER_NEAREST nearest neighbor interpolation
- Resize.INTER_LINEAR bilinear interpolation
- Resize.INTER_CUBIC bicubic interpolation
- Resize.INTER_AREA area-based (or super) interpolation
- Resize.INTER_LANCZOS4 Lanczos interpolation over 8x8 neighborhood
- Resize.INTER_MAX nearest neighbor interpolation*
- Resize.WARP_INVERSE_MAP nearest neighbor interpolation
Filter2D
type
Converts an image with the specified kernel.
imgproc/filter2D.qml
int ddepth
property
Desired depth of the destination image; if it is negative, it will be the same as input.depth(); the following combinations of src.depth() and ddepth are supported:
* input.depth() = Mat.CV_8U, ddepth = -1/Mat.CV_16S/Mat.CV_32F/Mat.CV_64F
* input.depth() = Mat.CV_16U/CV_16S, ddepth = -1/Mat.CV_32F/Mat.CV_64F
* input.depth() = Mat.CV_32F, ddepth = -1/Mat.CV_32F/Mat.CV_64F
* input.depth() = Mat.CV_64F, ddepth = -1/Mat.CV_64F
where ddepth = -1 will yield an output the same as the source.
Mat kernel
property
Convolution kernel (or rather a correlation kernel), a single-channel floating point matrix.
Point anchor
property
Anchor of the kernel that indicates the relative position of a filtered point within the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor is at the kernel center.
real delta
property
Optional value added to the filtered pixels before storing them in Filter2D.output.
int borderType
property
Pixel extrapolation method (see CopyMakeBorder::BorderType for details).
Dilate
type
Inherits | MatFilter |
Property | Mat kernel |
Property | Point anchor |
Property | int iterations |
Property | int borderType |
Property | color borderValue |
Erodes an image by using a specific structuring element.
imgproc/erodedilate.qml
Mat kernel
property
Structuring element used for dilation; if element=Mat(), a 3x3 rectangular structuring element is used.
Point anchor
property
Position of the anchor within the element; default value (-1, -1) means that the anchor is at the element center.
int iterations
property
Number of times dilation is applied.
int borderType
property
Pixel extrapolation method.
See also CopyMakeBorder::BorderType
color borderValue
property
Border value in case of a constant border
See also CopyMakeBorder::BorderType
Erode
type
Inherits | MatFilter |
Property | Mat kernel |
Property | Point anchor |
Property | int iterations |
Property | int borderType |
Property | color borderValue |
Dilates an image by using a specific structuring element.
imgproc/erodedilate.qml
Mat kernel
property
Structuring element used for erosion; if element=Mat() , a 3x3 rectangular structuring element is used.
Point anchor
property
Position of the anchor within the element; default value (-1, -1) means that the anchor is at the element center.
int iterations
property
Number of times erosion is applied.
int borderType
property
Pixel extrapolation method.
See also CopyMakeBorder::BorderType
color borderValue
property
Border value in case of a constant border
See also CopyMakeBorder::BorderType
CopyMakeBorder
type
Inherits | MatFilter |
Property | enumeration BorderType |
Property | int top |
Property | int bottom |
Property | int left |
Property | int right |
Property | int borderType |
Property | color color |
Copies the source image into the middle of the destination image.
The areas to the left, to the right, above and below the copied source image will be filled with extrapolated pixels
imgproc/copymakeborder.qml
enumeration BorderType
property
Extrapolation method border type:
- CopyMakeBorder.BORDER_REPLICATE
- CopyMakeBorder.BORDER_CONSTANT
- CopyMakeBorder.BORDER_REFLECT
- CopyMakeBorder.BORDER_WRAP
- CopyMakeBorder.BORDER_REFLECT_101
- CopyMakeBorder.BORDER_TRANSPARENT
- CopyMakeBorder.BORDER_DEFAULT
- CopyMakeBorder.BORDER_ISOLATED
int top
property
Property specifying how many pixels in the top direction from the source image rectangle to extrapolate.
int bottom
property
Property specifying how many pixels in the bottom direction from the source image rectangle to extrapolate.
int left
property
Property specifying how many pixels in the left direction from the source image rectangle to extrapolate.
int right
property
Property specifying how many pixels in the right direction from the source image rectangle to extrapolate.
int borderType
property
Border type. See also CopyMakeBorder::BorderType
color color
property
Border value if borderType==CopyMakeBorder.BORDER_CONSTANT. See also CopyMakeBorder::BorderType
Draw
type
Inherits | QtQObject |
Singleton. Provides matrix drawing operations.
Provides the basic set of functions needed in order to draw on a matrix.
imgproc/drawing.qml
line(WritableMat m, Point p1, Point p2, Color color, int thickness, int lineType, int shift)
method
Draw a line from point p1 to point p2 of a specified color and thickness. The lineType can be 4 ( 4-connected line ), 8 (8-connected line, also the default) and -1 (antialiased line). The shift is the number of fractional bits in the point coordinates.
rectangle(WritableMat m, Point p1, Point p2, Color color, int thickness, int lineType, int shift)
method
Draw a rectangle from point p1 to point p2 of a specified color and thickness. The lineType can be 4 ( 4-connected line ), 8 (8-connected line, also the default) and -1 (antialiased line). The shift is the number of fractional bits in the point coordinates.
circle(WritableMat m, Point center, int radius, Color color, int thickness, int lineType, int shift)
method
Draw a circle by specifying its center point, radius, color and thickness. For the lineType and shift, see the lin method.
ellipse(WritableMat m, Point center, Size axes, real angle, real startAngle, real endAngle, Color color,
int thickness, int lineType, int shift)
method
Draw an ellipse in the center point, with its axes (half of the size of the ellipse main axes), rotation angle in degrees, startAngle and endAngle of the elliptic arc in degrees and color. For the lineType and shift see the line method.
Draws an ellipse.
fillPoly(WritableMat m, variant points, Color color, int lineType, int shift, Point offset)
method
Fills the area bounded by one or more polygons. The points is the array of polygons where each polygon is represented by an array of points, the color is the polygons color, the [lineType] is the type of the polygon boundaries and the shift is the number of fractional bits in the vertex coordinates. The offset is an optional offset of all points of the contours.
GetPerspectiveTransform
type
Inherits | MatFilter |
Calculates a perspective transform from four pairs of the corresponding points.
Parameters:
- src – Coordinates of quadrangle vertices in the source image.
- dst – Coordinates of the corresponding quadrangle vertices in the destination image.
See also GetPerspectiveTransform
warpPerspective
type
Inherits | MatFilter |
Applies a perspective transformation to an image.
Parameters:
- src – input image.
- dst – output image that has the size dsize and the same type as src .
- M – 3 X 3 transformation matrix.
- dsize – size of the output image.
- flags – combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation ( dst → src ).
- borderMode – pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE).
- borderValue – value used in case of a constant border; by default, it equals 0.
See also warpPerspective
QCachedWarpPerspective
type
Inherits | MatFilter |
Applies a perspective transformation to an image.
Caches the transformation matrix when initialising, so it's faster and recommended to use for videos.
- src – input image.
- dst – output image that has the size dsize and the same type as src .
- M – 3 X 3 transformation matrix.
- dsize – size of the output image.
See also warpPerspective