Module offering OpenCV image processing.
The filter architecture follows the pattern defined by Jerry Huxtable in the JH Labs Java Image Processing library, available from: http://www.jhlabs.com/ip/filters and licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0).
To use, import 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 "image" and output "result", to run findEdges():
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); }); });
The module supports these transforms: Filter.blur(options): Blur the image, optionally passing in options.blurSize (1-25). Filter.dilate(options): Dilate the image, optionally passing in options.erosionSize (0-21). Filter.erode(options): Erode the image, optionally passing in options.erosionSize (0-21). Filter.findContours(options): Find contours of an image, optionally passing in options.cannyThreshold (10-150). Filter.findEdges(options): Find edges of an image, optionally passing in options.cannyThreshold (10-150). Filter.gaussianBlur(options): Blur the image, optionally passing in options.blurSize (1-25). Filter.histogram(): Create a histogram from the image showing red, green and blue content. Filter.makeBGRA(): Convert image to blue, green, red, alpha colorspace. Filter.makeGray(): Convert image to grayscale. Filter.makeHSV(): Convert image to hue, saturation, value colorspace. Filter.makeYUV(): Convert image to luminance, chroma colorspace.
- Version:
- $$Id$$
- Source:
Methods
(static) filter(image, transform, options, callback)
Apply a filter to an image using (optional) options. Any unrecognized options are ignored. Note that previously applied options for a given filter will still be used, even if they are not set in this call.
Parameters:
Name | Type | Description |
---|---|---|
image |
The image to filter. |
|
transform |
The name of the transform to apply to the image. |
|
options |
An object whose fields specify filter options. |
|
callback |
The callback to invoke once the result image is ready. |
(static) filters()
Return an array of filters provided by this module.