Giter Site home page Giter Site logo

chiekon / textdetectapp Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 1.0 87.69 MB

Web App which reads text in an image captured by webcam (Python flask + DNN EAST text detection))

License: GNU General Public License v3.0

Python 2.84% JavaScript 0.69% CSS 0.23% HTML 0.38% Makefile 0.05% C++ 95.80%
python flask webapp tesseract-ocr east-text-detection ubuntu

textdetectapp's Introduction

Text Detection Web App with EAST and Python(flask)

Overview

This is a simple little web application that captures an image from the camera and detects text in it.

Technique

An image is captured on the browser, then it is sent to the server. In the server, the image data is firstly input into EAST text detection DNN model, which outputs areas detected as text area. Next, each text area is read by tesseract OCR. Words interpreted by tesseract OCR are returned to the client and are shown in the list.

Required packages

  • Python 3.7

    • OpenCV 4.1
    • Numpy 1.16
    • pytesseract
    • PIL 6.1
  • tesseract OCR v4

    • For Ubuntu:
     $ sudo apt-get install tesseract-ocr
     $ sudo apt-get install libtesseract-dev
     $ sudo apt-get install tesseract-ocr-jpn  # for Japanese language
    
  • C++ compiler (for Ubuntu)

    • build-essential:
    $ sudo apt-get install build-essential
    

Source

To implement EAST text detection, I highly referred to this GitHub repository : https://github.com/argman/EAST. The following parts in this repo are obtained from there and reused for this project.

  • textdetect/
    • lanms/: For Locality-Aware NMS in Linux (which needs g++)
    • locality_aware_nms.py: For Locality-Aware MMS in Windows (when g++ is not available)
    • restore_rectangle_rbox() and restore_rectangle() in textdetect.py(): Copied from icdar.py in the sample repo. These functions are used to calculate rectangle coordinates from output of EAST DNN.

Also the frozen model file (model/frozen_east_text_detection.pb) was obtained from the following link.

Run

Open a terminal, go to the repository root, then input the following command:

python app.py

Open a browser, and access "localhost:5000".

Note

I tested on Linux(Ubuntu 18.4) and Google Chrome(v 79) in a local network environment. In the case of use which should accept accesses on the internet, it's necessary to setup HTTPS connection, otherwise the web camera won't be accessible.

When I started to think of this project, I was heavily inspired by this tutorial: "OpenCV OCR and text recognition with Tesseract" in PyImageSearch. I learned a lot from this and related posts. This is one of the greatest blogs and I always go to there when I want to learn something about handling images!

textdetectapp's People

Contributors

chiekon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

feiyang2008

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.