nfv
Version:
[Updated to use ndv package instead dv] FormVision is a node.js library for extracting data from scanned forms
9 lines (8 loc) • 388 B
JavaScript
// Generated by CoffeeScript 1.12.7
module.exports = function(image, fontWidth, fontHeight) {
var backgroundMask, foreground;
backgroundMask = image.toGray().close(fontWidth, fontHeight).convolve(fontWidth * 1.33, fontHeight * 1.33).invert();
backgroundMask = backgroundMask.add(backgroundMask);
foreground = image.toColor().add(backgroundMask.toColor());
return foreground;
};