mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
wrap add function
This commit is contained in:
parent
fe2b18e0a7
commit
430976cb1a
@ -68,6 +68,7 @@ void Matrix::Init(Local<Object> target) {
|
|||||||
Nan::SetPrototypeMethod(ctor, "dct", Dct);
|
Nan::SetPrototypeMethod(ctor, "dct", Dct);
|
||||||
Nan::SetPrototypeMethod(ctor, "idct", Idct);
|
Nan::SetPrototypeMethod(ctor, "idct", Idct);
|
||||||
Nan::SetPrototypeMethod(ctor, "addWeighted", AddWeighted);
|
Nan::SetPrototypeMethod(ctor, "addWeighted", AddWeighted);
|
||||||
|
Nan::SetPrototypeMethod(ctor, "add", Add);
|
||||||
Nan::SetPrototypeMethod(ctor, "bitwiseXor", BitwiseXor);
|
Nan::SetPrototypeMethod(ctor, "bitwiseXor", BitwiseXor);
|
||||||
Nan::SetPrototypeMethod(ctor, "bitwiseNot", BitwiseNot);
|
Nan::SetPrototypeMethod(ctor, "bitwiseNot", BitwiseNot);
|
||||||
Nan::SetPrototypeMethod(ctor, "bitwiseAnd", BitwiseAnd);
|
Nan::SetPrototypeMethod(ctor, "bitwiseAnd", BitwiseAnd);
|
||||||
@ -1342,6 +1343,29 @@ NAN_METHOD(Matrix::AddWeighted) {
|
|||||||
info.GetReturnValue().Set(Nan::Null());
|
info.GetReturnValue().Set(Nan::Null());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NAN_METHOD(Matrix::Add) {
|
||||||
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
|
Matrix *self = Nan::ObjectWrap::Unwrap<Matrix>(info.This());
|
||||||
|
int cols = self->mat.cols;
|
||||||
|
int rows = self->mat.rows;
|
||||||
|
|
||||||
|
Matrix *src1 = Nan::ObjectWrap::Unwrap<Matrix>(info[0]->ToObject());
|
||||||
|
|
||||||
|
Local<Object> out = Nan::New(Matrix::constructor)->GetFunction()->NewInstance();
|
||||||
|
Matrix *m_out = Nan::ObjectWrap::Unwrap<Matrix>(out);
|
||||||
|
m_out->mat.create(cols, rows, self->mat.type());
|
||||||
|
|
||||||
|
try {
|
||||||
|
cv::add(self->mat, src1->mat, m_out->mat);
|
||||||
|
} catch(cv::Exception& e ) {
|
||||||
|
const char* err_msg = e.what();
|
||||||
|
Nan::ThrowError(err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
info.GetReturnValue().Set(out);
|
||||||
|
}
|
||||||
|
|
||||||
NAN_METHOD(Matrix::BitwiseXor) {
|
NAN_METHOD(Matrix::BitwiseXor) {
|
||||||
Nan::HandleScope scope;
|
Nan::HandleScope scope;
|
||||||
|
|
||||||
|
|||||||
@ -71,6 +71,7 @@ public:
|
|||||||
JSFUNC(Dct)
|
JSFUNC(Dct)
|
||||||
JSFUNC(Idct)
|
JSFUNC(Idct)
|
||||||
JSFUNC(AddWeighted)
|
JSFUNC(AddWeighted)
|
||||||
|
JSFUNC(Add)
|
||||||
JSFUNC(BitwiseXor)
|
JSFUNC(BitwiseXor)
|
||||||
JSFUNC(BitwiseNot)
|
JSFUNC(BitwiseNot)
|
||||||
JSFUNC(BitwiseAnd)
|
JSFUNC(BitwiseAnd)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user