mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #18652 from OrestChura:oc/morphologyEx
[G-API]: morphologyEx() Standard Kernel Implementation * cv::gapi::morphologyEx() kernel - implemented (without separate 3x3 version) - tests added: check only different operations, not kernels/borders * Address comments: add `const` where needed * Replaced fundamental tyeps -> enums where needed - added operator<< overload for cv::MorphTypes for tests output
This commit is contained in:
@@ -78,6 +78,14 @@ namespace imgproc {
|
||||
}
|
||||
};
|
||||
|
||||
G_TYPED_KERNEL(GMorphologyEx, <GMat(GMat,MorphTypes,Mat,Point,int,BorderTypes,Scalar)>,
|
||||
"org.opencv.imgproc.filters.morphologyEx") {
|
||||
static GMatDesc outMeta(const GMatDesc &in, MorphTypes, Mat, Point, int,
|
||||
BorderTypes, Scalar) {
|
||||
return in;
|
||||
}
|
||||
};
|
||||
|
||||
G_TYPED_KERNEL(GSobel, <GMat(GMat,int,int,int,int,double,double,int,Scalar)>, "org.opencv.imgproc.filters.sobel") {
|
||||
static GMatDesc outMeta(GMatDesc in, int ddepth, int, int, int, double, double, int, Scalar) {
|
||||
return in.withDepth(ddepth);
|
||||
@@ -521,7 +529,7 @@ anchor is at the element center.
|
||||
@param iterations number of times erosion is applied.
|
||||
@param borderType pixel extrapolation method, see cv::BorderTypes
|
||||
@param borderValue border value in case of a constant border
|
||||
@sa dilate
|
||||
@sa dilate, morphologyEx
|
||||
*/
|
||||
GAPI_EXPORTS GMat erode(const GMat& src, const Mat& kernel, const Point& anchor = Point(-1,-1), int iterations = 1,
|
||||
int borderType = BORDER_CONSTANT,
|
||||
@@ -596,6 +604,37 @@ GAPI_EXPORTS GMat dilate3x3(const GMat& src, int iterations = 1,
|
||||
int borderType = BORDER_CONSTANT,
|
||||
const Scalar& borderValue = morphologyDefaultBorderValue());
|
||||
|
||||
/** @brief 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.
|
||||
|
||||
@note Function textual ID is "org.opencv.imgproc.filters.morphologyEx"
|
||||
|
||||
@param src Input image.
|
||||
@param op Type of a morphological operation, see #MorphTypes
|
||||
@param kernel Structuring element. It can be created using #getStructuringElement.
|
||||
@param anchor Anchor position within the element. Both negative values mean that the anchor is at
|
||||
the kernel center.
|
||||
@param iterations Number of times erosion and dilation are applied.
|
||||
@param borderType Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
|
||||
@param borderValue Border value in case of a constant border. The default value has a special
|
||||
meaning.
|
||||
@sa dilate, erode, getStructuringElement
|
||||
@note The number of iterations is the number of times erosion or dilatation operation will be
|
||||
applied. For instance, an opening operation (#MORPH_OPEN) with two iterations is equivalent to
|
||||
apply successively: erode -> erode -> dilate -> dilate
|
||||
(and not erode -> dilate -> erode -> dilate).
|
||||
*/
|
||||
GAPI_EXPORTS GMat 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());
|
||||
|
||||
/** @brief Calculates the first, second, third, or mixed image derivatives using an extended Sobel operator.
|
||||
|
||||
In all cases except one, the \f$\texttt{ksize} \times \texttt{ksize}\f$ separable kernel is used to
|
||||
|
||||
Reference in New Issue
Block a user