Coder Social home page Coder Social logo

yardstick17 / image_text_reader Goto Github PK

View Code? Open in Web Editor NEW
142.0 13.0 41.0 6.46 MB

The module extracts text from image using the tesseract-OCR engine. Generally, text present in the images are blur or are of uneven sizes. The image is pre-processed for better comprehension by OCR. This module first makes bounding box for text in images and then normalizes it to 300 dpi, suitable for OCR engine to read.

License: MIT License

Python 90.66% Dockerfile 1.69% Makefile 3.03% Shell 4.62%
ocr image-reader image-to-text tesseract-ocr read-image ocr-text-reader

image_text_reader's People

Contributors

yardstick17 avatar

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  avatar  avatar

image_text_reader's Issues

killed the program

htop full memory used. but no any outputs few minute process automatically killed

Inital commands

Hey man, thank you for the repository. Looks really good.

Could you add the initial commands to the readme file? I having an issue with the output and I think it is because I miss some step in the installation.

What I am gettting:
from this command: PYTHONPATH='/usr/bin/python3' python3 read_image.py read_text_from_local_image -f images/sample_image.jpg

Something like this:

[2019-06-22 20:45:35,880] INFO : Processing image for text Extraction
[2019-06-22 20:45:36,043] INFO : Removing noise and smoothening image
[2019-06-22 20:45:36,108] INFO : Reading the text inside the contour plotted


- 'souihpu! c09

'19?!
94-5966-494


harp lager.


6.75


Do you have any hint about the reason behind this?

Thanks!

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

can you kindly help me with this ?

$ PYTHONPATH='.' python3 read_image.py read-text-from-local-image -f PHOTO-2024-02-15-13-03-31.jpg
[2024-02-15 14:54:07,764] INFO : Processing image for text Extraction
[2024-02-15 14:54:07,797] INFO : Removing noise and smoothening image
Traceback (most recent call last):
  File "read_image.py", line 135, in <module>
    cli()
  File "/home/sridhar/.local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/sridhar/.local/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/sridhar/.local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/sridhar/.local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/sridhar/.local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "read_image.py", line 119, in read_text_from_local_image
    return read_image_from_file(filename)
  File "read_image.py", line 92, in read_image_from_file
    image_text = extract_image_text(image)
  File "read_image.py", line 36, in extract_image_text
    contours = find_possible_contours_in_image(inv_img)
  File "read_image.py", line 84, in find_possible_contours_in_image
    _, contours, hierarchy = cv2.findContours(
ValueError: not enough values to unpack (expected 3, got 2)
$ pip3 freeze | grep opencv-python
opencv-python==4.9.0.80

Error while testing

Hey, I am new to OCR and was trying I was just trying to this locally using the commands you had provided. I am getting the following error.

[2019-02-26 15:41:04,244] INFO : Downloading image from url: https://marketplace.canva.com/MACHUlPU93Q/1/0/thumbnail_large/canva-peach-green-leaves-garden-vegeta
[2019-02-26 15:41:04,395] INFO : Saving file: /var/folders/wd/p0271j0x695_t5m5h0zr0dd00000gp/T/tmpzj06kyq7
[2019-02-26 15:41:04,395] INFO : Processing image for text Extraction
[2019-02-26 15:41:04,527] INFO : Removing noise and smoothening image
Traceback (most recent call last):
File "read_image.py", line 135, in
cli()
File "/anaconda3/lib/python3.6/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/anaconda3/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/anaconda3/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/anaconda3/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "read_image.py", line 127, in read_text_from_image_url
return read_image_from_file(filename)
File "read_image.py", line 92, in read_image_from_file
image_text = extract_image_text(image)
File "read_image.py", line 36, in extract_image_text
contours = find_possible_contours_in_image(inv_img)
File "read_image.py", line 85, in find_possible_contours_in_image
dilated, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) # get contours
ValueError: not enough values to unpack (expected 3, got 2)

Can you tell me where i am going wrong with this

Error after run

Hi!

docker run -it yardstick17/image-text-reader bash -c 'PYTHONPATH='.' python3 read_image.py read_text_from_local_image -f 2.jpg'

python3: -c: line 0: unexpected EOF while looking for matching `''
python3: -c: line 1: syntax error: unexpected end of file

What the problem?

IOError: [Errno 13] Permission denied

When I followed the example but used my own picture, I got this error. My error report is as follows
Traceback (most recent call last):
File "", line 1, in
File "", line 3, in read_image_from_file
File "", line 7, in extract_image_text
File "", line 3, in read_contours_text
File "", line 10, in get_text_with_location
File "", line 7, in extract_image_from_location
File "C:\ProgramData\Anaconda2\lib\site-packages\PIL\Image.py", line 2410, in open
fp = builtins.open(filename, "rb")
IOError: [Errno 13] Permission denied: 'c:\users\hongwei\appdata\local\temp\tmphyfwny.jpg'

Api Creation

Hey I used the code mentioned to create an api : PYTHONPATH='.' python3 api/app.py

  • Serving Flask app "app" (lazy loading)
  • Environment: production
    WARNING: Do not use the development server in a production environment.
    Use a production WSGI server instead.
  • Debug mode: on
    [2019-06-04 12:21:48,060] INFO : * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
    [2019-06-04 12:21:48,061] INFO : * Restarting with stat
    [2019-06-04 12:21:48,314] WARNING : * Debugger is active!
    [2019-06-04 12:21:48,318] INFO : * Debugger PIN: 370-660-369

However whenever i try accessing 127.0.0.1:5000 , the site cannot be reached.

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.