Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cc/io/io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ NAN_MODULE_INIT(Io::Init) {
Nan::SetMethod(target, "imshowWait", ImshowWait);
Nan::SetMethod(target, "imwrite", Imwrite);
Nan::SetMethod(target, "waitKey", WaitKey);
Comment thread
Garfonso marked this conversation as resolved.
Nan::SetMethod(target, "waitKeyEx", WaitKeyEx);
Comment thread
Garfonso marked this conversation as resolved.
Nan::SetMethod(target, "imencode", Imencode);
Nan::SetMethod(target, "imdecode", Imdecode);
Nan::SetMethod(target, "moveWindow", MoveWindow);
Expand Down Expand Up @@ -105,6 +106,16 @@ NAN_METHOD(Io::WaitKey) {
info.GetReturnValue().Set(Nan::New(key));
}

Comment thread
Garfonso marked this conversation as resolved.
NAN_METHOD(Io::WaitKeyEx) {
int key;
if (info[0]->IsNumber()) {
key = cv::waitKeyEx(info[0]->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value());
} else{
key = cv::waitKeyEx();
}
info.GetReturnValue().Set(Nan::New(key));
}

Comment thread
Garfonso marked this conversation as resolved.
NAN_METHOD(Io::MoveWindow) {
FF::TryCatch tryCatch("Io::MoveWindow");
std::string winName;
Expand Down
3 changes: 2 additions & 1 deletion cc/io/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Io {
static NAN_METHOD(Imshow);
static NAN_METHOD(ImshowWait);
static NAN_METHOD(WaitKey);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#if CV_VERSION_GREATER_EQUAL(3, 2, 0)

static NAN_METHOD(WaitKeyEx);
Comment thread
Garfonso marked this conversation as resolved.
static NAN_METHOD(MoveWindow);
static NAN_METHOD(DestroyWindow);
static NAN_METHOD(DestroyAllWindows);
Expand All @@ -29,4 +30,4 @@ class Io {
static NAN_METHOD(ImdecodeAsync);
};

#endif
#endif
1 change: 1 addition & 0 deletions lib/typings/cv.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export function transformAsync(mat: Mat, m: Mat): Promise<Mat>;
export function undistortPoints(srcPoints: Point2[], cameraMatrix: Mat, distCoeffs: Mat): Point2[];
export function undistortPointsAsync(srcPoints: Point2[], cameraMatrix: Mat, distCoeffs: Mat): Promise<Point2[]>;
export function waitKey(delay?: number): number;
export function waitKeyEx(delay?: number): number;

export type DrawParams = {
thickness?: number;
Expand Down