mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
-Changes to correct type_info errors seen in Visual Studio from std namespace pollution. Removed global std namespace references and specifically prefixed each call.
This commit is contained in:
parent
d7b7161871
commit
ef39f323c7
@ -75,7 +75,7 @@ NAN_METHOD(Contour::Points) {
|
|||||||
Contour *self = Nan::ObjectWrap::Unwrap<Contour>(info.This());
|
Contour *self = Nan::ObjectWrap::Unwrap<Contour>(info.This());
|
||||||
int pos = info[0]->NumberValue();
|
int pos = info[0]->NumberValue();
|
||||||
|
|
||||||
vector<cv::Point> points = self->contours[pos];
|
std::vector<cv::Point> points = self->contours[pos];
|
||||||
Local<Array> data = Nan::New<Array>(points.size());
|
Local<Array> data = Nan::New<Array>(points.size());
|
||||||
|
|
||||||
for (std::vector<int>::size_type i = 0; i != points.size(); i++) {
|
for (std::vector<int>::size_type i = 0; i != points.size(); i++) {
|
||||||
@ -295,7 +295,7 @@ NAN_METHOD(Contour::Serialize) {
|
|||||||
Local<Array> contours_data = Nan::New<Array>(self->contours.size());
|
Local<Array> contours_data = Nan::New<Array>(self->contours.size());
|
||||||
|
|
||||||
for (std::vector<int>::size_type i = 0; i != self->contours.size(); i++) {
|
for (std::vector<int>::size_type i = 0; i != self->contours.size(); i++) {
|
||||||
vector<cv::Point> points = self->contours[i];
|
std::vector<cv::Point> points = self->contours[i];
|
||||||
Local<Array> contour_data = Nan::New<Array>(points.size());
|
Local<Array> contour_data = Nan::New<Array>(points.size());
|
||||||
|
|
||||||
for (std::vector<int>::size_type j = 0; j != points.size(); j++) {
|
for (std::vector<int>::size_type j = 0; j != points.size(); j++) {
|
||||||
@ -336,12 +336,12 @@ NAN_METHOD(Contour::Deserialize) {
|
|||||||
Local<Array> contours_data = Local<Array>::Cast(data->Get(Nan::New<String>("contours").ToLocalChecked()));
|
Local<Array> contours_data = Local<Array>::Cast(data->Get(Nan::New<String>("contours").ToLocalChecked()));
|
||||||
Local<Array> hierarchy_data = Local<Array>::Cast(data->Get(Nan::New<String>("hierarchy").ToLocalChecked()));
|
Local<Array> hierarchy_data = Local<Array>::Cast(data->Get(Nan::New<String>("hierarchy").ToLocalChecked()));
|
||||||
|
|
||||||
vector<vector<cv::Point> > contours_res;
|
std::vector<std::vector<cv::Point> > contours_res;
|
||||||
int contours_length = contours_data->Length();
|
int contours_length = contours_data->Length();
|
||||||
|
|
||||||
for (int i = 0; i < contours_length; i++) {
|
for (int i = 0; i < contours_length; i++) {
|
||||||
Local<Array> contour_data = Local<Array>::Cast(contours_data->Get(i));
|
Local<Array> contour_data = Local<Array>::Cast(contours_data->Get(i));
|
||||||
vector<cv::Point> points;
|
std::vector<cv::Point> points;
|
||||||
|
|
||||||
int contour_length = contour_data->Length();
|
int contour_length = contour_data->Length();
|
||||||
for (int j = 0; j < contour_length; j++) {
|
for (int j = 0; j < contour_length; j++) {
|
||||||
@ -354,7 +354,7 @@ NAN_METHOD(Contour::Deserialize) {
|
|||||||
contours_res.push_back(points);
|
contours_res.push_back(points);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<cv::Vec4i> hierarchy_res;
|
std::vector<cv::Vec4i> hierarchy_res;
|
||||||
int hierarchy_length = hierarchy_data->Length();
|
int hierarchy_length = hierarchy_data->Length();
|
||||||
|
|
||||||
for (int i = 0; i < hierarchy_length; i++) {
|
for (int i = 0; i < hierarchy_length; i++) {
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
#include "OpenCV.h"
|
#include "OpenCV.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
class Contour: public Nan::ObjectWrap {
|
class Contour: public Nan::ObjectWrap {
|
||||||
public:
|
public:
|
||||||
cv::Mat mat;
|
cv::Mat mat;
|
||||||
vector<vector<cv::Point> > contours;
|
std::vector<std::vector<cv::Point> > contours;
|
||||||
vector<cv::Vec4i> hierarchy;
|
std::vector<cv::Vec4i> hierarchy;
|
||||||
|
|
||||||
static Nan::Persistent<FunctionTemplate> constructor;
|
static Nan::Persistent<FunctionTemplate> constructor;
|
||||||
static void Init(Local<Object> target);
|
static void Init(Local<Object> target);
|
||||||
|
|||||||
@ -668,8 +668,8 @@ NAN_METHOD(Matrix::ToBuffer) {
|
|||||||
|
|
||||||
class AsyncToBufferWorker: public Nan::AsyncWorker {
|
class AsyncToBufferWorker: public Nan::AsyncWorker {
|
||||||
public:
|
public:
|
||||||
AsyncToBufferWorker(Nan::Callback *callback, Matrix* matrix, string ext,
|
AsyncToBufferWorker(Nan::Callback *callback, Matrix* matrix, std::string ext,
|
||||||
vector<int> params) :
|
std::vector<int> params) :
|
||||||
Nan::AsyncWorker(callback),
|
Nan::AsyncWorker(callback),
|
||||||
matrix(matrix),
|
matrix(matrix),
|
||||||
ext(ext),
|
ext(ext),
|
||||||
@ -2055,7 +2055,7 @@ NAN_METHOD(Matrix::Split) {
|
|||||||
Matrix * self = Nan::ObjectWrap::Unwrap<Matrix>(info.This());
|
Matrix * self = Nan::ObjectWrap::Unwrap<Matrix>(info.This());
|
||||||
|
|
||||||
unsigned int size = self->mat.channels();
|
unsigned int size = self->mat.channels();
|
||||||
vector<cv::Mat> channels;
|
std::vector<cv::Mat> channels;
|
||||||
|
|
||||||
// Split doesn't seem to work on empty vectors
|
// Split doesn't seem to work on empty vectors
|
||||||
for (unsigned int i = 0; i < size; i++) {
|
for (unsigned int i = 0; i < size; i++) {
|
||||||
@ -2088,7 +2088,7 @@ NAN_METHOD(Matrix::Merge) {
|
|||||||
v8::Local<v8::Array> jsChannels = v8::Local<v8::Array>::Cast(info[0]);
|
v8::Local<v8::Array> jsChannels = v8::Local<v8::Array>::Cast(info[0]);
|
||||||
|
|
||||||
unsigned int L = jsChannels->Length();
|
unsigned int L = jsChannels->Length();
|
||||||
vector<cv::Mat> vChannels(L);
|
std::vector<cv::Mat> vChannels(L);
|
||||||
for (unsigned int i = 0; i < L; i++) {
|
for (unsigned int i = 0; i < L; i++) {
|
||||||
Matrix * matObject = Nan::ObjectWrap::Unwrap<Matrix>(jsChannels->Get(i)->ToObject());
|
Matrix * matObject = Nan::ObjectWrap::Unwrap<Matrix>(jsChannels->Get(i)->ToObject());
|
||||||
vChannels[i] = matObject->mat;
|
vChannels[i] = matObject->mat;
|
||||||
@ -2202,14 +2202,14 @@ NAN_METHOD(Matrix::TemplateMatches) {
|
|||||||
cv::Size maxSize = hit_mask.size();
|
cv::Size maxSize = hit_mask.size();
|
||||||
int max_x = maxSize.width - 1;
|
int max_x = maxSize.width - 1;
|
||||||
int max_y = maxSize.height - 1;
|
int max_y = maxSize.height - 1;
|
||||||
cv::Point top_left = cv::Point(max(0, pt.x - min_x_distance),
|
cv::Point top_left = cv::Point(std::max(0, pt.x - min_x_distance),
|
||||||
max(0, pt.y - min_y_distance));
|
std::max(0, pt.y - min_y_distance));
|
||||||
cv::Point top_right = cv::Point(min(max_x, pt.x + min_x_distance),
|
cv::Point top_right = cv::Point(std::min(max_x, pt.x + min_x_distance),
|
||||||
max(0, pt.y - min_y_distance));
|
std::max(0, pt.y - min_y_distance));
|
||||||
cv::Point bottom_left = cv::Point(max(0, pt.x - min_x_distance),
|
cv::Point bottom_left = cv::Point(std::max(0, pt.x - min_x_distance),
|
||||||
min(max_y, pt.y + min_y_distance));
|
std::min(max_y, pt.y + min_y_distance));
|
||||||
cv::Point bottom_right = cv::Point(min(max_x, pt.x + min_x_distance),
|
cv::Point bottom_right = cv::Point(std::min(max_x, pt.x + min_x_distance),
|
||||||
min(max_y, pt.y + min_y_distance));
|
std::min(max_y, pt.y + min_y_distance));
|
||||||
if (hit_mask.at<double>(top_left.y, top_left.x) > 0)
|
if (hit_mask.at<double>(top_left.y, top_left.x) > 0)
|
||||||
continue;
|
continue;
|
||||||
if (hit_mask.at<double>(top_right.y, top_right.x) > 0)
|
if (hit_mask.at<double>(top_right.y, top_right.x) > 0)
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
#include "OpenCV.h"
|
#include "OpenCV.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
Nan::Persistent<FunctionTemplate> VideoCaptureWrap::constructor;
|
Nan::Persistent<FunctionTemplate> VideoCaptureWrap::constructor;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user