mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
add bindings for isConvex in contours
This commit is contained in:
parent
e3280ddc1e
commit
d2e8b1969f
@ -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());
|
||||
};
|
||||
|
||||
@ -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]))));
|
||||
}
|
||||
|
||||
@ -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&);
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user