Git Product home page Git Product logo

imagetextrecognition's Introduction

ImageTextRecognition

Text Detection and Recognition in Natural Images

Pipeline

Conversion from color to gray scale

img = cv2.imread('test2.jpg',0) #0 indicates read in gray scale

Apply MSER algorithm to get regions that probably contain text

Use MSER to extract regions that may contain text. For more information refer to, Wikipedia: (MSER) MAXIMALLY STABLE EXTREMAL REGIONS

mser = cv2.MSER()
regions = mser.detect(img, None)    #detect and extract MSER lasso-contours

Form convex-hulls from the lasso contours

Convex-hulls are formed from the lasso contours

hulls = [cv2.convexHull(p.reshape(-1, 1, 2)) for p in regions]  #take convex-hull of each contour

Convert convex-hulls to bounding rectangles

The convex hulls are converted to bounded rectangles and redundant rectangles that are contained in other rectangles are removed.

x,y,w,h = cv2.boundingRect(hull)    #convert the hull to bounding rectangle

Perform OTSU Binarization

OTSU Binarization of region under rectangle is performed to make the text stand out from the background For more information refer to, Wikipedia: OTSU Binarization

thresh,letter = cv2.threshold(letter,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)

For regions getting binarized into black backgrounds and white text, inversion is performed using simple heuristic

Normalize the rectangle to standard size 64x64

Xnorm = [mynormalization(image,(64,64)) for image in X]

imagetextrecognition's People

Contributors

gvaibhav21 avatar sharan-lobana avatar

Watchers

 avatar  avatar

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.