mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
Merge branch 'waitkey' into beta
This commit is contained in:
commit
ebd1f6e4e8
@ -4,9 +4,9 @@ var win = new cv.NamedWindow("foo");
|
|||||||
cv.readImage('./examples/stuff.png', function(e, im){
|
cv.readImage('./examples/stuff.png', function(e, im){
|
||||||
im.pyrDown();
|
im.pyrDown();
|
||||||
win.show(im);
|
win.show(im);
|
||||||
setTimeout(function(){
|
console.log(win.blockingWaitKey(0), "!!")
|
||||||
win.destroy();
|
win.destroy();
|
||||||
}, 1000)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ NamedWindow::Init(Handle<Object> target) {
|
|||||||
|
|
||||||
NODE_SET_PROTOTYPE_METHOD(constructor, "show", Show);
|
NODE_SET_PROTOTYPE_METHOD(constructor, "show", Show);
|
||||||
NODE_SET_PROTOTYPE_METHOD(constructor, "destroy", Destroy);
|
NODE_SET_PROTOTYPE_METHOD(constructor, "destroy", Destroy);
|
||||||
|
NODE_SET_PROTOTYPE_METHOD(constructor, "blockingWaitKey", BlockingWaitKey);
|
||||||
target->Set(String::NewSymbol("NamedWindow"), constructor->GetFunction());
|
target->Set(String::NewSymbol("NamedWindow"), constructor->GetFunction());
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,3 +66,15 @@ NamedWindow::Destroy(const v8::Arguments& args){
|
|||||||
cv::destroyWindow(self->winname);
|
cv::destroyWindow(self->winname);
|
||||||
return scope.Close(args.Holder());
|
return scope.Close(args.Holder());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Handle<Value>
|
||||||
|
NamedWindow::BlockingWaitKey(const v8::Arguments& args){
|
||||||
|
SETUP_FUNCTION(NamedWindow)
|
||||||
|
int time = 0;
|
||||||
|
if (args.Length() > 0){
|
||||||
|
time = args[1]->IntegerValue();
|
||||||
|
}
|
||||||
|
int res = cv::waitKey(time);
|
||||||
|
return scope.Close(Number::New(res));
|
||||||
|
}
|
||||||
|
|||||||
@ -15,5 +15,6 @@ class NamedWindow: public node::ObjectWrap {
|
|||||||
|
|
||||||
JSFUNC(Show);
|
JSFUNC(Show);
|
||||||
JSFUNC(Destroy);
|
JSFUNC(Destroy);
|
||||||
|
JSFUNC(BlockingWaitKey);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user