Skip to content

Commit 964da8e

Browse files
committed
Merge pull request #367 from mvines/cv3
Base OpenCV 3 port
2 parents 090e9d7 + 2a81f23 commit 964da8e

20 files changed

+84
-22
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ cool, I'd love to hear about it!
1313

1414
## Install
1515

16-
You'll need OpenCV 2.3.1 or newer installed before installing node-opencv.
16+
You'll need OpenCV 2.3.1 or newer installed before installing node-opencv. Note
17+
that OpenCV 3.x is not yet fully supported.
1718

1819
## Specific for Windows
1920
1. Download and install OpenCV (Be sure to use a 2.4 version) @

binding.gyp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"conditions": [
4040
[ "OS==\"linux\" or OS==\"freebsd\" or OS==\"openbsd\" or OS==\"solaris\" or OS==\"aix\"", {
4141
"cflags": [
42-
"<!@(pkg-config --cflags \"opencv >= 2.3.1\" )",
42+
"<!@(node utils/find-opencv.js --cflags)",
4343
"-Wall"
4444
]
4545
}],
@@ -64,7 +64,7 @@
6464
"-mmacosx-version-min=10.7",
6565
"-std=c++11",
6666
"-stdlib=libc++",
67-
"<!@(pkg-config --cflags opencv)"
67+
"<!@(node utils/find-opencv.js --cflags)",
6868
],
6969
"GCC_ENABLE_CPP_RTTI": "YES",
7070
"GCC_ENABLE_CPP_EXCEPTIONS": "YES"
@@ -80,7 +80,7 @@
8080
],
8181

8282
"libraries": [
83-
"<!@(node utils/find-opencv.js --libs)"
83+
"<!@(node utils/find-opencv.js --libs)",
8484
],
8585
# For windows
8686

@@ -96,7 +96,7 @@
9696
"conditions": [
9797
[ "OS==\"linux\"", {
9898
"cflags": [
99-
"<!@(pkg-config --cflags \"opencv >= 2.3.1\" )",
99+
"<!@(node utils/find-opencv.js --cflags)",
100100
"-Wall"
101101
]
102102
}],
@@ -121,7 +121,7 @@
121121
"-mmacosx-version-min=10.7",
122122
"-std=c++11",
123123
"-stdlib=libc++",
124-
"<!@(pkg-config --cflags opencv)"
124+
"<!@(node utils/find-opencv.js --cflags)",
125125
],
126126
"GCC_ENABLE_CPP_RTTI": "YES",
127127
"GCC_ENABLE_CPP_EXCEPTIONS": "YES"

examples/dissimilarity.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
var cv = require('../lib/opencv');
22

3+
if (cv.ImageSimilarity === undefined) {
4+
console.log('TODO: Please port Features2d.cc to OpenCV 3')
5+
process.exit(0);
6+
}
7+
38
cv.readImage("./examples/files/car1.jpg", function(err, car1) {
49
if (err) throw err;
510

src/BackgroundSubtractor.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
#include <iostream>
44
#include <nan.h>
55

6-
#if ((CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >=4))
6+
#if CV_MAJOR_VERSION >= 3
7+
#warning TODO: port me to OpenCV 3
8+
#endif
9+
10+
#if ((CV_MAJOR_VERSION == 2) && (CV_MINOR_VERSION >=4))
711

812
Nan::Persistent<FunctionTemplate> BackgroundSubtractorWrap::constructor;
913

src/BackgroundSubtractor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "OpenCV.h"
22

3-
#if ((CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >=4))
3+
#if ((CV_MAJOR_VERSION == 2) && (CV_MINOR_VERSION >=4))
44

55
#include <opencv2/video/background_segm.hpp>
66

src/Calib3D.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
#include "OpenCV.h"
55

6+
#if CV_MAJOR_VERSION >= 3
7+
#include <opencv2/calib3d.hpp>
8+
#endif
9+
610
/**
711
* Implementation of calib3d.hpp functions
812
*/

src/CamShift.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#include "OpenCV.h"
33
#include "Matrix.h"
44

5+
#if CV_MAJOR_VERSION >= 3
6+
#include <opencv2/video/tracking.hpp>
7+
#endif
58

69
#define CHANNEL_HUE 0
710
#define CHANNEL_SATURATION 1

src/CascadeClassifierWrap.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#include "OpenCV.h"
2+
#if CV_MAJOR_VERSION >= 3
3+
#include <opencv2/objdetect.hpp>
4+
#endif
25

36
class CascadeClassifierWrap: public Nan::ObjectWrap {
47
public:

src/FaceRecognizer.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#include "FaceRecognizer.h"
22
#include "OpenCV.h"
33

4-
#if ((CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >=4) && (CV_SUBMINOR_VERSION>=4))
4+
#if CV_MAJOR_VERSION >= 3
5+
#warning TODO: port me to OpenCV 3
6+
#endif
7+
8+
#if ((CV_MAJOR_VERSION == 2) && (CV_MINOR_VERSION >=4) && (CV_SUBMINOR_VERSION>=4))
59

610
#include "Matrix.h"
711
#include <nan.h>

src/FaceRecognizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "OpenCV.h"
22

3-
#if ((CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >=4))
3+
#if ((CV_MAJOR_VERSION == 2) && (CV_MINOR_VERSION >=4) && (CV_SUBMINOR_VERSION>=4))
44

55
#include "opencv2/contrib/contrib.hpp"
66

0 commit comments

Comments
 (0)