Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/js/src/core_bindings.cpp
16337 views
1
/*M///////////////////////////////////////////////////////////////////////////////////////
2
//
3
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4
//
5
// By downloading, copying, installing or using the software you agree to this license.
6
// If you do not agree to this license, do not download, install,
7
// copy or use the software.
8
//
9
//
10
// License Agreement
11
// For Open Source Computer Vision Library
12
//
13
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
14
// Third party copyrights are property of their respective owners.
15
//
16
// Redistribution and use in source and binary forms, with or without modification,
17
// are permitted provided that the following conditions are met:
18
//
19
// * Redistribution's of source code must retain the above copyright notice,
20
// this list of conditions and the following disclaimer.
21
//
22
// * Redistribution's in binary form must reproduce the above copyright notice,
23
// this list of conditions and the following disclaimer in the documentation
24
// and/or other materials provided with the distribution.
25
//
26
// * The name of the copyright holders may not be used to endorse or promote products
27
// derived from this software without specific prior written permission.
28
//
29
// This software is provided by the copyright holders and contributors "as is" and
30
// any express or implied warranties, including, but not limited to, the implied
31
// warranties of merchantability and fitness for a particular purpose are disclaimed.
32
// In no event shall the Intel Corporation or contributors be liable for any direct,
33
// indirect, incidental, special, exemplary, or consequential damages
34
// (including, but not limited to, procurement of substitute goods or services;
35
// loss of use, data, or profits; or business interruption) however caused
36
// and on any theory of liability, whether in contract, strict liability,
37
// or tort (including negligence or otherwise) arising in any way out of
38
// the use of this software, even if advised of the possibility of such damage.
39
//
40
//M*/
41
42
/*M///////////////////////////////////////////////////////////////////////////////////////
43
// Author: Sajjad Taheri, University of California, Irvine. sajjadt[at]uci[dot]edu
44
//
45
// LICENSE AGREEMENT
46
// Copyright (c) 2015 The Regents of the University of California (Regents)
47
//
48
// Redistribution and use in source and binary forms, with or without
49
// modification, are permitted provided that the following conditions are met:
50
// 1. Redistributions of source code must retain the above copyright
51
// notice, this list of conditions and the following disclaimer.
52
// 2. Redistributions in binary form must reproduce the above copyright
53
// notice, this list of conditions and the following disclaimer in the
54
// documentation and/or other materials provided with the distribution.
55
// 3. Neither the name of the University nor the
56
// names of its contributors may be used to endorse or promote products
57
// derived from this software without specific prior written permission.
58
//
59
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS'' AND ANY
60
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
61
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
62
// DISCLAIMED. IN NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY
63
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
64
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
65
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
66
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
67
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
68
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
69
//M*/
70
71
#include <emscripten/bind.h>
72
73
@INCLUDES@
74
75
using namespace emscripten;
76
using namespace cv;
77
using namespace dnn;
78
79
namespace binding_utils
80
{
81
template<typename classT, typename enumT>
82
static inline typename std::underlying_type<enumT>::type classT::* underlying_ptr(enumT classT::* enum_ptr)
83
{
84
return reinterpret_cast<typename std::underlying_type<enumT>::type classT::*>(enum_ptr);
85
}
86
87
template<typename T>
88
emscripten::val matData(const cv::Mat& mat)
89
{
90
return emscripten::val(emscripten::memory_view<T>((mat.total()*mat.elemSize())/sizeof(T),
91
(T*)mat.data));
92
}
93
94
template<typename T>
95
emscripten::val matPtr(const cv::Mat& mat, int i)
96
{
97
return emscripten::val(emscripten::memory_view<T>(mat.step1(0), mat.ptr<T>(i)));
98
}
99
100
template<typename T>
101
emscripten::val matPtr(const cv::Mat& mat, int i, int j)
102
{
103
return emscripten::val(emscripten::memory_view<T>(mat.step1(1), mat.ptr<T>(i,j)));
104
}
105
106
cv::Mat* createMat(int rows, int cols, int type, intptr_t data, size_t step)
107
{
108
return new cv::Mat(rows, cols, type, reinterpret_cast<void*>(data), step);
109
}
110
111
static emscripten::val getMatSize(const cv::Mat& mat)
112
{
113
emscripten::val size = emscripten::val::array();
114
for (int i = 0; i < mat.dims; i++) {
115
size.call<void>("push", mat.size[i]);
116
}
117
return size;
118
}
119
120
static emscripten::val getMatStep(const cv::Mat& mat)
121
{
122
emscripten::val step = emscripten::val::array();
123
for (int i = 0; i < mat.dims; i++) {
124
step.call<void>("push", mat.step[i]);
125
}
126
return step;
127
}
128
129
static Mat matEye(int rows, int cols, int type)
130
{
131
return Mat(cv::Mat::eye(rows, cols, type));
132
}
133
134
static Mat matEye(Size size, int type)
135
{
136
return Mat(cv::Mat::eye(size, type));
137
}
138
139
void convertTo(const Mat& obj, Mat& m, int rtype, double alpha, double beta)
140
{
141
obj.convertTo(m, rtype, alpha, beta);
142
}
143
144
void convertTo(const Mat& obj, Mat& m, int rtype)
145
{
146
obj.convertTo(m, rtype);
147
}
148
149
void convertTo(const Mat& obj, Mat& m, int rtype, double alpha)
150
{
151
obj.convertTo(m, rtype, alpha);
152
}
153
154
Size matSize(const cv::Mat& mat)
155
{
156
return mat.size();
157
}
158
159
cv::Mat matZeros(int arg0, int arg1, int arg2)
160
{
161
return cv::Mat::zeros(arg0, arg1, arg2);
162
}
163
164
cv::Mat matZeros(cv::Size arg0, int arg1)
165
{
166
return cv::Mat::zeros(arg0,arg1);
167
}
168
169
cv::Mat matOnes(int arg0, int arg1, int arg2)
170
{
171
return cv::Mat::ones(arg0, arg1, arg2);
172
}
173
174
cv::Mat matOnes(cv::Size arg0, int arg1)
175
{
176
return cv::Mat::ones(arg0, arg1);
177
}
178
179
double matDot(const cv::Mat& obj, const Mat& mat)
180
{
181
return obj.dot(mat);
182
}
183
184
Mat matMul(const cv::Mat& obj, const Mat& mat, double scale)
185
{
186
return Mat(obj.mul(mat, scale));
187
}
188
189
Mat matT(const cv::Mat& obj)
190
{
191
return Mat(obj.t());
192
}
193
194
Mat matInv(const cv::Mat& obj, int type)
195
{
196
return Mat(obj.inv(type));
197
}
198
199
void matCopyTo(const cv::Mat& obj, cv::Mat& mat)
200
{
201
return obj.copyTo(mat);
202
}
203
204
void matCopyTo(const cv::Mat& obj, cv::Mat& mat, const cv::Mat& mask)
205
{
206
return obj.copyTo(mat, mask);
207
}
208
209
Mat matDiag(const cv::Mat& obj, int d)
210
{
211
return obj.diag(d);
212
}
213
214
Mat matDiag(const cv::Mat& obj)
215
{
216
return obj.diag();
217
}
218
219
void matSetTo(cv::Mat& obj, const cv::Scalar& s)
220
{
221
obj.setTo(s);
222
}
223
224
void matSetTo(cv::Mat& obj, const cv::Scalar& s, const cv::Mat& mask)
225
{
226
obj.setTo(s, mask);
227
}
228
229
emscripten::val rotatedRectPoints(const cv::RotatedRect& obj)
230
{
231
cv::Point2f points[4];
232
obj.points(points);
233
emscripten::val pointsArray = emscripten::val::array();
234
for (int i = 0; i < 4; i++) {
235
pointsArray.call<void>("push", points[i]);
236
}
237
return pointsArray;
238
}
239
240
Rect rotatedRectBoundingRect(const cv::RotatedRect& obj)
241
{
242
return obj.boundingRect();
243
}
244
245
Rect2f rotatedRectBoundingRect2f(const cv::RotatedRect& obj)
246
{
247
return obj.boundingRect2f();
248
}
249
250
int cvMatDepth(int flags)
251
{
252
return CV_MAT_DEPTH(flags);
253
}
254
255
class MinMaxLoc
256
{
257
public:
258
double minVal;
259
double maxVal;
260
Point minLoc;
261
Point maxLoc;
262
};
263
264
MinMaxLoc minMaxLoc(const cv::Mat& src, const cv::Mat& mask)
265
{
266
MinMaxLoc result;
267
cv::minMaxLoc(src, &result.minVal, &result.maxVal, &result.minLoc, &result.maxLoc, mask);
268
return result;
269
}
270
271
MinMaxLoc minMaxLoc_1(const cv::Mat& src)
272
{
273
MinMaxLoc result;
274
cv::minMaxLoc(src, &result.minVal, &result.maxVal, &result.minLoc, &result.maxLoc);
275
return result;
276
}
277
278
class Circle
279
{
280
public:
281
Point2f center;
282
float radius;
283
};
284
285
Circle minEnclosingCircle(const cv::Mat& points)
286
{
287
Circle circle;
288
cv::minEnclosingCircle(points, circle.center, circle.radius);
289
return circle;
290
}
291
292
emscripten::val CamShiftWrapper(const cv::Mat& arg1, Rect& arg2, TermCriteria arg3)
293
{
294
RotatedRect rotatedRect = cv::CamShift(arg1, arg2, arg3);
295
emscripten::val result = emscripten::val::array();
296
result.call<void>("push", rotatedRect);
297
result.call<void>("push", arg2);
298
return result;
299
}
300
301
emscripten::val meanShiftWrapper(const cv::Mat& arg1, Rect& arg2, TermCriteria arg3)
302
{
303
int n = cv::meanShift(arg1, arg2, arg3);
304
emscripten::val result = emscripten::val::array();
305
result.call<void>("push", n);
306
result.call<void>("push", arg2);
307
return result;
308
}
309
310
std::string getExceptionMsg(const cv::Exception& e) {
311
return e.msg;
312
}
313
314
void setExceptionMsg(cv::Exception& e, std::string msg) {
315
e.msg = msg;
316
return;
317
}
318
319
cv::Exception exceptionFromPtr(intptr_t ptr) {
320
return *reinterpret_cast<cv::Exception*>(ptr);
321
}
322
323
std::string getBuildInformation() {
324
return cv::getBuildInformation();
325
}
326
}
327
328
EMSCRIPTEN_BINDINGS(binding_utils)
329
{
330
register_vector<int>("IntVector");
331
register_vector<float>("FloatVector");
332
register_vector<double>("DoubleVector");
333
register_vector<cv::Point>("PointVector");
334
register_vector<cv::Mat>("MatVector");
335
register_vector<cv::Rect>("RectVector");
336
register_vector<cv::KeyPoint>("KeyPointVector");
337
338
emscripten::class_<cv::Mat>("Mat")
339
.constructor<>()
340
.constructor<const Mat&>()
341
.constructor<Size, int>()
342
.constructor<int, int, int>()
343
.constructor<int, int, int, const Scalar&>()
344
.constructor(&binding_utils::createMat, allow_raw_pointers())
345
346
.class_function("eye", select_overload<Mat(Size, int)>(&binding_utils::matEye))
347
.class_function("eye", select_overload<Mat(int, int, int)>(&binding_utils::matEye))
348
.class_function("ones", select_overload<Mat(Size, int)>(&binding_utils::matOnes))
349
.class_function("ones", select_overload<Mat(int, int, int)>(&binding_utils::matOnes))
350
.class_function("zeros", select_overload<Mat(Size, int)>(&binding_utils::matZeros))
351
.class_function("zeros", select_overload<Mat(int, int, int)>(&binding_utils::matZeros))
352
353
.property("rows", &cv::Mat::rows)
354
.property("cols", &cv::Mat::cols)
355
.property("matSize", &binding_utils::getMatSize)
356
.property("step", &binding_utils::getMatStep)
357
.property("data", &binding_utils::matData<unsigned char>)
358
.property("data8S", &binding_utils::matData<char>)
359
.property("data16U", &binding_utils::matData<unsigned short>)
360
.property("data16S", &binding_utils::matData<short>)
361
.property("data32S", &binding_utils::matData<int>)
362
.property("data32F", &binding_utils::matData<float>)
363
.property("data64F", &binding_utils::matData<double>)
364
365
.function("elemSize", select_overload<size_t()const>(&cv::Mat::elemSize))
366
.function("elemSize1", select_overload<size_t()const>(&cv::Mat::elemSize1))
367
.function("channels", select_overload<int()const>(&cv::Mat::channels))
368
.function("convertTo", select_overload<void(const Mat&, Mat&, int, double, double)>(&binding_utils::convertTo))
369
.function("convertTo", select_overload<void(const Mat&, Mat&, int)>(&binding_utils::convertTo))
370
.function("convertTo", select_overload<void(const Mat&, Mat&, int, double)>(&binding_utils::convertTo))
371
.function("total", select_overload<size_t()const>(&cv::Mat::total))
372
.function("row", select_overload<Mat(int)const>(&cv::Mat::row))
373
.function("create", select_overload<void(int, int, int)>(&cv::Mat::create))
374
.function("create", select_overload<void(Size, int)>(&cv::Mat::create))
375
.function("rowRange", select_overload<Mat(int, int)const>(&cv::Mat::rowRange))
376
.function("rowRange", select_overload<Mat(const Range&)const>(&cv::Mat::rowRange))
377
.function("copyTo", select_overload<void(const Mat&, Mat&)>(&binding_utils::matCopyTo))
378
.function("copyTo", select_overload<void(const Mat&, Mat&, const Mat&)>(&binding_utils::matCopyTo))
379
.function("type", select_overload<int()const>(&cv::Mat::type))
380
.function("empty", select_overload<bool()const>(&cv::Mat::empty))
381
.function("colRange", select_overload<Mat(int, int)const>(&cv::Mat::colRange))
382
.function("colRange", select_overload<Mat(const Range&)const>(&cv::Mat::colRange))
383
.function("step1", select_overload<size_t(int)const>(&cv::Mat::step1))
384
.function("clone", select_overload<Mat()const>(&cv::Mat::clone))
385
.function("depth", select_overload<int()const>(&cv::Mat::depth))
386
.function("col", select_overload<Mat(int)const>(&cv::Mat::col))
387
.function("dot", select_overload<double(const Mat&, const Mat&)>(&binding_utils::matDot))
388
.function("mul", select_overload<Mat(const Mat&, const Mat&, double)>(&binding_utils::matMul))
389
.function("inv", select_overload<Mat(const Mat&, int)>(&binding_utils::matInv))
390
.function("t", select_overload<Mat(const Mat&)>(&binding_utils::matT))
391
.function("roi", select_overload<Mat(const Rect&)const>(&cv::Mat::operator()))
392
.function("diag", select_overload<Mat(const Mat&, int)>(&binding_utils::matDiag))
393
.function("diag", select_overload<Mat(const Mat&)>(&binding_utils::matDiag))
394
.function("isContinuous", select_overload<bool()const>(&cv::Mat::isContinuous))
395
.function("setTo", select_overload<void(Mat&, const Scalar&)>(&binding_utils::matSetTo))
396
.function("setTo", select_overload<void(Mat&, const Scalar&, const Mat&)>(&binding_utils::matSetTo))
397
.function("size", select_overload<Size(const Mat&)>(&binding_utils::matSize))
398
399
.function("ptr", select_overload<val(const Mat&, int)>(&binding_utils::matPtr<unsigned char>))
400
.function("ptr", select_overload<val(const Mat&, int, int)>(&binding_utils::matPtr<unsigned char>))
401
.function("ucharPtr", select_overload<val(const Mat&, int)>(&binding_utils::matPtr<unsigned char>))
402
.function("ucharPtr", select_overload<val(const Mat&, int, int)>(&binding_utils::matPtr<unsigned char>))
403
.function("charPtr", select_overload<val(const Mat&, int)>(&binding_utils::matPtr<char>))
404
.function("charPtr", select_overload<val(const Mat&, int, int)>(&binding_utils::matPtr<char>))
405
.function("shortPtr", select_overload<val(const Mat&, int)>(&binding_utils::matPtr<short>))
406
.function("shortPtr", select_overload<val(const Mat&, int, int)>(&binding_utils::matPtr<short>))
407
.function("ushortPtr", select_overload<val(const Mat&, int)>(&binding_utils::matPtr<unsigned short>))
408
.function("ushortPtr", select_overload<val(const Mat&, int, int)>(&binding_utils::matPtr<unsigned short>))
409
.function("intPtr", select_overload<val(const Mat&, int)>(&binding_utils::matPtr<int>))
410
.function("intPtr", select_overload<val(const Mat&, int, int)>(&binding_utils::matPtr<int>))
411
.function("floatPtr", select_overload<val(const Mat&, int)>(&binding_utils::matPtr<float>))
412
.function("floatPtr", select_overload<val(const Mat&, int, int)>(&binding_utils::matPtr<float>))
413
.function("doublePtr", select_overload<val(const Mat&, int)>(&binding_utils::matPtr<double>))
414
.function("doublePtr", select_overload<val(const Mat&, int, int)>(&binding_utils::matPtr<double>))
415
416
.function("charAt", select_overload<char&(int)>(&cv::Mat::at<char>))
417
.function("charAt", select_overload<char&(int, int)>(&cv::Mat::at<char>))
418
.function("charAt", select_overload<char&(int, int, int)>(&cv::Mat::at<char>))
419
.function("ucharAt", select_overload<unsigned char&(int)>(&cv::Mat::at<unsigned char>))
420
.function("ucharAt", select_overload<unsigned char&(int, int)>(&cv::Mat::at<unsigned char>))
421
.function("ucharAt", select_overload<unsigned char&(int, int, int)>(&cv::Mat::at<unsigned char>))
422
.function("shortAt", select_overload<short&(int)>(&cv::Mat::at<short>))
423
.function("shortAt", select_overload<short&(int, int)>(&cv::Mat::at<short>))
424
.function("shortAt", select_overload<short&(int, int, int)>(&cv::Mat::at<short>))
425
.function("ushortAt", select_overload<unsigned short&(int)>(&cv::Mat::at<unsigned short>))
426
.function("ushortAt", select_overload<unsigned short&(int, int)>(&cv::Mat::at<unsigned short>))
427
.function("ushortAt", select_overload<unsigned short&(int, int, int)>(&cv::Mat::at<unsigned short>))
428
.function("intAt", select_overload<int&(int)>(&cv::Mat::at<int>) )
429
.function("intAt", select_overload<int&(int, int)>(&cv::Mat::at<int>) )
430
.function("intAt", select_overload<int&(int, int, int)>(&cv::Mat::at<int>) )
431
.function("floatAt", select_overload<float&(int)>(&cv::Mat::at<float>))
432
.function("floatAt", select_overload<float&(int, int)>(&cv::Mat::at<float>))
433
.function("floatAt", select_overload<float&(int, int, int)>(&cv::Mat::at<float>))
434
.function("doubleAt", select_overload<double&(int, int, int)>(&cv::Mat::at<double>))
435
.function("doubleAt", select_overload<double&(int)>(&cv::Mat::at<double>))
436
.function("doubleAt", select_overload<double&(int, int)>(&cv::Mat::at<double>));
437
438
emscripten::value_object<cv::Range>("Range")
439
.field("start", &cv::Range::start)
440
.field("end", &cv::Range::end);
441
442
emscripten::value_object<cv::TermCriteria>("TermCriteria")
443
.field("type", &cv::TermCriteria::type)
444
.field("maxCount", &cv::TermCriteria::maxCount)
445
.field("epsilon", &cv::TermCriteria::epsilon);
446
447
#define EMSCRIPTEN_CV_SIZE(type) \
448
emscripten::value_object<type>("#type") \
449
.field("width", &type::width) \
450
.field("height", &type::height);
451
452
EMSCRIPTEN_CV_SIZE(Size)
453
EMSCRIPTEN_CV_SIZE(Size2f)
454
455
#define EMSCRIPTEN_CV_POINT(type) \
456
emscripten::value_object<type>("#type") \
457
.field("x", &type::x) \
458
.field("y", &type::y); \
459
460
EMSCRIPTEN_CV_POINT(Point)
461
EMSCRIPTEN_CV_POINT(Point2f)
462
463
#define EMSCRIPTEN_CV_RECT(type, name) \
464
emscripten::value_object<cv::Rect_<type>> (name) \
465
.field("x", &cv::Rect_<type>::x) \
466
.field("y", &cv::Rect_<type>::y) \
467
.field("width", &cv::Rect_<type>::width) \
468
.field("height", &cv::Rect_<type>::height);
469
470
EMSCRIPTEN_CV_RECT(int, "Rect")
471
EMSCRIPTEN_CV_RECT(float, "Rect2f")
472
473
emscripten::value_object<cv::RotatedRect>("RotatedRect")
474
.field("center", &cv::RotatedRect::center)
475
.field("size", &cv::RotatedRect::size)
476
.field("angle", &cv::RotatedRect::angle);
477
478
function("rotatedRectPoints", select_overload<emscripten::val(const cv::RotatedRect&)>(&binding_utils::rotatedRectPoints));
479
function("rotatedRectBoundingRect", select_overload<Rect(const cv::RotatedRect&)>(&binding_utils::rotatedRectBoundingRect));
480
function("rotatedRectBoundingRect2f", select_overload<Rect2f(const cv::RotatedRect&)>(&binding_utils::rotatedRectBoundingRect2f));
481
482
emscripten::value_object<cv::KeyPoint>("KeyPoint")
483
.field("angle", &cv::KeyPoint::angle)
484
.field("class_id", &cv::KeyPoint::class_id)
485
.field("octave", &cv::KeyPoint::octave)
486
.field("pt", &cv::KeyPoint::pt)
487
.field("response", &cv::KeyPoint::response)
488
.field("size", &cv::KeyPoint::size);
489
490
emscripten::value_array<cv::Scalar_<double>> ("Scalar")
491
.element(index<0>())
492
.element(index<1>())
493
.element(index<2>())
494
.element(index<3>());
495
496
emscripten::value_object<binding_utils::MinMaxLoc>("MinMaxLoc")
497
.field("minVal", &binding_utils::MinMaxLoc::minVal)
498
.field("maxVal", &binding_utils::MinMaxLoc::maxVal)
499
.field("minLoc", &binding_utils::MinMaxLoc::minLoc)
500
.field("maxLoc", &binding_utils::MinMaxLoc::maxLoc);
501
502
emscripten::value_object<binding_utils::Circle>("Circle")
503
.field("center", &binding_utils::Circle::center)
504
.field("radius", &binding_utils::Circle::radius);
505
506
emscripten::value_object<cv::Moments >("Moments")
507
.field("m00", &cv::Moments::m00)
508
.field("m10", &cv::Moments::m10)
509
.field("m01", &cv::Moments::m01)
510
.field("m20", &cv::Moments::m20)
511
.field("m11", &cv::Moments::m11)
512
.field("m02", &cv::Moments::m02)
513
.field("m30", &cv::Moments::m30)
514
.field("m21", &cv::Moments::m21)
515
.field("m12", &cv::Moments::m12)
516
.field("m03", &cv::Moments::m03)
517
.field("mu20", &cv::Moments::mu20)
518
.field("mu11", &cv::Moments::mu11)
519
.field("mu02", &cv::Moments::mu02)
520
.field("mu30", &cv::Moments::mu30)
521
.field("mu21", &cv::Moments::mu21)
522
.field("mu12", &cv::Moments::mu12)
523
.field("mu03", &cv::Moments::mu03)
524
.field("nu20", &cv::Moments::nu20)
525
.field("nu11", &cv::Moments::nu11)
526
.field("nu02", &cv::Moments::nu02)
527
.field("nu30", &cv::Moments::nu30)
528
.field("nu21", &cv::Moments::nu21)
529
.field("nu12", &cv::Moments::nu12)
530
.field("nu03", &cv::Moments::nu03);
531
532
emscripten::value_object<cv::Exception>("Exception")
533
.field("code", &cv::Exception::code)
534
.field("msg", &binding_utils::getExceptionMsg, &binding_utils::setExceptionMsg);
535
536
function("exceptionFromPtr", &binding_utils::exceptionFromPtr, allow_raw_pointers());
537
538
function("minEnclosingCircle", select_overload<binding_utils::Circle(const cv::Mat&)>(&binding_utils::minEnclosingCircle));
539
540
function("minMaxLoc", select_overload<binding_utils::MinMaxLoc(const cv::Mat&, const cv::Mat&)>(&binding_utils::minMaxLoc));
541
542
function("minMaxLoc", select_overload<binding_utils::MinMaxLoc(const cv::Mat&)>(&binding_utils::minMaxLoc_1));
543
544
function("morphologyDefaultBorderValue", &cv::morphologyDefaultBorderValue);
545
546
function("CV_MAT_DEPTH", &binding_utils::cvMatDepth);
547
548
function("CamShift", select_overload<emscripten::val(const cv::Mat&, Rect&, TermCriteria)>(&binding_utils::CamShiftWrapper));
549
550
function("meanShift", select_overload<emscripten::val(const cv::Mat&, Rect&, TermCriteria)>(&binding_utils::meanShiftWrapper));
551
552
function("getBuildInformation", &binding_utils::getBuildInformation);
553
554
constant("CV_8UC1", CV_8UC1);
555
constant("CV_8UC2", CV_8UC2);
556
constant("CV_8UC3", CV_8UC3);
557
constant("CV_8UC4", CV_8UC4);
558
559
constant("CV_8SC1", CV_8SC1);
560
constant("CV_8SC2", CV_8SC2);
561
constant("CV_8SC3", CV_8SC3);
562
constant("CV_8SC4", CV_8SC4);
563
564
constant("CV_16UC1", CV_16UC1);
565
constant("CV_16UC2", CV_16UC2);
566
constant("CV_16UC3", CV_16UC3);
567
constant("CV_16UC4", CV_16UC4);
568
569
constant("CV_16SC1", CV_16SC1);
570
constant("CV_16SC2", CV_16SC2);
571
constant("CV_16SC3", CV_16SC3);
572
constant("CV_16SC4", CV_16SC4);
573
574
constant("CV_32SC1", CV_32SC1);
575
constant("CV_32SC2", CV_32SC2);
576
constant("CV_32SC3", CV_32SC3);
577
constant("CV_32SC4", CV_32SC4);
578
579
constant("CV_32FC1", CV_32FC1);
580
constant("CV_32FC2", CV_32FC2);
581
constant("CV_32FC3", CV_32FC3);
582
constant("CV_32FC4", CV_32FC4);
583
584
constant("CV_64FC1", CV_64FC1);
585
constant("CV_64FC2", CV_64FC2);
586
constant("CV_64FC3", CV_64FC3);
587
constant("CV_64FC4", CV_64FC4);
588
589
constant("CV_8U", CV_8U);
590
constant("CV_8S", CV_8S);
591
constant("CV_16U", CV_16U);
592
constant("CV_16S", CV_16S);
593
constant("CV_32S", CV_32S);
594
constant("CV_32F", CV_32F);
595
constant("CV_64F", CV_64F);
596
597
constant("INT_MIN", INT_MIN);
598
constant("INT_MAX", INT_MAX);
599
}
600
601