forked from hybridgroup/gocv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
arithm.go
347 lines (310 loc) · 11.8 KB
/
arithm.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
package cuda
/*
#include <stdlib.h>
#include "../core.h"
#include "core.h"
#include "arithm.h"
*/
import "C"
import "gocv.io/x/gocv"
// Abs computes an absolute value of each matrix element.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga54a72bd772494ab34d05406fd76df2b6
//
func Abs(src GpuMat, dst *GpuMat) {
C.GpuAbs(src.p, dst.p, nil)
}
// AbsWithStream computes an absolute value of each matrix element
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga54a72bd772494ab34d05406fd76df2b6
//
func AbsWithStream(src GpuMat, dst *GpuMat, stream Stream) {
C.GpuAbs(src.p, dst.p, stream.p)
}
// AbsDiff computes per-element absolute difference of two matrices
// (or of a matrix and scalar) using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gac062b283cf46ee90f74a773d3382ab54
//
func AbsDiff(src1, src2 GpuMat, dst *GpuMat) {
C.GpuAbsDiff(src1.p, src2.p, dst.p, nil)
}
// AbsDiffWithStream computes an absolute value of each matrix element
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gac062b283cf46ee90f74a773d3382ab54
//
func AbsDiffWithStream(src1, src2 GpuMat, dst *GpuMat, s Stream) {
C.GpuAbsDiff(src1.p, src2.p, dst.p, s.p)
}
// Add computes a matrix-matrix or matrix-scalar sum.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga5d9794bde97ed23d1c1485249074a8b1
//
func Add(src1, src2 GpuMat, dst *GpuMat) {
C.GpuAdd(src1.p, src2.p, dst.p, nil)
}
// AddWithStream computes a matrix-matrix or matrix-scalar sum
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga5d9794bde97ed23d1c1485249074a8b1
//
func AddWithStream(src1, src2 GpuMat, dst *GpuMat, s Stream) {
C.GpuAdd(src1.p, src2.p, dst.p, s.p)
}
// BitwiseAnd performs a per-element bitwise conjunction of two matrices
// (or of matrix and scalar).
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga78d7c1a013877abd4237fbfc4e13bd76
//
func BitwiseAnd(src1, src2 GpuMat, dst *GpuMat) {
C.GpuBitwiseAnd(src1.p, src2.p, dst.p, nil)
}
// BitwiseAndWithStream performs a per-element bitwise conjunction of two matrices
// (or of matrix and scalar) using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga78d7c1a013877abd4237fbfc4e13bd76
//
func BitwiseAndWithStream(src1, src2 GpuMat, dst *GpuMat, s Stream) {
C.GpuBitwiseAnd(src1.p, src2.p, dst.p, s.p)
}
// BitwiseNot performs a per-element bitwise inversion.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gae58159a2259ae1acc76b531c171cf06a
//
func BitwiseNot(src GpuMat, dst *GpuMat) {
C.GpuBitwiseNot(src.p, dst.p, nil)
}
// BitwiseNotWithStream performs a per-element bitwise inversion
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gae58159a2259ae1acc76b531c171cf06a
//
func BitwiseNotWithStream(src GpuMat, dst *GpuMat, s Stream) {
C.GpuBitwiseNot(src.p, dst.p, s.p)
}
// BitwiseOr performs a per-element bitwise disjunction of two matrices
// (or of matrix and scalar).
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gafd098ee3e51c68daa793999c1da3dfb7
//
func BitwiseOr(src1, src2 GpuMat, dst *GpuMat) {
C.GpuBitwiseOr(src1.p, src2.p, dst.p, nil)
}
// BitwiseOrWithStream performs a per-element bitwise disjunction of two matrices
// (or of matrix and scalar) using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gafd098ee3e51c68daa793999c1da3dfb7
//
func BitwiseOrWithStream(src1, src2 GpuMat, dst *GpuMat, s Stream) {
C.GpuBitwiseXor(src1.p, src2.p, dst.p, s.p)
}
// BitwiseXor performs a per-element exclusive or of two matrices
// (or of matrix and scalar).
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga3d95d4faafb099aacf18e8b915a4ad8d
//
func BitwiseXor(src1, src2 GpuMat, dst *GpuMat) {
C.GpuBitwiseXor(src1.p, src2.p, dst.p, nil)
}
// BitwiseXorWithStream performs a per-element exclusive or of two matrices
// (or of matrix and scalar) using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga3d95d4faafb099aacf18e8b915a4ad8d
//
func BitwiseXorWithStream(src1, src2 GpuMat, dst *GpuMat, s Stream) {
C.GpuBitwiseXor(src1.p, src2.p, dst.p, s.p)
}
// Divide computes a matrix-matrix or matrix-scalar division.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga124315aa226260841e25cc0b9ea99dc3
//
func Divide(src1, src2 GpuMat, dst *GpuMat) {
C.GpuDivide(src1.p, src2.p, dst.p, nil)
}
// DivideWithStream computes a matrix-matrix or matrix-scalar division
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga124315aa226260841e25cc0b9ea99dc3
//
func DivideWithStream(src1, src2 GpuMat, dst *GpuMat, s Stream) {
C.GpuDivide(src1.p, src2.p, dst.p, s.p)
}
// Exp computes an exponent of each matrix element.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gac6e51541d3bb0a7a396128e4d5919b61
//
func Exp(src GpuMat, dst *GpuMat) {
C.GpuExp(src.p, dst.p, nil)
}
// ExpWithStream computes an exponent of each matrix element
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gac6e51541d3bb0a7a396128e4d5919b61
//
func ExpWithStream(src GpuMat, dst *GpuMat, s Stream) {
C.GpuExp(src.p, dst.p, s.p)
}
// Log computes natural logarithm of absolute value of each matrix element.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gac6e51541d3bb0a7a396128e4d5919b61
//
func Log(src GpuMat, dst *GpuMat) {
C.GpuLog(src.p, dst.p, nil)
}
// LogWithStream computes natural logarithm of absolute value of each matrix element
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gac6e51541d3bb0a7a396128e4d5919b61
//
func LogWithStream(src GpuMat, dst *GpuMat, s Stream) {
C.GpuLog(src.p, dst.p, s.p)
}
// Max computes the per-element maximum of two matrices (or a matrix and a scalar).
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gadb5dd3d870f10c0866035755b929b1e7
//
func Max(src1, src2 GpuMat, dst *GpuMat) {
C.GpuMax(src1.p, src2.p, dst.p, nil)
}
// MaxWithStream computes the per-element maximum of two matrices (or a matrix and a scalar).
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#gadb5dd3d870f10c0866035755b929b1e7
//
func MaxWithStream(src1, src2 GpuMat, dst *GpuMat, s Stream) {
C.GpuMax(src1.p, src2.p, dst.p, s.p)
}
// Min computes the per-element minimum of two matrices (or a matrix and a scalar).
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga74f0b05a65b3d949c237abb5e6c60867
//
func Min(src1, src2 GpuMat, dst *GpuMat) {
C.GpuMin(src1.p, src2.p, dst.p, nil)
}
// MinWithStream computes the per-element minimum of two matrices (or a matrix and a scalar).
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga74f0b05a65b3d949c237abb5e6c60867
//
func MinWithStream(src1, src2 GpuMat, dst *GpuMat, s Stream) {
C.GpuMin(src1.p, src2.p, dst.p, s.p)
}
// Multiply computes a matrix-matrix or matrix-scalar multiplication.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga124315aa226260841e25cc0b9ea99dc3
//
func Multiply(src1, src2 GpuMat, dst *GpuMat) {
C.GpuMultiply(src1.p, src2.p, dst.p, nil)
}
// Sqr computes a square value of each matrix element.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga8aae233da90ce0ffe309ab8004342acb
//
func Sqr(src GpuMat, dst *GpuMat) {
C.GpuSqr(src.p, dst.p, nil)
}
// SqrWithStream computes a square value of each matrix element
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga8aae233da90ce0ffe309ab8004342acb
//
func SqrWithStream(src GpuMat, dst *GpuMat, s Stream) {
C.GpuSqr(src.p, dst.p, s.p)
}
// Sqrt computes a square root of each matrix element.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga09303680cb1a5521a922b6d392028d8c
//
func Sqrt(src GpuMat, dst *GpuMat) {
C.GpuSqrt(src.p, dst.p, nil)
}
// SqrtWithStream computes a square root of each matrix element.
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga09303680cb1a5521a922b6d392028d8c
//
func SqrtWithStream(src GpuMat, dst *GpuMat, s Stream) {
C.GpuSqrt(src.p, dst.p, s.p)
}
// Subtract computes a matrix-matrix or matrix-scalar difference.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga6eab60fc250059e2fda79c5636bd067f
//
func Subtract(src1, src2 GpuMat, dst *GpuMat) {
C.GpuSubtract(src1.p, src2.p, dst.p, nil)
}
// SubtractWithStream computes a matrix-matrix or matrix-scalar difference
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga6eab60fc250059e2fda79c5636bd067f
//
func SubtractWithStream(src1, src2 GpuMat, dst *GpuMat, s Stream) {
C.GpuSubtract(src1.p, src2.p, dst.p, s.p)
}
// Threshold applies a fixed-level threshold to each array element.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga40f1c94ae9a9456df3cad48e3cb008e1
//
func Threshold(src GpuMat, dst *GpuMat, thresh, maxval float64, typ gocv.ThresholdType) {
C.GpuThreshold(src.p, dst.p, C.double(thresh), C.double(maxval), C.int(typ), nil)
}
// ThresholdWithStream applies a fixed-level threshold to each array element
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga40f1c94ae9a9456df3cad48e3cb008e1
//
func ThresholdWithStream(src GpuMat, dst *GpuMat, thresh, maxval float64, typ gocv.ThresholdType, s Stream) {
C.GpuThreshold(src.p, dst.p, C.double(thresh), C.double(maxval), C.int(typ), s.p)
}
// Flip flips a 2D matrix around vertical, horizontal, or both axes.
//
// For further details, please see:
// https://docs.opencv.org/master/de/d09/group__cudaarithm__core.html#ga4d0a3f2b46e8f0f1ec2b5ac178dcd871
//
func Flip(src GpuMat, dst *GpuMat, flipCode int) {
C.GpuFlip(src.p, dst.p, C.int(flipCode), nil)
}
// FlipWithStream flips a 2D matrix around vertical, horizontal, or both axes
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/de/d09/group__cudaarithm__core.html#ga4d0a3f2b46e8f0f1ec2b5ac178dcd871
//
func FlipWithStream(src GpuMat, dst *GpuMat, flipCode int, stream Stream) {
C.GpuFlip(src.p, dst.p, C.int(flipCode), stream.p)
}