|
Version0 /
computerVision moduleA module for computer vision, offering functionality from OpenCV. The browser version uses the UC Irvine and Intel OpenCV.js port, https://github.com/ucisysarch/opencvjs. To run an example, please point your browser to: https://ptolemy.berkeley.edu/accessors/hosts/browser/demo/computerVision/computerVision.html Face detection is now in a separate module. To try, please point your browser to: https://ptolemy.berkeley.edu/accessors/hosts/browser/demo/faceDetector/faceDetector.html To run in CapeCode, please install OpenCV, then try FunctionsThe following functions are implemented by this module:
Filter uses the event emitter pattern common in JavaScript, emitting:
UsageImport the module: var cv = require('computerVision');
To obtain a list of filters: var filters = cv.filters; Invoke a filter and handle the result. For example, in an accessor with an input var self = this;
this.addInputHandler('input', function() {
var image = this.get('input');
var options = {};
options.cannyThreshold = 20;
cv.filter(image, 'findEdges', options, function(result) {
self.send('output', result);
});
});
Installing OpenCVOn Windows, please follow these instructions. On Mac, OpenCV can be installed through MacPorts. I encountered problems with Homebrew. From the command line: sudo port install opencv +java This should install If you'd like to try installing through Homebrew, try this and if that doesn't work try this. This appeared to install OpenCV for me, but not to the folder that Ptolemy looks for, Browser displayThe browser version uses the ImageProcessingDisplay module to automatically set up before and after canvases. See AlsoBack to Optional JavaScript Modules |