Skip to content

Commit

Permalink
add bindings for isConvex in contours
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Tiare LE BIGOT committed Jan 20, 2013
1 parent e3280dd commit d2e8b19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Contours.cc
Expand Up @@ -27,6 +27,7 @@ Contour::Init(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(constructor, "area", Area);
NODE_SET_PROTOTYPE_METHOD(constructor, "arcLength", ArcLength);
NODE_SET_PROTOTYPE_METHOD(constructor, "approxPolyDP", ApproxPolyDP);
NODE_SET_PROTOTYPE_METHOD(constructor, "isConvex", IsConvex);
target->Set(String::NewSymbol("Contours"), m->GetFunction());
};

Expand Down Expand Up @@ -99,3 +100,14 @@ Contour::ApproxPolyDP(const Arguments &args) {

return scope.Close(v8::Null());
}


Handle<Value>
Contour::IsConvex(const Arguments &args) {
HandleScope scope;

Contour *self = ObjectWrap::Unwrap<Contour>(args.This());
int pos = args[0]->NumberValue();

return scope.Close(Boolean::New(isContourConvex(cv::Mat(self->contours[pos]))));
}
1 change: 1 addition & 0 deletions src/Contours.h
Expand Up @@ -18,5 +18,6 @@ class Contour: public node::ObjectWrap {
static Handle<Value> Area(const v8::Arguments&);
static Handle<Value> ArcLength(const v8::Arguments&);
static Handle<Value> ApproxPolyDP(const v8::Arguments&);
static Handle<Value> IsConvex(const v8::Arguments&);
};

0 comments on commit d2e8b19

Please sign in to comment.