Giter VIP home page Giter VIP logo

boundbox's Introduction

boundbox

boundbox is a lightweight container for OCR bounding boxes.

Key Features

Bounding box operations such as scaling, merging. Developers can use boundbox when they need the flexibility to change between different OCR services or bounding box

  • Easy switch between OCR services with minimum code change
  • Supports bounding box operation such as scaling, merging, rotating etc.
  • Supports most of the commonly used OCR services such as pytesseract, Google Vision Ocr, Azure OCR etc.
  • Support labelling tools such as LabelImg and box operations on images
  • Image transformation features such as perspective transformations and box visualizations

Installation

boundbox supports Python >= 3.6. You can install it by doing

pip install boundbox

Box corners

"""

     (y axis)
        -
        -
        -
----------------------------------------------------------------------  (x axis)
        -
        -                    p1
        -                  .       .
        -                .               .
        -              .                      .
        -            .                             .
        -          p4                                  p2
        -                .                            .
        -                     .                     .
        -                          .              .
        -                               .       .
        -                                    p3
        -
        -
        -
        -
    
"""

Usage

pytesseract

from Boundbox import BoundBox

import cv2
from pytesseract import image_to_data, Output

# load image to numpy array
img = cv2.imread('test.png')

# image to pytesseract data
data = image_to_data(img, output_type=Output.DICT)

# list of all bounding boxes found in image
box_list = BoundBox.pytesseract_boxes(data)

box = box_list[0]

# corner points of the boxes are accessed by variable 'p1', 'p2', 'p3', 'p4'

print(box.p1, box.p2, box.p3, box.p4)

>>> (77, 30) (420, 30) (420, 94) (77, 94)

# text value is accessed by 'text_value' 

print(box.text_value)

>>> Noisyimage

# draw the box on the image
drawn = box.draw_box(img)

drawn

boundbox's People

Contributors

akash1729 avatar

Stargazers

Mehrdad Azizi avatar

Watchers

Manu Puthiyadath 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.