简体   繁体   中英

How to extract text from an image using JavaScript

I want to extract all the information which I can get from an image so if that image contains:

Name : john doe
Dob : 12/12/2012

After user has uploads that image I want to extract those two pieces of information on two variables and store those in my database. I have tried Orcad.js but that did not work for me :(. Are there other methods to extract text from an image and store it via JavaScript?

Javascript is a whole computer language (despite criticism against it) and since the arrival of NodeJS , simply saying Javascript doesn't communicate to the community whether you're trying to do this in the browser or on your server.

The functionality that you're describing is optical character recognition ( OCR ). Does Javacript have it built-in? No . That's the short answer to your question.

Is it possible to do this using the Javascript language? Yes, but you'll have to work to make it work. As you've already discovered, there are projects like Ocrad.js which implement the OCR algorithm's in Javascript and run right in your browser. That demo seems to work reasonably well for me. Care to elaborate on the specific issues you encountered?

On the other, more obvious end of the spectrum, if you're running Javascript on your server, then you can use Javascript to write OCR code (much like Ocrad), or you can delegate it to some application you can download and run on your server like OCR4Linux .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM