Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / fluid / modules / gapi / src / api / kernels_imgproc.cpp
1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
4 //
5 // Copyright (C) 2018-2019 Intel Corporation
6
7
8 #include "precomp.hpp"
9
10 #include "opencv2/gapi/gscalar.hpp"
11 #include "opencv2/gapi/gcall.hpp"
12 #include "opencv2/gapi/gkernel.hpp"
13 #include "opencv2/gapi/imgproc.hpp"
14
15 namespace cv { namespace gapi {
16
17 GMat sepFilter(const GMat& src, int ddepth, const Mat& kernelX, const Mat& kernelY, const Point& anchor,
18                const Scalar& delta, int borderType, const Scalar& borderVal)
19 {
20     return imgproc::GSepFilter::on(src, ddepth, kernelX, kernelY, anchor, delta, borderType, borderVal);
21 }
22
23 GMat filter2D(const GMat& src, int ddepth, const Mat& kernel, const Point& anchor, const Scalar& delta, int borderType,
24               const Scalar& bordVal)
25 {
26     return imgproc::GFilter2D::on(src, ddepth, kernel, anchor, delta, borderType, bordVal);
27 }
28
29 GMat boxFilter(const GMat& src, int dtype, const Size& ksize, const Point& anchor,
30                bool normalize, int borderType, const Scalar& bordVal)
31 {
32     return imgproc::GBoxFilter::on(src, dtype, ksize, anchor, normalize, borderType, bordVal);
33 }
34
35 GMat blur(const GMat& src, const Size& ksize, const Point& anchor,
36                int borderType, const Scalar& bordVal)
37 {
38     return imgproc::GBlur::on(src, ksize, anchor, borderType, bordVal);
39 }
40
41 GMat gaussianBlur(const GMat& src, const Size& ksize, double sigmaX, double sigmaY,
42                   int borderType, const Scalar& bordVal)
43 {
44     return imgproc::GGaussBlur::on(src, ksize, sigmaX, sigmaY, borderType, bordVal);
45 }
46
47 GMat medianBlur(const GMat& src, int ksize)
48 {
49     return imgproc::GMedianBlur::on(src, ksize);
50 }
51
52 GMat erode(const GMat& src, const Mat& kernel, const Point& anchor, int iterations,
53            int borderType, const Scalar& borderValue )
54 {
55     return imgproc::GErode::on(src, kernel, anchor, iterations, borderType, borderValue);
56 }
57
58 GMat erode3x3(const GMat& src, int iterations,
59            int borderType, const Scalar& borderValue )
60 {
61     return erode(src, cv::Mat(), cv::Point(-1, -1), iterations, borderType, borderValue);
62 }
63
64 GMat dilate(const GMat& src, const Mat& kernel, const Point& anchor, int iterations,
65             int borderType, const Scalar& borderValue)
66 {
67     return imgproc::GDilate::on(src, kernel, anchor, iterations, borderType, borderValue);
68 }
69
70 GMat dilate3x3(const GMat& src, int iterations,
71             int borderType, const Scalar& borderValue)
72 {
73     return dilate(src, cv::Mat(), cv::Point(-1,-1), iterations, borderType, borderValue);
74 }
75
76 GMat Sobel(const GMat& src, int ddepth, int dx, int dy, int ksize,
77            double scale, double delta,
78            int borderType, const Scalar& bordVal)
79 {
80     return imgproc::GSobel::on(src, ddepth, dx, dy, ksize, scale, delta, borderType, bordVal);
81 }
82
83 GMat equalizeHist(const GMat& src)
84 {
85     return imgproc::GEqHist::on(src);
86 }
87
88 GMat Canny(const GMat& src, double thr1, double thr2, int apertureSize, bool l2gradient)
89 {
90     return imgproc::GCanny::on(src, thr1, thr2, apertureSize, l2gradient);
91 }
92
93 GMat RGB2Gray(const GMat& src)
94 {
95     return imgproc::GRGB2Gray::on(src);
96 }
97
98 GMat RGB2Gray(const GMat& src, float rY, float gY, float bY)
99 {
100     return imgproc::GRGB2GrayCustom::on(src, rY, gY, bY);
101 }
102
103 GMat BGR2Gray(const GMat& src)
104 {
105     return imgproc::GBGR2Gray::on(src);
106 }
107
108 GMat RGB2YUV(const GMat& src)
109 {
110     return imgproc::GRGB2YUV::on(src);
111 }
112
113 GMat BGR2LUV(const GMat& src)
114 {
115     return imgproc::GBGR2LUV::on(src);
116 }
117
118 GMat LUV2BGR(const GMat& src)
119 {
120     return imgproc::GLUV2BGR::on(src);
121 }
122
123 GMat BGR2YUV(const GMat& src)
124 {
125     return imgproc::GBGR2YUV::on(src);
126 }
127
128 GMat YUV2BGR(const GMat& src)
129 {
130     return imgproc::GYUV2BGR::on(src);
131 }
132
133 GMat YUV2RGB(const GMat& src)
134 {
135     return imgproc::GYUV2RGB::on(src);
136 }
137
138 GMat RGB2Lab(const GMat& src)
139 {
140     return imgproc::GRGB2Lab::on(src);
141 }
142
143 } //namespace gapi
144 } //namespace cv