diff --git a/src/Contours.cc b/src/Contours.cc index 406140af..7a8504f2 100755 --- a/src/Contours.cc +++ b/src/Contours.cc @@ -75,7 +75,7 @@ NAN_METHOD(Contour::Points) { Contour *self = Nan::ObjectWrap::Unwrap(info.This()); int pos = info[0]->NumberValue(); - vector points = self->contours[pos]; + std::vector points = self->contours[pos]; Local data = Nan::New(points.size()); for (std::vector::size_type i = 0; i != points.size(); i++) { @@ -295,7 +295,7 @@ NAN_METHOD(Contour::Serialize) { Local contours_data = Nan::New(self->contours.size()); for (std::vector::size_type i = 0; i != self->contours.size(); i++) { - vector points = self->contours[i]; + std::vector points = self->contours[i]; Local contour_data = Nan::New(points.size()); for (std::vector::size_type j = 0; j != points.size(); j++) { @@ -336,12 +336,12 @@ NAN_METHOD(Contour::Deserialize) { Local contours_data = Local::Cast(data->Get(Nan::New("contours").ToLocalChecked())); Local hierarchy_data = Local::Cast(data->Get(Nan::New("hierarchy").ToLocalChecked())); - vector > contours_res; + std::vector > contours_res; int contours_length = contours_data->Length(); for (int i = 0; i < contours_length; i++) { Local contour_data = Local::Cast(contours_data->Get(i)); - vector points; + std::vector points; int contour_length = contour_data->Length(); for (int j = 0; j < contour_length; j++) { @@ -354,7 +354,7 @@ NAN_METHOD(Contour::Deserialize) { contours_res.push_back(points); } - vector hierarchy_res; + std::vector hierarchy_res; int hierarchy_length = hierarchy_data->Length(); for (int i = 0; i < hierarchy_length; i++) { diff --git a/src/Contours.h b/src/Contours.h index cbbff01d..8e8352e6 100755 --- a/src/Contours.h +++ b/src/Contours.h @@ -1,12 +1,11 @@ #include "OpenCV.h" -using namespace std; class Contour: public Nan::ObjectWrap { public: cv::Mat mat; - vector > contours; - vector hierarchy; + std::vector > contours; + std::vector hierarchy; static Nan::Persistent constructor; static void Init(Local target); diff --git a/src/Matrix.cc b/src/Matrix.cc index 5985a6db..7cb55822 100755 --- a/src/Matrix.cc +++ b/src/Matrix.cc @@ -668,8 +668,8 @@ NAN_METHOD(Matrix::ToBuffer) { class AsyncToBufferWorker: public Nan::AsyncWorker { public: - AsyncToBufferWorker(Nan::Callback *callback, Matrix* matrix, string ext, - vector params) : + AsyncToBufferWorker(Nan::Callback *callback, Matrix* matrix, std::string ext, + std::vector params) : Nan::AsyncWorker(callback), matrix(matrix), ext(ext), @@ -2055,7 +2055,7 @@ NAN_METHOD(Matrix::Split) { Matrix * self = Nan::ObjectWrap::Unwrap(info.This()); unsigned int size = self->mat.channels(); - vector channels; + std::vector channels; // Split doesn't seem to work on empty vectors for (unsigned int i = 0; i < size; i++) { @@ -2088,7 +2088,7 @@ NAN_METHOD(Matrix::Merge) { v8::Local jsChannels = v8::Local::Cast(info[0]); unsigned int L = jsChannels->Length(); - vector vChannels(L); + std::vector vChannels(L); for (unsigned int i = 0; i < L; i++) { Matrix * matObject = Nan::ObjectWrap::Unwrap(jsChannels->Get(i)->ToObject()); vChannels[i] = matObject->mat; @@ -2202,14 +2202,14 @@ NAN_METHOD(Matrix::TemplateMatches) { cv::Size maxSize = hit_mask.size(); int max_x = maxSize.width - 1; int max_y = maxSize.height - 1; - cv::Point top_left = cv::Point(max(0, pt.x - min_x_distance), - max(0, pt.y - min_y_distance)); - cv::Point top_right = cv::Point(min(max_x, pt.x + min_x_distance), - max(0, pt.y - min_y_distance)); - cv::Point bottom_left = cv::Point(max(0, pt.x - min_x_distance), - min(max_y, pt.y + min_y_distance)); - cv::Point bottom_right = cv::Point(min(max_x, pt.x + min_x_distance), - min(max_y, pt.y + min_y_distance)); + cv::Point top_left = cv::Point(std::max(0, pt.x - min_x_distance), + std::max(0, pt.y - min_y_distance)); + cv::Point top_right = cv::Point(std::min(max_x, pt.x + min_x_distance), + std::max(0, pt.y - min_y_distance)); + cv::Point bottom_left = cv::Point(std::max(0, pt.x - min_x_distance), + std::min(max_y, pt.y + min_y_distance)); + cv::Point bottom_right = cv::Point(std::min(max_x, pt.x + min_x_distance), + std::min(max_y, pt.y + min_y_distance)); if (hit_mask.at(top_left.y, top_left.x) > 0) continue; if (hit_mask.at(top_right.y, top_right.x) > 0) diff --git a/src/VideoCaptureWrap.cc b/src/VideoCaptureWrap.cc index 6ea7b136..2db7a35c 100755 --- a/src/VideoCaptureWrap.cc +++ b/src/VideoCaptureWrap.cc @@ -3,7 +3,6 @@ #include "OpenCV.h" #include -using namespace std; Nan::Persistent VideoCaptureWrap::constructor;