Giter Site home page Giter Site logo

kananvyas / boxdetection Goto Github PK

View Code? Open in Web Editor NEW
120.0 11.0 54.0 421 KB

A Box detection algorithm for any image containing boxes.

Home Page: https://medium.com/@kananvyas/a-box-detection-algorithm-for-any-image-containing-boxes-756c15d7ed26

License: GNU General Public License v3.0

Python 6.06% Jupyter Notebook 93.94%
opencv-python numpy image-processing object-recognition ocr-recognition preprocessing

boxdetection's Introduction

A Box detection algorithm for tabularized data.

  • This code is used to extract data which is in tabular format using image processing techniques.
  • When you are working with Optical character recognition(OCR) or any data or object recognition problem, the first thing to do is preprocessing.
  • Here preprocessing means to extract the box where our data is located. After extracting the boxes, any OCR algorithm can be performed on those crops for recognition.

Input Image

  • The problem arises when you have to detect objects which are located in any tables/boxes or in row-column format. If the image is like this then you have to detect boxes and extract them one by one. Now it should be done accurately for all images.

This algorithm helps to detect every boxes accurately and save it in a /Output/ folder. The code is shown in src/box_detection.py

USAGE:

  • Run python src/box_detection.py
  • You can see the output crops on /Output folder

alt text

You can also read the medium article for understanding about the algorithm: https://medium.com/@kananvyas/a-box-detection-algorithm-for-any-image-containing-boxes-756c15d7ed26

boxdetection's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

boxdetection's Issues

ModuleNotFoundError: No module named 'cv2'

May seem obvious for somewhat seasoned developers.
But cv2 isn't installed by default.

A requirements.txt with the dependencies would already help a lot in setting up a virtual environment & getting started quicker.

OCR Detection using Box Co-ordinates

Can you please tellme how to extract text using co-ordinates of the rectangular box?
I tried varying the kernel length for the same.
I run the same code for different pic image but I cannot see any image being created in Cropped folder

What could be possible reason for ValueError

Find contours for image, which will detect all the boxes

im2, contours, hierarchy = cv2.findContours(img_final_bin, cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

ValueError: not enough values to unpack (expected 3, got 2)

Extract a boxe from an image

hi, i need to extract the two red boxe and i would use your code to do it but when i execute it i have a bad result. Down here my image
image-002

Even if i extracted one only big red boxe instead of two smaller, it's ok still.
Can you please help me?

not getting the exact rectangular box i need.

its working for me for some images and not working for all

here in the image it may have one circle shape and two or three rectangle boxes and in that three i need the bigger one.

if there is only one rectangle its getting but when there is two or more it giving another rectangle of different size.

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.