OpenCV
4.5.1
Open Source Computer Vision
|
Functions | |
GMat | cv::gapi::bilateralFilter (const GMat &src, int d, double sigmaColor, double sigmaSpace, int borderType=BORDER_DEFAULT) |
Applies the bilateral filter to an image. More... | |
GMat | cv::gapi::blur (const GMat &src, const Size &ksize, const Point &anchor=Point(-1,-1), int borderType=BORDER_DEFAULT, const Scalar &borderValue=Scalar(0)) |
Blurs an image using the normalized box filter. More... | |
GMat | cv::gapi::boxFilter (const GMat &src, int dtype, const Size &ksize, const Point &anchor=Point(-1,-1), bool normalize=true, int borderType=BORDER_DEFAULT, const Scalar &borderValue=Scalar(0)) |
Blurs an image using the box filter. More... | |
GMat | cv::gapi::dilate (const GMat &src, const Mat &kernel, const Point &anchor=Point(-1,-1), int iterations=1, int borderType=BORDER_CONSTANT, const Scalar &borderValue=morphologyDefaultBorderValue()) |
Dilates an image by using a specific structuring element. More... | |
GMat | cv::gapi::dilate3x3 (const GMat &src, int iterations=1, int borderType=BORDER_CONSTANT, const Scalar &borderValue=morphologyDefaultBorderValue()) |
Dilates an image by using 3 by 3 rectangular structuring element. More... | |
GMat | cv::gapi::erode (const GMat &src, const Mat &kernel, const Point &anchor=Point(-1,-1), int iterations=1, int borderType=BORDER_CONSTANT, const Scalar &borderValue=morphologyDefaultBorderValue()) |
Erodes an image by using a specific structuring element. More... | |
GMat | cv::gapi::erode3x3 (const GMat &src, int iterations=1, int borderType=BORDER_CONSTANT, const Scalar &borderValue=morphologyDefaultBorderValue()) |
Erodes an image by using 3 by 3 rectangular structuring element. More... | |
GMat | cv::gapi::filter2D (const GMat &src, int ddepth, const Mat &kernel, const Point &anchor=Point(-1,-1), const Scalar &delta=Scalar(0), int borderType=BORDER_DEFAULT, const Scalar &borderValue=Scalar(0)) |
Convolves an image with the kernel. More... | |
GMat | cv::gapi::gaussianBlur (const GMat &src, const Size &ksize, double sigmaX, double sigmaY=0, int borderType=BORDER_DEFAULT, const Scalar &borderValue=Scalar(0)) |
Blurs an image using a Gaussian filter. More... | |
GMat | cv::gapi::Laplacian (const GMat &src, int ddepth, int ksize=1, double scale=1, double delta=0, int borderType=BORDER_DEFAULT) |
Calculates the Laplacian of an image. More... | |
GMat | cv::gapi::medianBlur (const GMat &src, int ksize) |
Blurs an image using the median filter. More... | |
GMat | cv::gapi::morphologyEx (const GMat &src, const MorphTypes op, const Mat &kernel, const Point &anchor=Point(-1,-1), const int iterations=1, const BorderTypes borderType=BORDER_CONSTANT, const Scalar &borderValue=morphologyDefaultBorderValue()) |
Performs advanced morphological transformations. More... | |
GMat | cv::gapi::sepFilter (const GMat &src, int ddepth, const Mat &kernelX, const Mat &kernelY, const Point &anchor, const Scalar &delta, int borderType=BORDER_DEFAULT, const Scalar &borderValue=Scalar(0)) |
Applies a separable linear filter to a matrix(image). More... | |
GMat | cv::gapi::Sobel (const GMat &src, int ddepth, int dx, int dy, int ksize=3, double scale=1, double delta=0, int borderType=BORDER_DEFAULT, const Scalar &borderValue=Scalar(0)) |
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. More... | |
std::tuple< GMat, GMat > | cv::gapi::SobelXY (const GMat &src, int ddepth, int order, int ksize=3, double scale=1, double delta=0, int borderType=BORDER_DEFAULT, const Scalar &borderValue=Scalar(0)) |
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator. More... | |
GMat cv::gapi::bilateralFilter | ( | const GMat & | src, |
int | d, | ||
double | sigmaColor, | ||
double | sigmaSpace, | ||
int | borderType = BORDER_DEFAULT |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Applies the bilateral filter to an image.
The function applies bilateral filtering to the input image, as described in http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is very slow compared to most filters.
Sigma values: For simplicity, you can set the 2 sigma values to be the same. If they are small (< 10), the filter will not have much effect, whereas if they are large (> 150), they will have a very strong effect, making the image look "cartoonish".
Filter size: Large filters (d > 5) are very slow, so it is recommended to use d=5 for real-time applications, and perhaps d=9 for offline applications that need heavy noise filtering.
This filter does not work inplace.
src | Source 8-bit or floating-point, 1-channel or 3-channel image. |
d | Diameter of each pixel neighborhood that is used during filtering. If it is non-positive, it is computed from sigmaSpace. |
sigmaColor | Filter sigma in the color space. A larger value of the parameter means that farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting in larger areas of semi-equal color. |
sigmaSpace | Filter sigma in the coordinate space. A larger value of the parameter means that farther pixels will influence each other as long as their colors are close enough (see sigmaColor ). When d>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is proportional to sigmaSpace. |
borderType | border mode used to extrapolate pixels outside of the image, see BorderTypes |
GMat cv::gapi::blur | ( | const GMat & | src, |
const Size & | ksize, | ||
const Point & | anchor = Point(-1,-1) , |
||
int | borderType = BORDER_DEFAULT , |
||
const Scalar & | borderValue = Scalar(0) |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Blurs an image using the normalized box filter.
The function smooths an image using the kernel:
\[\texttt{K} = \frac{1}{\texttt{ksize.width*ksize.height}} \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \end{bmatrix}\]
The call blur(src, ksize, anchor, borderType)
is equivalent to boxFilter(src, src.type(), ksize, anchor, true, borderType)
.
Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1. Output image must have the same type, size, and number of channels as the input image.
src | Source image. |
ksize | blurring kernel size. |
anchor | anchor point; default value Point(-1,-1) means that the anchor is at the kernel center. |
borderType | border mode used to extrapolate pixels outside of the image, see cv::BorderTypes |
borderValue | border value in case of constant border type |
GMat cv::gapi::boxFilter | ( | const GMat & | src, |
int | dtype, | ||
const Size & | ksize, | ||
const Point & | anchor = Point(-1,-1) , |
||
bool | normalize = true , |
||
int | borderType = BORDER_DEFAULT , |
||
const Scalar & | borderValue = Scalar(0) |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Blurs an image using the box filter.
The function smooths an image using the kernel:
\[\texttt{K} = \alpha \begin{bmatrix} 1 & 1 & 1 & \cdots & 1 & 1 \\ 1 & 1 & 1 & \cdots & 1 & 1 \\ \hdotsfor{6} \\ 1 & 1 & 1 & \cdots & 1 & 1 \end{bmatrix}\]
where
\[\alpha = \begin{cases} \frac{1}{\texttt{ksize.width*ksize.height}} & \texttt{when } \texttt{normalize=true} \\1 & \texttt{otherwise} \end{cases}\]
Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on). If you need to compute pixel sums over variable-size windows, use cv::integral.
Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1. Output image must have the same type, size, and number of channels as the input image.
src | Source image. |
dtype | the output image depth (-1 to set the input image data type). |
ksize | blurring kernel size. |
anchor | Anchor position within the kernel. The default value \((-1,-1)\) means that the anchor is at the kernel center. |
normalize | flag, specifying whether the kernel is normalized by its area or not. |
borderType | Pixel extrapolation method, see cv::BorderTypes |
borderValue | border value in case of constant border type |
GMat cv::gapi::dilate | ( | const GMat & | src, |
const Mat & | kernel, | ||
const Point & | anchor = Point(-1,-1) , |
||
int | iterations = 1 , |
||
int | borderType = BORDER_CONSTANT , |
||
const Scalar & | borderValue = morphologyDefaultBorderValue() |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Dilates an image by using a specific structuring element.
The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken:
\[\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\]
Dilation can be applied several (iterations) times. In case of multi-channel images, each channel is processed independently. Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, and CV_32FC1. Output image must have the same type, size, and number of channels as the input image.
src | input image. |
kernel | structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular structuring element is used. Kernel can be created using getStructuringElement |
anchor | position of the anchor within the element; default value (-1, -1) means that the anchor is at the element center. |
iterations | number of times dilation is applied. |
borderType | pixel extrapolation method, see cv::BorderTypes |
borderValue | border value in case of a constant border |
GMat cv::gapi::dilate3x3 | ( | const GMat & | src, |
int | iterations = 1 , |
||
int | borderType = BORDER_CONSTANT , |
||
const Scalar & | borderValue = morphologyDefaultBorderValue() |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Dilates an image by using 3 by 3 rectangular structuring element.
The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken:
\[\texttt{dst} (x,y) = \max _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\]
Dilation can be applied several (iterations) times. In case of multi-channel images, each channel is processed independently. Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, and CV_32FC1. Output image must have the same type, size, and number of channels as the input image.
src | input image. |
iterations | number of times dilation is applied. |
borderType | pixel extrapolation method, see cv::BorderTypes |
borderValue | border value in case of a constant border |
GMat cv::gapi::erode | ( | const GMat & | src, |
const Mat & | kernel, | ||
const Point & | anchor = Point(-1,-1) , |
||
int | iterations = 1 , |
||
int | borderType = BORDER_CONSTANT , |
||
const Scalar & | borderValue = morphologyDefaultBorderValue() |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Erodes an image by using a specific structuring element.
The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken:
\[\texttt{dst} (x,y) = \min _{(x',y'): \, \texttt{element} (x',y') \ne0 } \texttt{src} (x+x',y+y')\]
Erosion can be applied several (iterations) times. In case of multi-channel images, each channel is processed independently. Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, and CV_32FC1. Output image must have the same type, size, and number of channels as the input image.
src | input image |
kernel | structuring element used for erosion; if element=Mat() , a 3 x 3 rectangular structuring element is used. Kernel can be created using getStructuringElement. |
anchor | position of the anchor within the element; default value (-1, -1) means that the anchor is at the element center. |
iterations | number of times erosion is applied. |
borderType | pixel extrapolation method, see cv::BorderTypes |
borderValue | border value in case of a constant border |
GMat cv::gapi::erode3x3 | ( | const GMat & | src, |
int | iterations = 1 , |
||
int | borderType = BORDER_CONSTANT , |
||
const Scalar & | borderValue = morphologyDefaultBorderValue() |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Erodes an image by using 3 by 3 rectangular structuring element.
The function erodes the source image using the rectangular structuring element with rectangle center as an anchor. Erosion can be applied several (iterations) times. In case of multi-channel images, each channel is processed independently. Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, and CV_32FC1. Output image must have the same type, size, and number of channels as the input image.
src | input image |
iterations | number of times erosion is applied. |
borderType | pixel extrapolation method, see cv::BorderTypes |
borderValue | border value in case of a constant border |
GMat cv::gapi::filter2D | ( | const GMat & | src, |
int | ddepth, | ||
const Mat & | kernel, | ||
const Point & | anchor = Point(-1,-1) , |
||
const Scalar & | delta = Scalar(0) , |
||
int | borderType = BORDER_DEFAULT , |
||
const Scalar & | borderValue = Scalar(0) |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Convolves an image with the kernel.
The function applies an arbitrary linear filter to an image. When the aperture is partially outside the image, the function interpolates outlier pixel values according to the specified border mode.
The function does actually compute correlation, not the convolution:
\[\texttt{dst} (x,y) = \sum _{ \substack{0\leq x' < \texttt{kernel.cols}\\{0\leq y' < \texttt{kernel.rows}}}} \texttt{kernel} (x',y')* \texttt{src} (x+x'- \texttt{anchor.x} ,y+y'- \texttt{anchor.y} )\]
That is, the kernel is not mirrored around the anchor point. If you need a real convolution, flip the kernel using flip and set the new anchor to (kernel.cols - anchor.x - 1, kernel.rows - anchor.y - 1)
.
Supported matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1. Output image must have the same size and number of channels an input image.
src | input image. |
ddepth | desired depth of the destination image |
kernel | convolution kernel (or rather a correlation kernel), a single-channel floating point matrix; if you want to apply different kernels to different channels, split the image into separate color planes using split and process them individually. |
anchor | 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. |
delta | optional value added to the filtered pixels before storing them in dst. |
borderType | pixel extrapolation method, see cv::BorderTypes |
borderValue | border value in case of constant border type |
GMat cv::gapi::gaussianBlur | ( | const GMat & | src, |
const Size & | ksize, | ||
double | sigmaX, | ||
double | sigmaY = 0 , |
||
int | borderType = BORDER_DEFAULT , |
||
const Scalar & | borderValue = Scalar(0) |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Blurs an image using a Gaussian filter.
The function filter2Ds the source image with the specified Gaussian kernel. Output image must have the same type and number of channels an input image.
Supported input matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1. Output image must have the same type, size, and number of channels as the input image.
src | input image; |
ksize | 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. |
sigmaX | Gaussian kernel standard deviation in X direction. |
sigmaY | Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height, respectively (see cv::getGaussianKernel for details); to fully control the result regardless of possible future modifications of all this semantics, it is recommended to specify all of ksize, sigmaX, and sigmaY. |
borderType | pixel extrapolation method, see cv::BorderTypes |
borderValue | border value in case of constant border type |
GMat cv::gapi::Laplacian | ( | const GMat & | src, |
int | ddepth, | ||
int | ksize = 1 , |
||
double | scale = 1 , |
||
double | delta = 0 , |
||
int | borderType = BORDER_DEFAULT |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Calculates the Laplacian of an image.
The function calculates the Laplacian of the source image by adding up the second x and y derivatives calculated using the Sobel operator:
\[\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\]
This is done when ksize > 1
. When ksize == 1
, the Laplacian is computed by filtering the image with the following \(3 \times 3\) aperture:
\[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\]
src | Source image. |
ddepth | Desired depth of the destination image. |
ksize | Aperture size used to compute the second-derivative filters. See getDerivKernels for details. The size must be positive and odd. |
scale | Optional scale factor for the computed Laplacian values. By default, no scaling is applied. See getDerivKernels for details. |
delta | Optional delta value that is added to the results prior to storing them in dst . |
borderType | Pixel extrapolation method, see BorderTypes. BORDER_WRAP is not supported. |
GMat cv::gapi::medianBlur | ( | const GMat & | src, |
int | ksize | ||
) |
Python: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
retval | = | cv.gapi.medianBlur( | src, ksize | ) |
#include <opencv2/gapi/imgproc.hpp>
Blurs an image using the median filter.
The function smoothes an image using the median filter with the \(\texttt{ksize} \times \texttt{ksize}\) aperture. Each channel of a multi-channel image is processed independently. Output image must have the same type, size, and number of channels as the input image.
src | input matrix (image) |
ksize | aperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 ... |
GMat cv::gapi::morphologyEx | ( | const GMat & | src, |
const MorphTypes | op, | ||
const Mat & | kernel, | ||
const Point & | anchor = Point(-1,-1) , |
||
const int | iterations = 1 , |
||
const BorderTypes | borderType = BORDER_CONSTANT , |
||
const Scalar & | borderValue = morphologyDefaultBorderValue() |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Performs advanced morphological transformations.
The function can perform advanced morphological transformations using an erosion and dilation as basic operations.
Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently.
src | Input image. |
op | Type of a morphological operation, see MorphTypes |
kernel | Structuring element. It can be created using getStructuringElement. |
anchor | Anchor position within the element. Both negative values mean that the anchor is at the kernel center. |
iterations | Number of times erosion and dilation are applied. |
borderType | Pixel extrapolation method, see BorderTypes. BORDER_WRAP is not supported. |
borderValue | Border value in case of a constant border. The default value has a special meaning. |
GMat cv::gapi::sepFilter | ( | const GMat & | src, |
int | ddepth, | ||
const Mat & | kernelX, | ||
const Mat & | kernelY, | ||
const Point & | anchor, | ||
const Scalar & | delta, | ||
int | borderType = BORDER_DEFAULT , |
||
const Scalar & | borderValue = Scalar(0) |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Applies a separable linear filter to a matrix(image).
The function applies a separable linear filter to the matrix. That is, first, every row of src is filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D kernel kernelY. The final result is returned.
Supported matrix data types are CV_8UC1, CV_8UC3, CV_16UC1, CV_16SC1, CV_32FC1. Output image must have the same type, size, and number of channels as the input image.
src | Source image. |
ddepth | desired depth of the destination image (the following combinations of src.depth() and ddepth are supported: src.depth() = CV_8U, ddepth = -1/CV_16S/CV_32F/CV_64F src.depth() = CV_16U/CV_16S, ddepth = -1/CV_32F/CV_64F src.depth() = CV_32F, ddepth = -1/CV_32F/CV_64F src.depth() = CV_64F, ddepth = -1/CV_64F |
when ddepth=-1, the output image will have the same depth as the source)
kernelX | Coefficients for filtering each row. |
kernelY | Coefficients for filtering each column. |
anchor | Anchor position within the kernel. The default value \((-1,-1)\) means that the anchor is at the kernel center. |
delta | Value added to the filtered results before storing them. |
borderType | Pixel extrapolation method, see cv::BorderTypes |
borderValue | border value in case of constant border type |
GMat cv::gapi::Sobel | ( | const GMat & | src, |
int | ddepth, | ||
int | dx, | ||
int | dy, | ||
int | ksize = 3 , |
||
double | scale = 1 , |
||
double | delta = 0 , |
||
int | borderType = BORDER_DEFAULT , |
||
const Scalar & | borderValue = Scalar(0) |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
In all cases except one, the \(\texttt{ksize} \times \texttt{ksize}\) separable kernel is used to calculate the derivative. When \(\texttt{ksize = 1}\), the \(3 \times 1\) or \(1 \times 3\) kernel is used (that is, no Gaussian smoothing is done). ksize = 1
can only be used for the first or the second x- or y- derivatives.
There is also the special value ksize = FILTER_SCHARR (-1)
that corresponds to the \(3\times3\) Scharr filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
\[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\]
for the x-derivative, or transposed for the y-derivative.
The function calculates an image derivative by convolving the image with the appropriate kernel:
\[\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\]
The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first case corresponds to a kernel of:
\[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\]
The second case corresponds to a kernel of:
\[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\]
src | input image. |
ddepth | output image depth, see combinations; in the case of 8-bit input images it will result in truncated derivatives. |
dx | order of the derivative x. |
dy | order of the derivative y. |
ksize | size of the extended Sobel kernel; it must be odd. |
scale | optional scale factor for the computed derivative values; by default, no scaling is applied (see cv::getDerivKernels for details). |
delta | optional delta value that is added to the results prior to storing them in dst. |
borderType | pixel extrapolation method, see cv::BorderTypes |
borderValue | border value in case of constant border type |
std::tuple<GMat, GMat> cv::gapi::SobelXY | ( | const GMat & | src, |
int | ddepth, | ||
int | order, | ||
int | ksize = 3 , |
||
double | scale = 1 , |
||
double | delta = 0 , |
||
int | borderType = BORDER_DEFAULT , |
||
const Scalar & | borderValue = Scalar(0) |
||
) |
#include <opencv2/gapi/imgproc.hpp>
Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
In all cases except one, the \(\texttt{ksize} \times \texttt{ksize}\) separable kernel is used to calculate the derivative. When \(\texttt{ksize = 1}\), the \(3 \times 1\) or \(1 \times 3\) kernel is used (that is, no Gaussian smoothing is done). ksize = 1
can only be used for the first or the second x- or y- derivatives.
There is also the special value ksize = FILTER_SCHARR (-1)
that corresponds to the \(3\times3\) Scharr filter that may give more accurate results than the \(3\times3\) Sobel. The Scharr aperture is
\[\vecthreethree{-3}{0}{3}{-10}{0}{10}{-3}{0}{3}\]
for the x-derivative, or transposed for the y-derivative.
The function calculates an image derivative by convolving the image with the appropriate kernel:
\[\texttt{dst} = \frac{\partial^{xorder+yorder} \texttt{src}}{\partial x^{xorder} \partial y^{yorder}}\]
The Sobel operators combine Gaussian smoothing and differentiation, so the result is more or less resistant to the noise. Most often, the function is called with ( xorder = 1, yorder = 0, ksize = 3) or ( xorder = 0, yorder = 1, ksize = 3) to calculate the first x- or y- image derivative. The first case corresponds to a kernel of:
\[\vecthreethree{-1}{0}{1}{-2}{0}{2}{-1}{0}{1}\]
The second case corresponds to a kernel of:
\[\vecthreethree{-1}{-2}{-1}{0}{0}{0}{1}{2}{1}\]
src | input image. |
ddepth | output image depth, see combinations; in the case of 8-bit input images it will result in truncated derivatives. |
order | order of the derivatives. |
ksize | size of the extended Sobel kernel; it must be odd. |
scale | optional scale factor for the computed derivative values; by default, no scaling is applied (see cv::getDerivKernels for details). |
delta | optional delta value that is added to the results prior to storing them in dst. |
borderType | pixel extrapolation method, see cv::BorderTypes |
borderValue | border value in case of constant border type |