mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
23 lines
594 B
JavaScript
23 lines
594 B
JavaScript
/* For some reason the cascade file is broken on linux :(
|
|
|
|
|
|
var cv = require('../lib/opencv');
|
|
|
|
cv.readImage("./files/car1.jpg", function(err, im){
|
|
if (err) throw err;
|
|
if (im.width() < 1 || im.height() < 1) throw new Error('Image has no size');
|
|
|
|
im.detectObject("../data/hogcascade_cars_sideview.xml", {}, function(err, cars){
|
|
if (err) throw err;
|
|
|
|
for (var i=0; i < cars.length; i++){
|
|
var x = cars[i];
|
|
im.rectangle([x.x, x.y], [x.width, x.height]);
|
|
}
|
|
|
|
im.save('./tmp/car-detection.jpg');
|
|
console.log('Image saved to ./tmp/car-detection.jpg');
|
|
});
|
|
});
|
|
*/
|