diff --git a/examples/convert-image.js b/examples/convert-image.js index 7f62ff3..dbc9f0c 100755 --- a/examples/convert-image.js +++ b/examples/convert-image.js @@ -1,6 +1,6 @@ var cv = require('../lib/opencv'); -cv.readImage('./files/mona.png', function(err, im) { +cv.readImage('./examples/files/mona.png', function(err, im) { if (err) throw err; if (im.width() < 1 || im.height() < 1) throw new Error('Image has no size'); @@ -10,12 +10,12 @@ cv.readImage('./files/mona.png', function(err, im) { img_hsv.convertHSVscale(); img_gray.convertGrayscale(); - im.save('./tmp/nor.png'); - img_hsv.save('./tmp/hsv.png'); - img_gray.save('./tmp/gray.png'); + im.save('./examples/tmp/nor.png'); + img_hsv.save('./examples/tmp/hsv.png'); + img_gray.save('./examples/tmp/gray.png'); img_crop = im.crop(50,50,250,250); - img_crop.save('./tmp/crop.png'); + img_crop.save('./examples/tmp/crop.png'); - console.log('Image saved to ./tmp/{crop|nor|hsv|gray}.png'); + console.log('Image saved to ./examples/tmp/{crop|nor|hsv|gray}.png'); }); diff --git a/examples/detect-shapes.js b/examples/detect-shapes.js index f465d23..6326995 100755 --- a/examples/detect-shapes.js +++ b/examples/detect-shapes.js @@ -12,7 +12,7 @@ var GREEN = [0, 255, 0]; // B, G, R var WHITE = [255, 255, 255]; // B, G, R -cv.readImage('./files/shapes.jpg', function(err, im) { +cv.readImage('./examples/files/shapes.jpg', function(err, im) { if (err) throw err; width = im.width() @@ -46,6 +46,6 @@ cv.readImage('./files/shapes.jpg', function(err, im) { } } - out.save('./tmp/detect-shapes.png'); - console.log('Image saved to ./tmp/detect-shapes.png'); + out.save('./examples/tmp/detect-shapes.png'); + console.log('Image saved to ./examples/tmp/detect-shapes.png'); }); diff --git a/examples/face-detection.js b/examples/face-detection.js index 0cc5fee..185a78b 100755 --- a/examples/face-detection.js +++ b/examples/face-detection.js @@ -1,10 +1,10 @@ var cv = require('../lib/opencv'); -cv.readImage("./files/mona.png", function(err, im){ +cv.readImage("./examples/files/mona.png", function(err, im){ if (err) throw err; if (im.width() < 1 || im.height() < 1) throw new Error('Image has no size'); - im.detectObject("../data/haarcascade_frontalface_alt.xml", {}, function(err, faces){ + im.detectObject("./data/haarcascade_frontalface_alt.xml", {}, function(err, faces){ if (err) throw err; for (var i = 0; i < faces.length; i++){ @@ -12,7 +12,7 @@ cv.readImage("./files/mona.png", function(err, im){ im.ellipse(face.x + face.width / 2, face.y + face.height / 2, face.width / 2, face.height / 2); } - im.save('./tmp/face-detection.png'); - console.log('Image saved to ./tmp/face-detection.png'); + im.save('./examples/tmp/face-detection.png'); + console.log('Image saved to ./examples/tmp/face-detection.png'); }); }); diff --git a/examples/quad-crosses.js b/examples/quad-crosses.js index e56f4cb..1a3a558 100755 --- a/examples/quad-crosses.js +++ b/examples/quad-crosses.js @@ -47,6 +47,6 @@ cv.readImage('./examples/files/quads.jpg', function(err, im) { out.line([points[1].x,points[1].y], [points[3].x, points[3].y], RED); } - out.save('./tmp/quad-crosses.png'); - console.log('Image saved to ./tmp/quad-crosses.png'); + out.save('./examples/tmp/quad-crosses.png'); + console.log('Image saved to ./examples/tmp/quad-crosses.png'); }); diff --git a/src/Matrix.cc b/src/Matrix.cc index 05312c9..9f57b48 100755 --- a/src/Matrix.cc +++ b/src/Matrix.cc @@ -68,6 +68,7 @@ Matrix::Init(Handle target) { NODE_SET_PROTOTYPE_METHOD(ctor, "drawAllContours", DrawAllContours); NODE_SET_PROTOTYPE_METHOD(ctor, "goodFeaturesToTrack", GoodFeaturesToTrack); NODE_SET_PROTOTYPE_METHOD(ctor, "houghLinesP", HoughLinesP); + NODE_SET_PROTOTYPE_METHOD(ctor, "crop", Crop); NODE_SET_PROTOTYPE_METHOD(ctor, "inRange", inRange); NODE_SET_PROTOTYPE_METHOD(ctor, "adjustROI", AdjustROI); NODE_SET_PROTOTYPE_METHOD(ctor, "locateROI", LocateROI);