Canny edge detector
$ npm install canny-edge-detector image-js
Find edges in an image using the Canny algorithm.
Returns a greyscale image with the edges at options.brightness
value.
arguments
image
- a greyscale Imageoptions
- an optional object
options
lowThreshold
: Low threshold for the hysteresis procedure (default: 10).highThreshold
: High threshold for the hysteresis procedure (default: 30).gaussianBlur
: Sigma parameter for the gaussian filter step (default: 1.1).brightness
: Values assigned to each edge pixel on the result image (default: image.maxValue).
const cannyEdgeDetector = require('canny-edge-detector');
const Image = require('image-js').Image;
Image.load('my-image.png').then((img) => {
const grey = img.grey();
const edge = cannyEdgeDetector(grey);
return edge.save('edge.png');
})