forked from hybridgroup/gocv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharithm.go
529 lines (461 loc) · 18.7 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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
package cuda
/*
#include <stdlib.h>
#include "../core.h"
#include "core.h"
#include "arithm.h"
*/
import "C"
import (
"unsafe"
"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#ga497cc0615bf717e1e615143b56f00591
func Multiply(src1, src2 GpuMat, dst *GpuMat) {
C.GpuMultiply(src1.p, src2.p, dst.p, nil)
}
// MultiplyWithStream computes a matrix-matrix or matrix-scalar multiplication.
//
// For further details, please see:
// https://docs.opencv.org/master/d8/d34/group__cudaarithm__elem.html#ga497cc0615bf717e1e615143b56f00591
func MultiplyWithStream(src1, src2 GpuMat, dst *GpuMat, s Stream) {
C.GpuMultiply(src1.p, src2.p, dst.p, s.p)
}
// 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)
}
// Merge makes a multi-channel matrix out of several single-channel matrices.
//
// For further details, please see:
// https://docs.opencv.org/4.x/de/d09/group__cudaarithm__core.html#gafce19eb0fcad23f67ab45d544992436d
func Merge(mv []GpuMat, dst *GpuMat) {
cMatArray := make([]C.GpuMat, len(mv))
for i, r := range mv {
cMatArray[i] = r.p
}
cMats := C.GpuMats{
mats: (*C.GpuMat)(&cMatArray[0]),
length: C.int(len(mv)),
}
C.GpuMerge(cMats, dst.p, nil)
}
// MergeWithStream makes a multi-channel matrix out of several single-channel matrices
// using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/4.x/de/d09/group__cudaarithm__core.html#gafce19eb0fcad23f67ab45d544992436d
func MergeWithStream(mv []GpuMat, dst *GpuMat, s Stream) {
cMatArray := make([]C.GpuMat, len(mv))
for i, r := range mv {
cMatArray[i] = r.p
}
cMats := C.GpuMats{
mats: (*C.GpuMat)(&cMatArray[0]),
length: C.int(len(mv)),
}
C.GpuMerge(cMats, dst.p, s.p)
}
// Transpose transposes a matrix.
//
// For further details, please see:
// https://docs.opencv.org/4.x/de/d09/group__cudaarithm__core.html#ga327b71c3cb811a904ccf5fba37fc29f2
func Transpose(src GpuMat, dst *GpuMat) {
C.GpuTranspose(src.p, dst.p, nil)
}
// Transpose transposes a matrix using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/4.x/de/d09/group__cudaarithm__core.html#ga327b71c3cb811a904ccf5fba37fc29f2
func TransposeWithStream(src GpuMat, dst *GpuMat, s Stream) {
C.GpuTranspose(src.p, dst.p, s.p)
}
// AddWeighted computes a weighted sum of two matrices.
//
// For further details, please see:
// https://docs.opencv.org/4.x/d8/d34/group__cudaarithm__elem.html#ga2cd14a684ea70c6ab2a63ee90ffe6201
func AddWeighted(src1 GpuMat, alpha float64, src2 GpuMat, beta float64, gamma float64, dst *GpuMat, dType int) {
C.GpuAddWeighted(src1.p, C.double(alpha), src2.p, C.double(beta), C.double(gamma), dst.p, C.int(dType), nil)
}
// AddWeightedWithStream computes a weighted sum of two matrices using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/4.x/d8/d34/group__cudaarithm__elem.html#ga2cd14a684ea70c6ab2a63ee90ffe6201
func AddWeightedWithStream(src1 GpuMat, alpha float64, src2 GpuMat, beta float64, gamma float64, dst *GpuMat, dType int, s Stream) {
C.GpuAddWeighted(src1.p, C.double(alpha), src2.p, C.double(beta), C.double(gamma), dst.p, C.int(dType), s.p)
}
// CopyMakeBorder forms a border around an image.
//
// For further details, please see:
// https://docs.opencv.org/master/de/d09/group__cudaarithm__core.html#ga5368db7656eacf846b40089c98053a49
func CopyMakeBorder(src GpuMat, dst *GpuMat, top, bottom, left, right int, borderType gocv.BorderType, value gocv.Scalar) {
bv := C.struct_Scalar{
val1: C.double(value.Val1),
val2: C.double(value.Val2),
val3: C.double(value.Val3),
val4: C.double(value.Val4),
}
C.GpuCopyMakeBorder(src.p, dst.p, C.int(top), C.int(bottom), C.int(left), C.int(right), C.int(borderType), bv, nil)
}
// CopyMakeBorderWithStream forms a border around an image using a Stream for concurrency.
//
// For further details, please see:
// https://docs.opencv.org/master/de/d09/group__cudaarithm__core.html#ga5368db7656eacf846b40089c98053a49
func CopyMakeBorderWithStream(src GpuMat, dst *GpuMat, top, bottom, left, right int, borderType gocv.BorderType, value gocv.Scalar, s Stream) {
bv := C.struct_Scalar{
val1: C.double(value.Val1),
val2: C.double(value.Val2),
val3: C.double(value.Val3),
val4: C.double(value.Val4),
}
C.GpuCopyMakeBorder(src.p, dst.p, C.int(top), C.int(bottom), C.int(left), C.int(right), C.int(borderType), bv, s.p)
}
type LookUpTable struct {
p C.LookUpTable
}
// NewLookUpTable Creates implementation for cuda::LookUpTable .
//
// lut Look-up table of 256 elements. It is a continuous CV_8U matrix.
//
// For further details, please see:
// https://docs.opencv.org/4.x/de/d09/group__cudaarithm__core.html#gaa75254a07dcf7996b4b5a68d383847f8
func NewLookUpTable(lut GpuMat) LookUpTable {
return LookUpTable{p: C.Cuda_Create_LookUpTable(lut.p)}
}
// Close releases LookUpTable resources.
func (lt *LookUpTable) Close() {
C.Cuda_LookUpTable_Close(lt.p)
}
// Transform Transforms the source matrix into the destination
// matrix using the given look-up table: dst(I) = lut(src(I)) .
//
// src: Source matrix. CV_8UC1 and CV_8UC3 matrices are supported for now.
//
// dst: Destination matrix.
//
// For further details, please see:
// https://docs.opencv.org/4.x/df/d29/classcv_1_1cuda_1_1LookUpTable.html#afdbcbd3047f847451892f3b18cd018de
func (lt *LookUpTable) Transform(src GpuMat, dst *GpuMat) {
C.Cuda_LookUpTable_Transform(lt.p, src.p, dst.p, nil)
}
// Empty Returns true if the Algorithm is empty
// (e.g. in the very beginning or after unsuccessful read.
//
// For further details, please see:
// https://docs.opencv.org/4.x/d3/d46/classcv_1_1Algorithm.html#a827c8b2781ed17574805f373e6054ff1
func (lt *LookUpTable) Empty() bool {
b := C.Cuda_LookUpTable_Empty(lt.p)
return bool(b)
}
// TransformWithStream Transforms the source matrix into the destination
// matrix using the given look-up table: dst(I) = lut(src(I)) .
//
// src: Source matrix. CV_8UC1 and CV_8UC3 matrices are supported for now.
//
// dst: Destination matrix.
//
// stream: Stream for the asynchronous version.
//
// For further details, please see:
// https://docs.opencv.org/4.x/df/d29/classcv_1_1cuda_1_1LookUpTable.html#afdbcbd3047f847451892f3b18cd018de
func (lt *LookUpTable) TransformWithStream(src GpuMat, dst *GpuMat, s Stream) {
C.Cuda_LookUpTable_Transform(lt.p, src.p, dst.p, s.p)
}
// Split Copies each plane of a multi-channel matrix into an array.
//
// src: Source matrix.
//
// dst: Destination array/vector of single-channel matrices.
//
// For further details, please see:
// https://docs.opencv.org/4.x/de/d09/group__cudaarithm__core.html#gaf1714e7a9ea0719c29bf378beaf5f99d
func Split(src GpuMat, dst []GpuMat) {
dstv := make([]C.GpuMat, len(dst))
for i := range dst {
dstv[i] = dst[i].p
}
c_dstv := C.GpuMats{
mats: unsafe.SliceData(dstv),
length: C.int(len(dstv)),
}
C.Cuda_Split(src.p, c_dstv, nil)
}
// SplitWithStream Copies each plane of a multi-channel matrix into an array.
//
// src: Source matrix.
//
// dst: Destination array/vector of single-channel matrices.
//
// stream: Stream for the asynchronous version.
//
// For further details, please see:
// https://docs.opencv.org/4.x/de/d09/group__cudaarithm__core.html#gaf1714e7a9ea0719c29bf378beaf5f99d
func SplitWithStream(src GpuMat, dst []GpuMat, s Stream) {
dstv := make([]C.GpuMat, len(dst))
for i := range dst {
dstv[i] = dst[i].p
}
c_dstv := C.GpuMats{
mats: unsafe.SliceData(dstv),
length: C.int(len(dstv)),
}
C.Cuda_Split(src.p, c_dstv, s.p)
}