Merge pull request #140 from coolblade/master

fixed a bug where minAreaRect c++ function was pointing at BoundingRect ...
This commit is contained in:
Peter Braden 2014-06-16 09:33:04 +02:00
commit a401a7ea84
3 changed files with 26 additions and 10 deletions

View File

@ -31,7 +31,7 @@ Contour::Init(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(constructor, "approxPolyDP", ApproxPolyDP); NODE_SET_PROTOTYPE_METHOD(constructor, "approxPolyDP", ApproxPolyDP);
NODE_SET_PROTOTYPE_METHOD(constructor, "convexHull", ConvexHull); NODE_SET_PROTOTYPE_METHOD(constructor, "convexHull", ConvexHull);
NODE_SET_PROTOTYPE_METHOD(constructor, "boundingRect", BoundingRect); NODE_SET_PROTOTYPE_METHOD(constructor, "boundingRect", BoundingRect);
NODE_SET_PROTOTYPE_METHOD(constructor, "minAreaRect", BoundingRect); NODE_SET_PROTOTYPE_METHOD(constructor, "minAreaRect", MinAreaRect);
NODE_SET_PROTOTYPE_METHOD(constructor, "isConvex", IsConvex); NODE_SET_PROTOTYPE_METHOD(constructor, "isConvex", IsConvex);
NODE_SET_PROTOTYPE_METHOD(constructor, "moments", Moments); NODE_SET_PROTOTYPE_METHOD(constructor, "moments", Moments);
target->Set(String::NewSymbol("Contours"), m->GetFunction()); target->Set(String::NewSymbol("Contours"), m->GetFunction());

View File

@ -67,6 +67,7 @@ Matrix::Init(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(constructor, "absDiff", AbsDiff); NODE_SET_PROTOTYPE_METHOD(constructor, "absDiff", AbsDiff);
NODE_SET_PROTOTYPE_METHOD(constructor, "addWeighted", AddWeighted); NODE_SET_PROTOTYPE_METHOD(constructor, "addWeighted", AddWeighted);
NODE_SET_PROTOTYPE_METHOD(constructor, "bitwiseXor", BitwiseXor); NODE_SET_PROTOTYPE_METHOD(constructor, "bitwiseXor", BitwiseXor);
NODE_SET_PROTOTYPE_METHOD(constructor, "bitwiseNot", BitwiseNot);
NODE_SET_PROTOTYPE_METHOD(constructor, "countNonZero", CountNonZero); NODE_SET_PROTOTYPE_METHOD(constructor, "countNonZero", CountNonZero);
NODE_SET_PROTOTYPE_METHOD(constructor, "canny", Canny); NODE_SET_PROTOTYPE_METHOD(constructor, "canny", Canny);
NODE_SET_PROTOTYPE_METHOD(constructor, "dilate", Dilate); NODE_SET_PROTOTYPE_METHOD(constructor, "dilate", Dilate);
@ -999,6 +1000,18 @@ Matrix::BitwiseXor(const v8::Arguments& args) {
return scope.Close(v8::Null()); return scope.Close(v8::Null());
} }
Handle<Value>
Matrix::BitwiseNot(const v8::Arguments& args) {
HandleScope scope;
Matrix *self = ObjectWrap::Unwrap<Matrix>(args.This());
Matrix *src1 = ObjectWrap::Unwrap<Matrix>(args[0]->ToObject());
cv::bitwise_not(src1->mat, self->mat);
return scope.Close(v8::Null());
}
Handle<Value> Handle<Value>
Matrix::CountNonZero(const v8::Arguments& args) { Matrix::CountNonZero(const v8::Arguments& args) {
HandleScope scope; HandleScope scope;
@ -1755,7 +1768,9 @@ Matrix::PutText(const v8::Arguments& args) {
color = setColor(objColor); color = setColor(objColor);
} }
cv::putText(self->mat, text, cv::Point(x, y), constFont, 1, color, 2); double scale = args.Length() < 6 ? 1 : args[5]->NumberValue();
cv::putText(self->mat, text, cv::Point(x, y), constFont, scale, color, 2);
return scope.Close(Undefined()); return scope.Close(Undefined());
} }

View File

@ -3,7 +3,7 @@
class Matrix: public node::ObjectWrap { class Matrix: public node::ObjectWrap {
public: public:
cv::Mat mat; cv::Mat mat;
static Persistent<FunctionTemplate> constructor; static Persistent<FunctionTemplate> constructor;
static void Init(Handle<Object> target); static void Init(Handle<Object> target);
static Handle<Value> New(const Arguments &args); static Handle<Value> New(const Arguments &args);
@ -57,6 +57,7 @@ class Matrix: public node::ObjectWrap {
JSFUNC(AbsDiff) JSFUNC(AbsDiff)
JSFUNC(AddWeighted) JSFUNC(AddWeighted)
JSFUNC(BitwiseXor) JSFUNC(BitwiseXor)
JSFUNC(BitwiseNot)
JSFUNC(CountNonZero) JSFUNC(CountNonZero)
//JSFUNC(Split) //JSFUNC(Split)
JSFUNC(Canny) JSFUNC(Canny)
@ -97,13 +98,13 @@ class Matrix: public node::ObjectWrap {
JSFUNC(GetPerspectiveTransform) JSFUNC(GetPerspectiveTransform)
JSFUNC(WarpPerspective) JSFUNC(WarpPerspective)
/* /*
static Handle<Value> Val(const Arguments& args); static Handle<Value> Val(const Arguments& args);
static Handle<Value> RowRange(const Arguments& args); static Handle<Value> RowRange(const Arguments& args);
static Handle<Value> ColRange(const Arguments& args); static Handle<Value> ColRange(const Arguments& args);
static Handle<Value> Diag(const Arguments& args); static Handle<Value> Diag(const Arguments& args);
static Handle<Value> Clone(const Arguments& args); static Handle<Value> Clone(const Arguments& args);
static Handle<Value> CopyTo(const Arguments& args); static Handle<Value> CopyTo(const Arguments& args);
static Handle<Value> ConvertTo(const Arguments& args); static Handle<Value> ConvertTo(const Arguments& args);
static Handle<Value> AssignTo(const Arguments& args); static Handle<Value> AssignTo(const Arguments& args);
static Handle<Value> SetTo(const Arguments& args); static Handle<Value> SetTo(const Arguments& args);
static Handle<Value> Reshape(const Arguments& args); static Handle<Value> Reshape(const Arguments& args);