Skip to content

Commit

Permalink
Merge branch 'waitkey' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbraden committed Mar 11, 2013
2 parents daca1a1 + e88d2d6 commit ebd1f6e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions smoke/smoketest.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ var win = new cv.NamedWindow("foo");
cv.readImage('./examples/stuff.png', function(e, im){
im.pyrDown();
win.show(im);
setTimeout(function(){
win.destroy();
}, 1000)
console.log(win.blockingWaitKey(0), "!!")
win.destroy();

})


Expand Down
13 changes: 13 additions & 0 deletions src/HighGUI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ NamedWindow::Init(Handle<Object> target) {

NODE_SET_PROTOTYPE_METHOD(constructor, "show", Show);
NODE_SET_PROTOTYPE_METHOD(constructor, "destroy", Destroy);
NODE_SET_PROTOTYPE_METHOD(constructor, "blockingWaitKey", BlockingWaitKey);
target->Set(String::NewSymbol("NamedWindow"), constructor->GetFunction());
};

Expand Down Expand Up @@ -65,3 +66,15 @@ NamedWindow::Destroy(const v8::Arguments& args){
cv::destroyWindow(self->winname);
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));
}
1 change: 1 addition & 0 deletions src/HighGUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ class NamedWindow: public node::ObjectWrap {

JSFUNC(Show);
JSFUNC(Destroy);
JSFUNC(BlockingWaitKey);

};

0 comments on commit ebd1f6e

Please sign in to comment.