Permalink
Browse files

Blocking waitKey for development

  • Loading branch information...
1 parent 11db468 commit e88d2d6b8a83a268f2a899ff5699648eec697855 @peterbraden committed Mar 11, 2013
Showing with 17 additions and 3 deletions.
  1. +3 −3 smoke/smoketest.js
  2. +13 −0 src/HighGUI.cc
  3. +1 −0 src/HighGUI.h
View
6 smoke/smoketest.js
@@ -3,9 +3,9 @@ var cv = require('../lib/opencv')
var win = new cv.NamedWindow("foo");
cv.readImage('./examples/stuff.png', function(e, im){
win.show(im);
- setTimeout(function(){
- win.destroy();
- }, 1000)
+ console.log(win.blockingWaitKey(0), "!!")
+ win.destroy();
+
})
View
13 src/HighGUI.cc
@@ -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());
};
@@ -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));
+}
View
1 src/HighGUI.h
@@ -15,5 +15,6 @@ class NamedWindow: public node::ObjectWrap {
JSFUNC(Show);
JSFUNC(Destroy);
+ JSFUNC(BlockingWaitKey);
};

0 comments on commit e88d2d6

Please sign in to comment.