Skip to content

Commit

Permalink
Return to old version of opencv to try compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarsilva committed Feb 4, 2015
1 parent 9035d9b commit 7d16f2e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ env:
before_install:
# Fix a problem with apt-get failing later, see http://docs.travis-ci.com/user/installing-dependencies/#Installing-Ubuntu-packages
- sudo apt-get update -qq
- sudo add-apt-repository -y ppa:kubuntu-ppa/backports
- sudo apt-get update
# - sudo add-apt-repository -y ppa:kubuntu-ppa/backports
# - sudo apt-get update
- sudo apt-get install libcv-dev
- sudo apt-get install libopencv-dev
- sudo apt-get install libhighgui-dev
Expand Down
8 changes: 4 additions & 4 deletions smoke/smoketest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var cv = require('../lib/opencv')
var cv = require('../lib/opencv');

var trainingData = []
var trainingData = [];
/*
for (var i = 1; i< 41; i++){
for (var j = 1; j<10; j++){
Expand All @@ -22,5 +22,5 @@ cv.readImage("/Users/peterbraden/Downloads/orl_faces/s6/10.pgm", function(e, im)
*/
cv.readImage("./examples/files/mona.png", function(e, mat){
var th = mat.threshold(200, 200, "Threshold to Zero Inverted");
th.save('./examples/tmp/out.png')
})
th.save('./examples/tmp/out.png');
});
35 changes: 18 additions & 17 deletions src/BackgroundSubtractor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ BackgroundSubtractorWrap::Init(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(ctor, "applyMOG", ApplyMOG);

target->Set(NanNew("BackgroundSubtractor"), ctor->GetFunction());

};

NAN_METHOD(BackgroundSubtractorWrap::New) {
Expand All @@ -42,17 +42,17 @@ NAN_METHOD(BackgroundSubtractorWrap::New) {
NAN_METHOD(BackgroundSubtractorWrap::CreateMOG) {
NanScope();

int history = 200;
int nmixtures = 5;
double backgroundRatio = 0.7;
double noiseSigma = 0;

if(args.Length() > 1){
INT_FROM_ARGS(history, 0)
INT_FROM_ARGS(nmixtures, 1)
DOUBLE_FROM_ARGS(backgroundRatio, 2)
DOUBLE_FROM_ARGS(noiseSigma, 3)
}
// int history = 200;
// int nmixtures = 5;
// double backgroundRatio = 0.7;
// double noiseSigma = 0;
//
// if(args.Length() > 1){
// INT_FROM_ARGS(history, 0)
// INT_FROM_ARGS(nmixtures, 1)
// DOUBLE_FROM_ARGS(backgroundRatio, 2)
// DOUBLE_FROM_ARGS(noiseSigma, 3)
// }

Local<Object> n = NanNew(BackgroundSubtractorWrap::constructor)->GetFunction()->NewInstance();

Expand Down Expand Up @@ -83,13 +83,13 @@ NAN_METHOD(BackgroundSubtractorWrap::ApplyMOG) {

Local<Object> fgMask = NanNew(Matrix::constructor)->GetFunction()->NewInstance();
Matrix *img = ObjectWrap::Unwrap<Matrix>(fgMask);


cv::Mat mat;

if(Buffer::HasInstance(args[0])){
uint8_t *buf = (uint8_t *) Buffer::Data(args[0]->ToObject());
unsigned len = Buffer::Length(args[0]->ToObject());
unsigned len = Buffer::Length(args[0]->ToObject());
cv::Mat *mbuf = new cv::Mat(len, 1, CV_64FC1, buf);
mat = cv::imdecode(*mbuf, -1);
//mbuf->release();
Expand All @@ -116,13 +116,13 @@ NAN_METHOD(BackgroundSubtractorWrap::ApplyMOG) {
TryCatch try_catch;

cb->Call(NanGetCurrentContext()->Global(), 2, argv);

if (try_catch.HasCaught()) {
FatalException(try_catch);
}

NanReturnUndefined();
}
}
catch( cv::Exception& e ){
const char* err_msg = e.what();
NanThrowError(err_msg);
Expand All @@ -136,3 +136,4 @@ BackgroundSubtractorWrap::BackgroundSubtractorWrap(cv::Ptr<cv::BackgroundSubtrac
};

#endif

0 comments on commit 7d16f2e

Please sign in to comment.