From 57ddabd06b71e34657c2586a59841997b6a071e8 Mon Sep 17 00:00:00 2001 From: Chia-liang Kao Date: Mon, 10 Mar 2014 20:48:08 +0800 Subject: [PATCH] Allow args for HoughLinesP --- src/Matrix.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Matrix.cc b/src/Matrix.cc index 7d8a672..fedb04c 100755 --- a/src/Matrix.cc +++ b/src/Matrix.cc @@ -1081,6 +1081,11 @@ Matrix::HoughLinesP(const v8::Arguments& args) { HandleScope scope; Matrix *self = ObjectWrap::Unwrap(args.This()); + double rho = args.Length() < 1 ? 1 : args[0]->NumberValue(); + double theta = args.Length() < 2 ? CV_PI/180 : args[1]->NumberValue(); + int threshold = args.Length() < 3 ? 80 : args[2]->Uint32Value(); + double minLineLength = args.Length() < 4 ? 30 : args[3]->NumberValue(); + double maxLineGap = args.Length() < 5 ? 10 : args[4]->NumberValue(); std::vector lines; cv::Mat gray; @@ -1088,7 +1093,7 @@ Matrix::HoughLinesP(const v8::Arguments& args) { equalizeHist(self->mat, gray); // cv::Canny(gray, gray, 50, 200, 3); - cv::HoughLinesP(gray, lines, 1, CV_PI/180, 80, 30, 10); + cv::HoughLinesP(gray, lines, rho, theta, threshold, minLineLength, maxLineGap); v8::Local arr = v8::Array::New(lines.size());