Adding getHeight and getWidth methods

This commit is contained in:
Jakob Schindegger 2017-09-04 22:52:37 +02:00
parent 31ba216539
commit 3e9daa46f8
2 changed files with 22 additions and 0 deletions

View File

@ -79,6 +79,15 @@ VideoCaptureWrap::VideoCaptureWrap(const std::string& filename) {
}
}
NAN_METHOD(VideoCaptureWrap::GetWidth) {
Nan::HandleScope scope;
VideoCaptureWrap *v = Nan::ObjectWrap::Unwrap<VideoCaptureWrap>(info.This());
int cnt = int(v->cap.get(CV_CAP_PROP_FRAME_WIDTH));
info.GetReturnValue().Set(Nan::New<Number>(cnt));
}
NAN_METHOD(VideoCaptureWrap::SetWidth) {
Nan::HandleScope scope;
VideoCaptureWrap *v = Nan::ObjectWrap::Unwrap<VideoCaptureWrap>(info.This());
@ -103,6 +112,15 @@ NAN_METHOD(VideoCaptureWrap::GetFrameCount) {
info.GetReturnValue().Set(Nan::New<Number>(cnt));
}
NAN_METHOD(VideoCaptureWrap::GetHeight) {
Nan::HandleScope scope;
VideoCaptureWrap *v = Nan::ObjectWrap::Unwrap<VideoCaptureWrap>(info.This());
int cnt = int(v->cap.get(CV_CAP_PROP_FRAME_HEIGHT));
info.GetReturnValue().Set(Nan::New<Number>(cnt));
}
NAN_METHOD(VideoCaptureWrap::SetHeight) {
Nan::HandleScope scope;
VideoCaptureWrap *v = Nan::ObjectWrap::Unwrap<VideoCaptureWrap>(info.This());

View File

@ -17,6 +17,10 @@ public:
static NAN_METHOD(Grab);
static NAN_METHOD(Retrieve);
// For getting width and height of the input video stream
static NAN_METHOD(GetWidth);
static NAN_METHOD(GetHeight);
// (Optional) For setting width and height of the input video stream
static NAN_METHOD(SetWidth);
static NAN_METHOD(SetHeight);