mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
Strip trailing spaces in matrix.cc re #29
This commit is contained in:
parent
642f111f9d
commit
be92fe5e65
@ -58,7 +58,7 @@ Matrix::Init(Handle<Object> target) {
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "findContours", FindContours);
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "drawContour", DrawContour);
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "drawAllContours", DrawAllContours);
|
||||
|
||||
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "goodFeaturesToTrack", GoodFeaturesToTrack);
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "houghLinesP", HoughLinesP);
|
||||
|
||||
@ -104,7 +104,7 @@ Matrix::Matrix(): ObjectWrap() {
|
||||
|
||||
|
||||
Matrix::Matrix(int w, int h): ObjectWrap() {
|
||||
mat = cv::Mat(w, h, CV_32FC3);
|
||||
mat = cv::Mat(w, h, CV_32FC3);
|
||||
//TODO:Parametrizar esto
|
||||
//mat = cv::Mat(h, w, CV_8UC3);
|
||||
}
|
||||
@ -162,7 +162,7 @@ Matrix::Get(const Arguments& args){
|
||||
}
|
||||
|
||||
|
||||
Handle<Value>
|
||||
Handle<Value>
|
||||
Matrix::Set(const Arguments& args){
|
||||
SETUP_FUNCTION(Matrix)
|
||||
|
||||
@ -199,7 +199,7 @@ Matrix::Set(const Arguments& args){
|
||||
}
|
||||
|
||||
|
||||
Handle<Value>
|
||||
Handle<Value>
|
||||
Matrix::Size(const Arguments& args){
|
||||
SETUP_FUNCTION(Matrix)
|
||||
|
||||
@ -210,7 +210,7 @@ Matrix::Size(const Arguments& args){
|
||||
return scope.Close(arr);
|
||||
}
|
||||
|
||||
Handle<Value>
|
||||
Handle<Value>
|
||||
Matrix::Row(const Arguments& args){
|
||||
SETUP_FUNCTION(Matrix)
|
||||
|
||||
@ -227,7 +227,7 @@ Matrix::Row(const Arguments& args){
|
||||
}
|
||||
|
||||
|
||||
Handle<Value>
|
||||
Handle<Value>
|
||||
Matrix::PixelRow(const Arguments& args){
|
||||
SETUP_FUNCTION(Matrix)
|
||||
|
||||
@ -246,7 +246,7 @@ Handle<Value>
|
||||
return scope.Close(arr);
|
||||
}
|
||||
|
||||
Handle<Value>
|
||||
Handle<Value>
|
||||
Matrix::Col(const Arguments& args){
|
||||
SETUP_FUNCTION(Matrix)
|
||||
|
||||
@ -262,7 +262,7 @@ Matrix::Col(const Arguments& args){
|
||||
}
|
||||
|
||||
|
||||
Handle<Value>
|
||||
Handle<Value>
|
||||
Matrix::PixelCol(const Arguments& args){
|
||||
SETUP_FUNCTION(Matrix)
|
||||
|
||||
@ -280,21 +280,21 @@ Matrix::PixelCol(const Arguments& args){
|
||||
return scope.Close(arr);
|
||||
}
|
||||
|
||||
Handle<Value>
|
||||
Handle<Value>
|
||||
Matrix::Width(const Arguments& args){
|
||||
SETUP_FUNCTION(Matrix)
|
||||
|
||||
return scope.Close(Number::New(self->mat.size().width));
|
||||
}
|
||||
|
||||
Handle<Value>
|
||||
Handle<Value>
|
||||
Matrix::Height(const Arguments& args){
|
||||
SETUP_FUNCTION(Matrix)
|
||||
|
||||
return scope.Close(Number::New(self->mat.size().height));
|
||||
}
|
||||
|
||||
Handle<Value>
|
||||
Handle<Value>
|
||||
Matrix::Channels(const Arguments& args){
|
||||
SETUP_FUNCTION(Matrix)
|
||||
|
||||
@ -385,7 +385,7 @@ void AfterAsyncToBufferAsync(uv_work_t *req) {
|
||||
node::Buffer *buf = node::Buffer::New(baton->res.size());
|
||||
uchar* data = (uchar*) Buffer::Data(buf);
|
||||
memcpy(data, &baton->res[0], baton->res.size());
|
||||
|
||||
|
||||
v8::Local<v8::Object> globalObj = v8::Context::GetCurrent()->Global();
|
||||
v8::Local<v8::Function> bufferConstructor = v8::Local<v8::Function>::Cast(globalObj->Get(v8::String::New("Buffer")));
|
||||
v8::Handle<v8::Value> constructorArgs[3] = {buf->handle_, v8::Integer::New(baton->res.size()), v8::Integer::New(0)};
|
||||
@ -404,19 +404,19 @@ void AfterAsyncToBufferAsync(uv_work_t *req) {
|
||||
baton->cb.Dispose();
|
||||
|
||||
delete baton;
|
||||
|
||||
|
||||
// return 0;
|
||||
}
|
||||
|
||||
|
||||
Handle<Value>
|
||||
Handle<Value>
|
||||
Matrix::Ellipse(const v8::Arguments& args){
|
||||
SETUP_FUNCTION(Matrix)
|
||||
|
||||
int x = args[0]->Uint32Value();
|
||||
int y = args[1]->Uint32Value();
|
||||
int width = args[2]->Uint32Value();
|
||||
int height = args[3]->Uint32Value();
|
||||
int height = args[3]->Uint32Value();
|
||||
cv::Scalar color(0, 0, 255);
|
||||
|
||||
if(args[4]->IsArray()) {
|
||||
@ -449,7 +449,7 @@ Matrix::Rectangle(const Arguments& args) {
|
||||
Local<Object> objColor = args[2]->ToObject();
|
||||
color = setColor(objColor);
|
||||
}
|
||||
|
||||
|
||||
int x = xy->Get(0)->IntegerValue();
|
||||
int y = xy->Get(1)->IntegerValue();
|
||||
|
||||
@ -482,7 +482,7 @@ Matrix::Line(const Arguments& args) {
|
||||
Local<Object> objColor = args[2]->ToObject();
|
||||
color = setColor(objColor);
|
||||
}
|
||||
|
||||
|
||||
int x1 = xy1->Get(0)->IntegerValue();
|
||||
int y1 = xy1->Get(1)->IntegerValue();
|
||||
|
||||
@ -514,7 +514,7 @@ Matrix::Save(const v8::Arguments& args){
|
||||
}
|
||||
|
||||
|
||||
Handle<Value>
|
||||
Handle<Value>
|
||||
Matrix::Eye(const v8::Arguments& args){
|
||||
HandleScope scope;
|
||||
|
||||
@ -612,7 +612,7 @@ Matrix::AddWeighted(const v8::Arguments& args) {
|
||||
int gamma = 0;
|
||||
|
||||
cv::addWeighted(src1->mat, alpha, src2->mat, beta, gamma, self->mat);
|
||||
|
||||
|
||||
|
||||
return scope.Close(v8::Null());
|
||||
}
|
||||
@ -717,14 +717,14 @@ Matrix::GoodFeaturesToTrack(const v8::Arguments& args) {
|
||||
|
||||
Matrix *self = ObjectWrap::Unwrap<Matrix>(args.This());
|
||||
std::vector<cv::Point2f> corners;
|
||||
|
||||
|
||||
cv::Mat gray;
|
||||
|
||||
cvtColor(self->mat, gray, CV_BGR2GRAY);
|
||||
equalizeHist(gray, gray);
|
||||
|
||||
cv::goodFeaturesToTrack(gray, corners, 500, 0.01, 10);
|
||||
|
||||
|
||||
v8::Local<v8::Array> arr = v8::Array::New(corners.size());
|
||||
|
||||
|
||||
@ -745,14 +745,14 @@ Matrix::HoughLinesP(const v8::Arguments& args) {
|
||||
|
||||
Matrix *self = ObjectWrap::Unwrap<Matrix>(args.This());
|
||||
std::vector<cv::Vec4i> lines;
|
||||
|
||||
|
||||
cv::Mat gray;
|
||||
|
||||
|
||||
equalizeHist(self->mat, gray);
|
||||
// cv::Canny(gray, gray, 50, 200, 3);
|
||||
cv::HoughLinesP(gray, lines, 1, CV_PI/180, 80, 30, 10);
|
||||
|
||||
|
||||
v8::Local<v8::Array> arr = v8::Array::New(lines.size());
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user