OCR differentiate colored text from black one

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kyuuuri
Posts: 340
Joined: 09 Jan 2016, 19:20

OCR differentiate colored text from black one

20 Jan 2018, 03:19

Hello i was wondering if there is a way to make OCR differentiate / read only letters in X color.

The things i been thinking about were:

Check the image, then do pixelsearch for X color and cut text from that part to the final part. The thing is: How do i know where the text ends?
for example:

Write all red letters on the box below:
afgdaGADhbgdSFfsHNLYUP
If i'm not wrong, doing pixelsearch will start from top-left corner and will find F letter first, but not the start of the letter, that would be a problem. Maybe it finds the top part of it that is in the middle of the letter, or the left part that is the first pixel of the letter. Let's say i found the 1st pixel as i wanted, how do i know where it ends? And also, how do i know that it is the last letter?
That's why i been thinking. Is there a way to read ONLY X colored texts?

Hope you can help me to solve this.

I tried searching on google something similar but didn't find anything. Maybe i'm stupid.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: OCR differentiate colored text from black one

20 Jan 2018, 16:44

Convert all the black pixels (text) to the background color (white in your example) then OCR the red text.
Do a search for others trying to do the same with gdip.

HTH
User avatar
boiler
Posts: 16902
Joined: 21 Dec 2014, 02:44

Re: OCR differentiate colored text from black one

21 Jan 2018, 07:40

If your text is anti-aliased, it significantly complicates the problem. When you magnify the text, do you see pure black or red pixels? Or is the text made up of multiple colors at the pixel level (especially at the edges) even if it appears purely black and red to the naked eye? You can see this by using the Windows Magnifier tool or by pasting a screenshot into MS Paint and zooming in.
smarq8
Posts: 69
Joined: 16 Jan 2016, 00:33

Re: OCR differentiate colored text from black one

21 Jan 2018, 07:53

@boiler windows 7 screens magnifier blur image when "Composion" is enabled, other system as i remeber are fine.
kyuuuri
Posts: 340
Joined: 09 Jan 2016, 19:20

Re: OCR differentiate colored text from black one

24 Jan 2018, 12:57

Sry for answering late.
Thank you for checking the post.

Text is not anti-aliased. But the other letters are not always black.
How can i convert all the black pixels to another color? (sry if this is on the documents or somewhere in the forum, couldn't find it)
I think i can do normal OCR looking for a color's name like "Red" "Green" etc. And then paint all pixels that do not match that color. Or maybe if i can somehow only select X color pixels then i cut that part and do ocr on it.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ReyAHK and 253 guests