Interfacing OpenCV and Node.js

asked 2017-09-16 10:04:35 -0600

I know this website does not deal with Java script but I needed help and there aren't any other websites. I am having trouble interfacing OpenCV and node.js. I already looked at the github repository https://github.com/peterbraden/node-o... but it does not meet my specific goal. I am reading a picture and filtering out the colors and this is the result I get in the following images. The code is from the example folder in the opencv module.Prior Color Filter Post Color Filter I am trying to feed the picture back to an A.R Drone 2.0 and have the drone follow the color White. So feedback is my main problem and interfacing node.js as well. Is there another way of doing this instead of using node.js. Any codes I can refer to would be great.

var cv = require('C:/users/danny/codes/node_modules/opencv/lib/opencv');


// (B)lue, (G)reen, (R)ed

var lower_threshold = [220, 220, 220];

var upper_threshold = [255, 255, 255];


//var lower_threshold = [46, 57, 83];

//var upper_threshold = [80, 96, 115];


cv.readImage('C:/users/danny/codes/node_modules/opencv/examples/files/gutter.jpg', function(err, im) {
  if (err) throw err;
  if (im.width() < 1 || im.height() < 1) throw new Error('Image has no size');


im.inRange(lower_threshold, upper_threshold);

im.save('C://users/danny/codes/coin_detected.jpg');

console.log('Image saved to C://users/danny/codes/coin_detected.jpg');
});
edit retag flag offensive close merge delete