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.
5 // Copyright (C) 2018-2020 Intel Corporation
10 #include <opencv2/gapi/gcall.hpp>
11 #include <opencv2/gapi/gscalar.hpp>
12 #include <opencv2/gapi/gkernel.hpp>
13 #include <opencv2/gapi/core.hpp>
18 namespace cv { namespace gapi {
20 GMat add(const GMat& src1, const GMat& src2, int dtype)
22 return core::GAdd::on(src1, src2, dtype);
25 GMat addC(const GMat& src1, const GScalar& c, int dtype)
27 return core::GAddC::on(src1, c, dtype);
30 GMat addC(const GScalar& c, const GMat& src1, int dtype)
32 return core::GAddC::on(src1, c, dtype);
35 GMat sub(const GMat& src1, const GMat& src2, int dtype)
37 return core::GSub::on(src1, src2, dtype);
40 GMat subC(const GMat& src1, const GScalar& c, int dtype)
42 return core::GSubC::on(src1, c, dtype);
45 GMat subRC(const GScalar& c, const GMat& src, int dtype)
47 return core::GSubRC::on(c, src, dtype);
50 GMat mul(const GMat& src1, const GMat& src2, double scale, int dtype)
52 return core::GMul::on(src1, src2, scale, dtype);
55 GMat mulC(const GMat& src, double scale, int dtype)
57 return core::GMulCOld::on(src, scale, dtype);
60 GMat mulC(const GMat& src, const GScalar& multiplier, int dtype)
62 return core::GMulC::on(src, multiplier, dtype);
65 GMat mulC(const GScalar& multiplier, const GMat& src, int dtype)
67 return core::GMulC::on(src, multiplier, dtype);
70 GMat div(const GMat& src1, const GMat& src2, double scale, int dtype)
72 return core::GDiv::on(src1, src2, scale, dtype);
75 GMat divC(const GMat& src, const GScalar& divisor, double scale, int dtype)
77 return core::GDivC::on(src, divisor, scale, dtype);
80 GMat divRC(const GScalar& divident, const GMat& src, double scale, int dtype)
82 return core::GDivRC::on(divident, src, scale, dtype);
85 GScalar mean(const GMat& src)
87 return core::GMean::on(src);
90 GMat mask(const GMat& src, const GMat& mask)
92 return core::GMask::on(src, mask);
95 std::tuple<GMat, GMat> polarToCart(const GMat& magnitude, const GMat& angle,
98 return core::GPolarToCart::on(magnitude, angle, angleInDegrees);
101 std::tuple<GMat, GMat> cartToPolar(const GMat& x, const GMat& y,
104 return core::GCartToPolar::on(x, y, angleInDegrees);
107 GMat phase(const GMat &x, const GMat &y, bool angleInDegrees)
109 return core::GPhase::on(x, y, angleInDegrees);
112 GMat cmpGT(const GMat& src1, const GMat& src2)
114 return core::GCmpGT::on(src1, src2);
117 GMat cmpLT(const GMat& src1, const GMat& src2)
119 return core::GCmpLT::on(src1, src2);
122 GMat cmpGE(const GMat& src1, const GMat& src2)
124 return core::GCmpGE::on(src1, src2);
127 GMat cmpLE(const GMat& src1, const GMat& src2)
129 return core::GCmpLE::on(src1, src2);
132 GMat cmpEQ(const GMat& src1, const GMat& src2)
134 return core::GCmpEQ::on(src1, src2);
137 GMat cmpNE(const GMat& src1, const GMat& src2)
139 return core::GCmpNE::on(src1, src2);
142 GMat cmpGT(const GMat& src1, const GScalar& src2)
144 return core::GCmpGTScalar::on(src1, src2);
147 GMat cmpLT(const GMat& src1, const GScalar& src2)
149 return core::GCmpLTScalar::on(src1, src2);
152 GMat cmpGE(const GMat& src1, const GScalar& src2)
154 return core::GCmpGEScalar::on(src1, src2);
157 GMat cmpLE(const GMat& src1, const GScalar& src2)
159 return core::GCmpLEScalar::on(src1, src2);
162 GMat cmpEQ(const GMat& src1, const GScalar& src2)
164 return core::GCmpEQScalar::on(src1, src2);
167 GMat cmpNE(const GMat& src1, const GScalar& src2)
169 return core::GCmpNEScalar::on(src1, src2);
172 GMat min(const GMat& src1, const GMat& src2)
174 return core::GMin::on(src1, src2);
177 GMat max(const GMat& src1, const GMat& src2)
179 return core::GMax::on(src1, src2);
182 GMat absDiff(const GMat& src1, const GMat& src2)
184 return core::GAbsDiff::on(src1, src2);
187 GMat absDiffC(const GMat& src, const GScalar& c)
189 return core::GAbsDiffC::on(src, c);
192 GMat bitwise_and(const GMat& src1, const GMat& src2)
194 return core::GAnd::on(src1, src2);
197 GMat bitwise_and(const GMat& src1, const GScalar& src2)
199 return core::GAndS::on(src1, src2);
202 GMat bitwise_or(const GMat& src1, const GMat& src2)
204 return core::GOr::on(src1, src2);
207 GMat bitwise_or(const GMat& src1, const GScalar& src2)
209 return core::GOrS::on(src1, src2);
212 GMat bitwise_xor(const GMat& src1, const GMat& src2)
214 return core::GXor::on(src1, src2);
217 GMat bitwise_xor(const GMat& src1, const GScalar& src2)
219 return core::GXorS::on(src1, src2);
222 GMat bitwise_not(const GMat& src1)
224 return core::GNot::on(src1);
227 GMat select(const GMat& src1, const GMat& src2, const GMat& mask)
229 return core::GSelect::on(src1, src2, mask);
232 GScalar sum(const GMat& src)
234 return core::GSum::on(src);
237 GOpaque<int> countNonZero(const GMat& src)
239 return core::GCountNonZero::on(src);
242 GMat addWeighted(const GMat& src1, double alpha, const GMat& src2, double beta, double gamma, int dtype)
244 return core::GAddW::on(src1, alpha, src2, beta, gamma, dtype);
247 GScalar normL1(const GMat& src)
249 return core::GNormL1::on(src);
252 GScalar normL2(const GMat& src)
254 return core::GNormL2::on(src);
257 GScalar normInf(const GMat& src)
259 return core::GNormInf::on(src);
262 std::tuple<GMat, GMat> integral(const GMat& src, int sdepth, int sqdepth)
264 return core::GIntegral::on(src, sdepth, sqdepth);
267 GMat threshold(const GMat& src, const GScalar& thresh, const GScalar& maxval, int type)
269 GAPI_Assert(type != cv::THRESH_TRIANGLE && type != cv::THRESH_OTSU);
270 return core::GThreshold::on(src, thresh, maxval, type);
273 std::tuple<GMat, GScalar> threshold(const GMat& src, const GScalar& maxval, int type)
275 GAPI_Assert(type == cv::THRESH_TRIANGLE || type == cv::THRESH_OTSU);
276 return core::GThresholdOT::on(src, maxval, type);
279 GMat inRange(const GMat& src, const GScalar& threshLow, const GScalar& threshUp)
281 return core::GInRange::on(src, threshLow, threshUp);
284 std::tuple<GMat, GMat, GMat> split3(const GMat& src)
286 return core::GSplit3::on(src);
289 std::tuple<GMat, GMat, GMat, GMat> split4(const GMat& src)
291 return core::GSplit4::on(src);
294 GMat merge3(const GMat& src1, const GMat& src2, const GMat& src3)
296 return core::GMerge3::on(src1, src2, src3);
299 GMat merge4(const GMat& src1, const GMat& src2, const GMat& src3, const GMat& src4)
301 return core::GMerge4::on(src1, src2, src3, src4);
304 GMat resize(const GMat& src, const Size& dsize, double fx, double fy, int interpolation)
306 return core::GResize::on(src, dsize, fx, fy, interpolation);
309 GMatP resizeP(const GMatP& src, const Size& dsize, int interpolation)
311 return core::GResizeP::on(src, dsize, interpolation);
314 GMat remap(const GMat& src, const Mat& map1, const Mat& map2,
315 int interpolation, int borderMode,
316 const Scalar& borderValue)
318 return core::GRemap::on(src, map1, map2, interpolation, borderMode, borderValue);
321 GMat flip(const GMat& src, int flipCode)
323 return core::GFlip::on(src, flipCode);
326 GMat crop(const GMat& src, const Rect& rect)
328 return core::GCrop::on(src, rect);
331 GMat copy(const GMat& src)
333 return core::GCopy::on(src);
336 GMat concatHor(const GMat& src1, const GMat& src2)
338 return core::GConcatHor::on(src1, src2);
341 GMat concatHor(const std::vector<GMat>& v)
343 GAPI_Assert(v.size() >= 2);
344 return std::accumulate(v.begin()+1, v.end(), v[0], core::GConcatHor::on);
347 GMat concatVert(const GMat& src1, const GMat& src2)
349 return core::GConcatVert::on(src1, src2);
352 GMat concatVert(const std::vector<GMat>& v)
354 GAPI_Assert(v.size() >= 2);
355 return std::accumulate(v.begin()+1, v.end(), v[0], core::GConcatVert::on);
358 GMat LUT(const GMat& src, const Mat& lut)
360 return core::GLUT::on(src, lut);
363 GMat convertTo(const GMat& m, int rtype, double alpha, double beta)
365 return core::GConvertTo::on(m, rtype, alpha, beta);
368 GMat sqrt(const GMat& src)
370 return core::GSqrt::on(src);
373 GMat normalize(const GMat& _src, double a, double b,
374 int norm_type, int ddepth)
376 return core::GNormalize::on(_src, a, b, norm_type, ddepth);
379 GMat warpPerspective(const GMat& src, const Mat& M, const Size& dsize, int flags,
380 int borderMode, const Scalar& borderValue)
382 return core::GWarpPerspective::on(src, M, dsize, flags, borderMode, borderValue);
385 GMat warpAffine(const GMat& src, const Mat& M, const Size& dsize, int flags,
386 int borderMode, const Scalar& borderValue)
388 return core::GWarpAffine::on(src, M, dsize, flags, borderMode, borderValue);
391 GOpaque<Size> size(const GMat& src)
393 return core::GSize::on(src);
396 GOpaque<Size> size(const GOpaque<Rect>& r)
398 return core::GSizeR::on(r);