How to separate Picture from text with node.jS
This article mainly explains the "node.jS how to achieve picture and text separation", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "node.jS how to achieve picture and text separation" bar!
This paper gives you an example to share the specific code of NodeJS to achieve image text segmentation, for your reference, the specific contents are as follows
Var fs = require ('fs'); var jpeg = require (' jpeg-js') function getSumRGB (data, I) {var cr = data.data [iLiu0] var cg = data.data [iTh1] var cb = data.data [iTh2] var srgb = (cr+cg+cb) return srgb} function getTopRGB (data, I) {var topIndex = (data.width * 4 *-1) I = I + topIndex Var cr = data.data [iTun0] var cg = data.data [iTun1] var cb = data.data [iTun2] return [cr,cg,cb]} function getHeightRGB (data, I, haveRGB) {var width = data.width var height = data.height var len = width * height * 4 var haveNum = 0 for