Guest User

Untitled

a guest
May 24th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. download = wget.download(src, path + filename, options);
  2.  
  3. download.on('end', function(output) {
  4.  
  5.   cv.readImage(path + filename, function(err, im) {
  6.     if (err) throw err;
  7.     if (im.width() < 1 || im.height() < 1) throw new Error('Image has no size');
  8.  
  9.     im.detectObject('data/cascade.xml', {}, function(err, cars) {
  10.       if (err) throw err;
  11.  
  12.       for (var i = 0; i < cars.length; i++) {
  13.         car = cars[i];
  14.         im.rectangle([car.x, car.y], [car.width, car.height], [0, 255, 0], 2);
  15.       }
  16.  
  17.       im.save(path + '_' + filename);
  18.  
  19.     });
  20.  
  21.   });
  22.  
  23. });
Advertisement
Add Comment
Please, Sign In to add comment