Link to home
Start Free TrialLog in
Avatar of theology1
theology1

asked on

Get text from Image

I need to read data from image , I am using ocr to read data but some images have background text due to which unable to get exact text.
For reference, attached below file "img.png" , from this I need only to read "+ 30s" as text
another image "onlyLive.png" from this only read "Live" as text

I tried to use imagemagick using "Live" hex code to black everything to black except "Live" but as seen in the image that other  background text is also white.
convert onlyLive.png  -fill black -fuzz 10% +opaque '#ECECEC' onlyLivee_black.png

I am using Python + openCv
img.png
onlyLive.png
Avatar of aikimark
aikimark
Flag of United States of America image

The problem with the first one is that there is no border for the white letters.

Does the white color in the white letters differ from any of the white in the background?
Avatar of theology1
theology1

ASKER

The first one done have any border's
No they are the same , I tried to convert with  hex code of + 30 s , other then that black out every thing but it dosent work.

is there any algorithm in open cv or  other tool which can grey out the background and lave the +30 s as foreground.
The quality of your images are to low to do OCR, even online ML systems fail
https://azure.microsoft.com/en-us/services/cognitive-services/computer-vision/
As Shaun said, real OCR might be impossible.

at least not with adding more constraints to the search of the right word.

I do not know the context, but does the text you want to recognize always show up on the same exact location.

Is the size, the color of the text known?
Do you have a limited character set that will show up at the given place?
like for example only +, -, 0-9 and the decimal?

This might perhaps allow you to do a brute force, backtracking pseudo OCR.

If location, font size, spacing and color and character set are known you could get the image,
try to write a character at the first position and discard any, that cause a considerable difference.
Then write a second character, etc.

If the location is not constant, but font size, spacing and color are.
Can you capture one image without the text and detect when the text shows up?
I think my last response not updated somehow.

Thanks Shaun Vermaak and gelonida

To answer the above query:

Is the size, the color of the text known?
Answer>>  yes they are known, even I am trying with "Live" hex color code but back ground text also using the same hex code due to which unable to read.


If location, font size, spacing and color and character set are known you could get the image,

Answer> as Location is different but I am taking snapshot for the full frame 720X1280 and from that cutting the desired image which as attached but I am able to handle so not a challenge

font size, spacing should be same for all the time

I captured image without background text
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.