mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
Added setWidth and setHeight for VideoCapture issue #126
This commit is contained in:
parent
3be5877116
commit
28750d1275
@ -2,6 +2,9 @@
|
|||||||
#include "Matrix.h"
|
#include "Matrix.h"
|
||||||
#include "OpenCV.h"
|
#include "OpenCV.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
void AsyncRead(uv_work_t *req);
|
void AsyncRead(uv_work_t *req);
|
||||||
void AfterAsyncRead(uv_work_t *req);
|
void AfterAsyncRead(uv_work_t *req);
|
||||||
@ -31,6 +34,8 @@ VideoCaptureWrap::Init(Handle<Object> target) {
|
|||||||
//Local<ObjectTemplate> proto = constructor->PrototypeTemplate();
|
//Local<ObjectTemplate> proto = constructor->PrototypeTemplate();
|
||||||
|
|
||||||
NODE_SET_PROTOTYPE_METHOD(constructor, "read", Read);
|
NODE_SET_PROTOTYPE_METHOD(constructor, "read", Read);
|
||||||
|
NODE_SET_PROTOTYPE_METHOD(constructor, "setWidth", SetWidth);
|
||||||
|
NODE_SET_PROTOTYPE_METHOD(constructor, "setHeight", SetHeight);
|
||||||
|
|
||||||
target->Set(String::NewSymbol("VideoCapture"), constructor->GetFunction());
|
target->Set(String::NewSymbol("VideoCapture"), constructor->GetFunction());
|
||||||
};
|
};
|
||||||
@ -77,6 +82,28 @@ VideoCaptureWrap::VideoCaptureWrap(const std::string& filename){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Handle<Value>
|
||||||
|
VideoCaptureWrap::SetWidth(const Arguments &args){
|
||||||
|
|
||||||
|
HandleScope scope;
|
||||||
|
VideoCaptureWrap *v = ObjectWrap::Unwrap<VideoCaptureWrap>(args.This());
|
||||||
|
|
||||||
|
if(v->cap.isOpened())
|
||||||
|
v->cap.set(CV_CAP_PROP_FRAME_WIDTH, 320);
|
||||||
|
|
||||||
|
return Undefined();
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle<Value>
|
||||||
|
VideoCaptureWrap::SetHeight(const Arguments &args){
|
||||||
|
|
||||||
|
HandleScope scope;
|
||||||
|
VideoCaptureWrap *v = ObjectWrap::Unwrap<VideoCaptureWrap>(args.This());
|
||||||
|
|
||||||
|
v->cap.set(CV_CAP_PROP_FRAME_HEIGHT, 240);
|
||||||
|
|
||||||
|
return Undefined();
|
||||||
|
}
|
||||||
|
|
||||||
Handle<Value>
|
Handle<Value>
|
||||||
VideoCaptureWrap::Read(const Arguments &args) {
|
VideoCaptureWrap::Read(const Arguments &args) {
|
||||||
|
|||||||
@ -13,6 +13,10 @@ class VideoCaptureWrap: public node::ObjectWrap {
|
|||||||
|
|
||||||
static Handle<Value> Read(const v8::Arguments&);
|
static Handle<Value> Read(const v8::Arguments&);
|
||||||
|
|
||||||
|
//(Optional) For setting width and height of the input video stream
|
||||||
|
static Handle<Value> SetWidth(const v8::Arguments&);
|
||||||
|
static Handle<Value> SetHeight(const v8::Arguments&);
|
||||||
|
|
||||||
|
|
||||||
static Handle<Value> GetFrameAt(const v8::Arguments&);
|
static Handle<Value> GetFrameAt(const v8::Arguments&);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user