Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/gapi/src/api/kernels_core.cpp
16339 views
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 Intel Corporation
6
7
8
#include "precomp.hpp"
9
10
#include "opencv2/gapi/gcall.hpp"
11
#include "opencv2/gapi/gscalar.hpp"
12
#include "opencv2/gapi/gkernel.hpp"
13
#include "opencv2/gapi/core.hpp"
14
15
#include <tuple>
16
#include <numeric>
17
18
namespace cv { namespace gapi {
19
20
GMat add(const GMat& src1, const GMat& src2, int dtype)
21
{
22
return core::GAdd::on(src1, src2, dtype);
23
}
24
25
GMat addC(const GMat& src1, const GScalar& c, int dtype)
26
{
27
return core::GAddC::on(src1, c, dtype);
28
}
29
30
GMat addC(const GScalar& c, const GMat& src1, int dtype)
31
{
32
return core::GAddC::on(src1, c, dtype);
33
}
34
35
GMat sub(const GMat& src1, const GMat& src2, int dtype)
36
{
37
return core::GSub::on(src1, src2, dtype);
38
}
39
40
GMat subC(const GMat& src1, const GScalar& c, int dtype)
41
{
42
return core::GSubC::on(src1, c, dtype);
43
}
44
45
GMat subRC(const GScalar& c, const GMat& src, int dtype)
46
{
47
return core::GSubRC::on(c, src, dtype);
48
}
49
50
GMat mul(const GMat& src1, const GMat& src2, double scale, int dtype)
51
{
52
return core::GMul::on(src1, src2, scale, dtype);
53
}
54
55
GMat mulC(const GMat& src, double scale, int dtype)
56
{
57
return core::GMulCOld::on(src, scale, dtype);
58
}
59
60
GMat mulC(const GMat& src, const GScalar& multiplier, int dtype)
61
{
62
return core::GMulC::on(src, multiplier, dtype);
63
}
64
65
GMat mulC(const GScalar& multiplier, const GMat& src, int dtype)
66
{
67
return core::GMulC::on(src, multiplier, dtype);
68
}
69
70
GMat div(const GMat& src1, const GMat& src2, double scale, int dtype)
71
{
72
return core::GDiv::on(src1, src2, scale, dtype);
73
}
74
75
GMat divC(const GMat& src, const GScalar& divisor, double scale, int dtype)
76
{
77
return core::GDivC::on(src, divisor, scale, dtype);
78
}
79
80
GMat divRC(const GScalar& divident, const GMat& src, double scale, int dtype)
81
{
82
return core::GDivRC::on(divident, src, scale, dtype);
83
}
84
85
GScalar mean(const GMat& src)
86
{
87
return core::GMean::on(src);
88
}
89
90
GMat mask(const GMat& src, const GMat& mask)
91
{
92
return core::GMask::on(src, mask);
93
}
94
95
std::tuple<GMat, GMat> polarToCart(const GMat& magnitude, const GMat& angle,
96
bool angleInDegrees)
97
{
98
return core::GPolarToCart::on(magnitude, angle, angleInDegrees);
99
}
100
101
std::tuple<GMat, GMat> cartToPolar(const GMat& x, const GMat& y,
102
bool angleInDegrees)
103
{
104
return core::GCartToPolar::on(x, y, angleInDegrees);
105
}
106
107
GMat cmpGT(const GMat& src1, const GMat& src2)
108
{
109
return core::GCmpGT::on(src1, src2);
110
}
111
112
GMat cmpLT(const GMat& src1, const GMat& src2)
113
{
114
return core::GCmpLT::on(src1, src2);
115
}
116
117
GMat cmpGE(const GMat& src1, const GMat& src2)
118
{
119
return core::GCmpGE::on(src1, src2);
120
}
121
122
GMat cmpLE(const GMat& src1, const GMat& src2)
123
{
124
return core::GCmpLE::on(src1, src2);
125
}
126
127
GMat cmpEQ(const GMat& src1, const GMat& src2)
128
{
129
return core::GCmpEQ::on(src1, src2);
130
}
131
132
GMat cmpNE(const GMat& src1, const GMat& src2)
133
{
134
return core::GCmpNE::on(src1, src2);
135
}
136
137
GMat cmpGT(const GMat& src1, const GScalar& src2)
138
{
139
return core::GCmpGTScalar::on(src1, src2);
140
}
141
142
GMat cmpLT(const GMat& src1, const GScalar& src2)
143
{
144
return core::GCmpLTScalar::on(src1, src2);
145
}
146
147
GMat cmpGE(const GMat& src1, const GScalar& src2)
148
{
149
return core::GCmpGEScalar::on(src1, src2);
150
}
151
152
GMat cmpLE(const GMat& src1, const GScalar& src2)
153
{
154
return core::GCmpLEScalar::on(src1, src2);
155
}
156
157
GMat cmpEQ(const GMat& src1, const GScalar& src2)
158
{
159
return core::GCmpEQScalar::on(src1, src2);
160
}
161
162
GMat cmpNE(const GMat& src1, const GScalar& src2)
163
{
164
return core::GCmpNEScalar::on(src1, src2);
165
}
166
167
GMat min(const GMat& src1, const GMat& src2)
168
{
169
return core::GMin::on(src1, src2);
170
}
171
172
GMat max(const GMat& src1, const GMat& src2)
173
{
174
return core::GMax::on(src1, src2);
175
}
176
177
GMat absDiff(const GMat& src1, const GMat& src2)
178
{
179
return core::GAbsDiff::on(src1, src2);
180
}
181
182
GMat absDiffC(const GMat& src, const GScalar& c)
183
{
184
return core::GAbsDiffC::on(src, c);
185
}
186
187
GMat bitwise_and(const GMat& src1, const GMat& src2)
188
{
189
return core::GAnd::on(src1, src2);
190
}
191
192
GMat bitwise_and(const GMat& src1, const GScalar& src2)
193
{
194
return core::GAndS::on(src1, src2);
195
}
196
197
GMat bitwise_or(const GMat& src1, const GMat& src2)
198
{
199
return core::GOr::on(src1, src2);
200
}
201
202
GMat bitwise_or(const GMat& src1, const GScalar& src2)
203
{
204
return core::GOrS::on(src1, src2);
205
}
206
207
GMat bitwise_xor(const GMat& src1, const GMat& src2)
208
{
209
return core::GXor::on(src1, src2);
210
}
211
212
GMat bitwise_xor(const GMat& src1, const GScalar& src2)
213
{
214
return core::GXorS::on(src1, src2);
215
}
216
217
GMat bitwise_not(const GMat& src1)
218
{
219
return core::GNot::on(src1);
220
}
221
222
GMat select(const GMat& src1, const GMat& src2, const GMat& mask)
223
{
224
return core::GSelect::on(src1, src2, mask);
225
}
226
227
GScalar sum(const GMat& src)
228
{
229
return core::GSum::on(src);
230
}
231
232
GMat addWeighted(const GMat& src1, double alpha, const GMat& src2, double beta, double gamma, int dtype)
233
{
234
return core::GAddW::on(src1, alpha, src2, beta, gamma, dtype);
235
}
236
237
GScalar normL1(const GMat& src)
238
{
239
return core::GNormL1::on(src);
240
}
241
242
GScalar normL2(const GMat& src)
243
{
244
return core::GNormL2::on(src);
245
}
246
247
GScalar normInf(const GMat& src)
248
{
249
return core::GNormInf::on(src);
250
}
251
252
std::tuple<GMat, GMat> integral(const GMat& src, int sdepth, int sqdepth)
253
{
254
return core::GIntegral::on(src, sdepth, sqdepth);
255
}
256
257
GMat threshold(const GMat& src, const GScalar& thresh, const GScalar& maxval, int type)
258
{
259
GAPI_Assert(type != cv::THRESH_TRIANGLE && type != cv::THRESH_OTSU);
260
return core::GThreshold::on(src, thresh, maxval, type);
261
}
262
263
std::tuple<GMat, GScalar> threshold(const GMat& src, const GScalar& maxval, int type)
264
{
265
GAPI_Assert(type == cv::THRESH_TRIANGLE || type == cv::THRESH_OTSU);
266
return core::GThresholdOT::on(src, maxval, type);
267
}
268
269
GMat inRange(const GMat& src, const GScalar& threshLow, const GScalar& threshUp)
270
{
271
return core::GInRange::on(src, threshLow, threshUp);
272
}
273
274
std::tuple<GMat, GMat, GMat> split3(const GMat& src)
275
{
276
return core::GSplit3::on(src);
277
}
278
279
std::tuple<GMat, GMat, GMat, GMat> split4(const GMat& src)
280
{
281
return core::GSplit4::on(src);
282
}
283
284
GMat merge3(const GMat& src1, const GMat& src2, const GMat& src3)
285
{
286
return core::GMerge3::on(src1, src2, src3);
287
}
288
289
GMat merge4(const GMat& src1, const GMat& src2, const GMat& src3, const GMat& src4)
290
{
291
return core::GMerge4::on(src1, src2, src3, src4);
292
}
293
294
GMat resize(const GMat& src, const Size& dsize, double fx, double fy, int interpolation)
295
{
296
return core::GResize::on(src, dsize, fx, fy, interpolation);
297
}
298
299
GMat remap(const GMat& src, const Mat& map1, const Mat& map2,
300
int interpolation, int borderMode,
301
const Scalar& borderValue)
302
{
303
return core::GRemap::on(src, map1, map2, interpolation, borderMode, borderValue);
304
}
305
306
GMat flip(const GMat& src, int flipCode)
307
{
308
return core::GFlip::on(src, flipCode);
309
}
310
311
GMat crop(const GMat& src, const Rect& rect)
312
{
313
return core::GCrop::on(src, rect);
314
}
315
316
GMat concatHor(const GMat& src1, const GMat& src2)
317
{
318
return core::GConcatHor::on(src1, src2);
319
}
320
321
GMat concatHor(const std::vector<GMat>& v)
322
{
323
GAPI_Assert(v.size() >= 2);
324
return std::accumulate(v.begin()+1, v.end(), v[0], core::GConcatHor::on);
325
}
326
327
GMat concatVert(const GMat& src1, const GMat& src2)
328
{
329
return core::GConcatVert::on(src1, src2);
330
}
331
332
GMat concatVert(const std::vector<GMat>& v)
333
{
334
GAPI_Assert(v.size() >= 2);
335
return std::accumulate(v.begin()+1, v.end(), v[0], core::GConcatVert::on);
336
}
337
338
GMat LUT(const GMat& src, const Mat& lut)
339
{
340
return core::GLUT::on(src, lut);
341
}
342
343
GMat convertTo(const GMat& m, int rtype, double alpha, double beta)
344
{
345
return core::GConvertTo::on(m, rtype, alpha, beta);
346
}
347
348
} //namespace gapi
349
} //namespace cv
350
351