从图像中读取数据

Read data from image

我必须上传一张图片并以文本格式获取图片中的文字。该图像将是我将从移动应用程序中获取的名片。 我已经使用节点 js 完成了。我尝试使用 ocr npm,但在安装 ocr 作为依赖项时出现错误,即

$ npm install ocr
> ref@1.3.5 install E:\node_modules\ref
> node-gyp rebuild


E:\node_modules\ref>if not defined npm_config_node_gyp (node 
"C:\Users\Hello\AppData\Roaming\npm\node_modules\npm\node_modules\npm-
lifecycle\node-gyp-bin\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild 
)  else (node 
"C:\Users\Hello\AppData\Roaming\npm\node_modules\npm\node_modules\node-
gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel 
build, please add the "/m" switch.
E:\node_modules\ref\build\binding.vcxproj(20,3): error MSB4019: The imported 
project "E:\Microsoft.Cpp.Default.props" was not found. Confirm that the 
path in the <Import> declaration is correct, and that the file exists on 
disk.
gyp ERR! build error
gyp ERR! stack Error: 
`C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit 
code: 1
gyp ERR! stack     at ChildProcess.onExit 
(C:\Users\Hello\AppData\Roaming\npm\node_modules\npm\node_modules\node-
gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit 
(internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "C:\Program Files\nodejs\node.exe" 
"C:\Users\Hello\AppData\Roaming\npm\node_modules
\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd E:\node_modules\ref
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN my_actionhero_project@0.1.0 No repository field.
npm WARN my_actionhero_project@0.1.0 No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ref@1.3.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ref@1.3.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional 
logging output above.

有什么方法可以解决这个问题或我可以用来从图像中读取文本的任何其他节点模块吗?

我在 Ubuntu 中安装 ocr 时遇到了同样的错误。根据我的说法,这是 OS 特定错误。当我尝试使用 "npm i ocr" 在 MAC OS 中安装 ocr 时,它已成功安装。所以你可以试试这个。