forked from udarrr/opencv4nodejs-prebuilt-install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSVM.h
52 lines (43 loc) · 1.56 KB
/
SVM.h
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
#include "NativeNodeUtils.h"
#include "macros.h"
#include <opencv2/ml.hpp>
#include "Mat.h"
#include "TrainData.h"
#include "ParamGrid.h"
#include "CatchCvExceptionWorker.h"
#ifndef __FF_SVM_H__
#define __FF_SVM_H__
class SVM: public FF::ObjectWrap<SVM, cv::Ptr<cv::ml::SVM>> {
public:
static Nan::Persistent<v8::FunctionTemplate> constructor;
static const char* getClassName() {
return "SVM";
}
void setParams(v8::Local<v8::Object> params);
static NAN_MODULE_INIT(Init);
FF_GETTER_CUSTOM(c, FF::DoubleConverter, self->getC());
FF_GETTER_CUSTOM(coef0, FF::DoubleConverter, self->getCoef0());
FF_GETTER_CUSTOM(degree, FF::DoubleConverter, self->getDegree());
FF_GETTER_CUSTOM(gamma, FF::DoubleConverter, self->getGamma());
FF_GETTER_CUSTOM(nu, FF::DoubleConverter, self->getNu());
FF_GETTER_CUSTOM(p, FF::DoubleConverter, self->getP());
FF_GETTER_CUSTOM(kernelType, FF::IntConverter, self->getKernelType());
FF_GETTER_CUSTOM(varCount, FF::IntConverter, self->getVarCount());
FF_GETTER_CUSTOM(isTrained, FF::BoolConverter, self->isTrained());
FF_GETTER_CUSTOM(classWeights, Mat::Converter, self->getClassWeights());
// TODO custom kernel
static NAN_METHOD(New);
static NAN_METHOD(SetParams);
static NAN_METHOD(Predict);
static NAN_METHOD(GetSupportVectors);
static NAN_METHOD(GetUncompressedSupportVectors);
static NAN_METHOD(GetDecisionFunction);
static NAN_METHOD(CalcError);
static NAN_METHOD(Save);
static NAN_METHOD(Load);
static NAN_METHOD(Train);
static NAN_METHOD(TrainAsync);
static NAN_METHOD(TrainAuto);
static NAN_METHOD(TrainAutoAsync);
};
#endif