Vis2 - Image to Text OCR()

Post your working scripts, libraries and tools for AHK v1.1 and older
rawkus123
Posts: 2
Joined: 28 Nov 2021, 08:19

Re: Vis2 - Image to Text OCR()

Post by rawkus123 » 28 Nov 2021, 20:10

why hasnt anyone updated this great script with new databases and tesseract lol?

Nadaleh
Posts: 26
Joined: 26 Aug 2021, 15:04

Re: Vis2 - Image to Text OCR()

Post by Nadaleh » 30 Nov 2021, 11:51

when i use OCR i have return value "1234,567" can i use some kind of command that allow me to hide "," and maybe all values after "," so i want in return recieve 1234 or 1234567 value?

iseahound
Posts: 1427
Joined: 13 Aug 2016, 21:04
Contact:

Re: Vis2 - Image to Text OCR()

Post by iseahound » 09 Dec 2021, 10:41

rawkus123 wrote:
28 Nov 2021, 20:10
why hasnt anyone updated this great script with new databases and tesseract lol?
Sure. The plan is to move forward slowly to give people time to update their versions of Vis2 without breaking anything. In addition to updating the tesseract database, I am also planning to update this script to be compatible with AutoHotkey v2. Also, I intend to remove Gdip_All.ahk because there is no v2 version. I hope no one needs it.

You can find v2.0 of Vis2 here: https://github.com/iseahound/Vis2/releases

buliasz
Posts: 26
Joined: 10 Oct 2016, 14:31
Contact:

Re: Vis2 - Image to Text OCR()

Post by buliasz » 19 Dec 2021, 20:10

Actually there is AHKv2 version of the `Gdip_All.ahk`, you can grab it from my GitHub: https://github.com/buliasz/AHKv2-Gdip
BTW for Tesseract I've also created GUI to train languages. You can use it to train your language to improve it's results. Here's the code (AHK v2) and a compiled executable: https://github.com/buliasz/tesstrain-windows-gui

Finallf
Posts: 18
Joined: 30 Oct 2020, 13:52

Re: Vis2 - Image to Text OCR()

Post by Finallf » 15 Feb 2022, 06:11

iseahound wrote:
09 Dec 2021, 10:41
rawkus123 wrote:
28 Nov 2021, 20:10
why hasnt anyone updated this great script with new databases and tesseract lol?
Sure. The plan is to move forward slowly to give people time to update their versions of Vis2 without breaking anything. In addition to updating the tesseract database, I am also planning to update this script to be compatible with AutoHotkey v2. Also, I intend to remove Gdip_All.ahk because there is no v2 version. I hope no one needs it.

You can find v2.0 of Vis2 here: https://github.com/iseahound/Vis2/releases
I have a script all in AHKv2, is there any way I can use Vis2

iseahound
Posts: 1427
Joined: 13 Aug 2016, 21:04
Contact:

Re: Vis2 - Image to Text OCR()

Post by iseahound » 18 Feb 2022, 17:36

I'll have to find some spare time to work on it.

Finallf
Posts: 18
Joined: 30 Oct 2020, 13:52

Re: Vis2 - Image to Text OCR()

Post by Finallf » 19 Feb 2022, 15:42

iseahound wrote:
18 Feb 2022, 17:36
I'll have to find some spare time to work on it.
What I need is to make AHK read a specific coordinate where the text is, and return the text in some variable.

If you can tell me on which line of your code, it performs the screen reading and on which line it passes to the tesserac to perform the OCR and returns it in some VAR?
I could already porting at least these parts to AHKv2

iseahound
Posts: 1427
Joined: 13 Aug 2016, 21:04
Contact:

Re: Vis2 - Image to Text OCR()

Post by iseahound » 20 Feb 2022, 00:08

In that case you can use ImagePutFile from https://github.com/iseahound/ImagePut

and pass it to the command line calls of leptonica and tesseract read the output file and set it to the variable.

To properly port Vis2 I need to work on the screen selection rectangle and just write better code 🤣 this was my first real project.

iseahound
Posts: 1427
Joined: 13 Aug 2016, 21:04
Contact:

Re: Vis2 - Image to Text OCR()

Post by iseahound » 03 Mar 2022, 13:21

v2.1
This release improves the image processing functionality of Vis2.
  • Uses ImagePut instead of Gdip_All.ahk
  • Accepts over 20+ input types over the existing 6. See Documentation here.
  • Includes multi-monitor DPI support for image capture.
  • Ability to specify image type, scale and crop parameters.
https://github.com/iseahound/Vis2/releases

Spitzi
Posts: 301
Joined: 24 Feb 2022, 03:45

Re: Vis2 - Image to Text OCR()

Post by Spitzi » 20 Mar 2022, 13:02

Hello iseahound.

Thanks for your great OCR Tool, which is exactly what I need.

The OCR does just no work as robust as I need it to be... I have pictures like the one below and I would like to ocr the orange text, which does not seem to be too hard. Sometimes the text is correct, sometimes it isn't, which is not good enouh for me. Do you have any tips for improving the output?
image.png
image.png (18.47 KiB) Viewed 3987 times
Thanks for your help. Greets Simon

Spitzi
Posts: 301
Joined: 24 Feb 2022, 03:45

Re: Vis2 - Image to Text OCR()

Post by Spitzi » 20 Mar 2022, 16:24

ok, i succeeded with removing the grayscale background using

viewtopic.php?f=76&t=61756

It works a little better. - but still not super great. is ist possible to not use a language at all and hav Vis2 just detect the characters without having to make sense of the words?

Also, it takes 5 seconds on my computer to ocr a picture - probably in best mode. Can I speed it up? Can I use the fast mode as a default?

Any help appreciated. Greets Simon

Krd
Posts: 405
Joined: 10 Mar 2020, 02:46

Re: Vis2 - Image to Text OCR()

Post by Krd » 19 Apr 2022, 05:22

How to get this working with coordiantes when eng+ another language?

I get this to work, but don't know how to add an extra language:

Clipboard := OCR([173, 536, 188, 14])

Where to for exampel put this with the line above?:
#c:: OCR(, "eng+fra")

This doesn't work:
#c::
Clipboard := OCR(, "eng+fra")([173, 536, 188, 14])

thut11
Posts: 58
Joined: 13 Apr 2020, 14:00

Re: Vis2 - Image to Text OCR()

Post by thut11 » 15 May 2022, 15:48

is there a way to make OCR([x, y, w, h]) faster? It takes around 1s to "recognize" 3digits number but im sure it possibly could be faster.

Joeyy
Posts: 46
Joined: 08 Mar 2019, 01:57

Re: Vis2 - Image to Text OCR()

Post by Joeyy » 04 Jun 2022, 08:22

Thanks for your work! But how to change the background color when draging to select a portion of the screen? The color is too shallow to see in some white-panel software.

Joeyy
Posts: 46
Joined: 08 Mar 2019, 01:57

Re: Vis2 - Image to Text OCR()

Post by Joeyy » 04 Jun 2022, 08:55

On my Surface 3, when pressing hotkey, the crosshair appears, but when dragging the pointer, nothing happens, I can't select an area and presing Esc has no response.

iseahound
Posts: 1427
Joined: 13 Aug 2016, 21:04
Contact:

Re: Vis2 - Image to Text OCR()

Post by iseahound » 04 Jun 2022, 11:03

Are you using touch input? I'll have to borrow a laptop to test

Joeyy
Posts: 46
Joined: 08 Mar 2019, 01:57

Re: Vis2 - Image to Text OCR()

Post by Joeyy » 04 Jun 2022, 23:05

iseahound wrote:
04 Jun 2022, 11:03
Are you using touch input? I'll have to borrow a laptop to test
No, physical keyboard.

User avatar
vSky
Posts: 80
Joined: 30 May 2022, 10:13

Re: Vis2 - Image to Text OCR()

Post by vSky » 09 Jun 2022, 14:46

What do I need to do to have it scan and read only those with certain colors? Example; Find and scan only those with the color 0xff0000(red).

In the meantime, it was a successful work. Thanks for your sharing.

iseahound
Posts: 1427
Joined: 13 Aug 2016, 21:04
Contact:

Re: Vis2 - Image to Text OCR()

Post by iseahound » 09 Jun 2022, 16:21

If you upgrade your version of ImagePut to the latest version here: https://github.com/iseahound/ImagePut/blob/master/ImagePut%20(for%20v1).ahk

Write:

Code: Select all

if ImagePutBuffer("myfile.pdf").PixelSearch(0xFF0000) ; Check if file has red pixel
   OCR("myfile.pdf")

User avatar
vSky
Posts: 80
Joined: 30 May 2022, 10:13

Re: Vis2 - Image to Text OCR()

Post by vSky » 09 Jun 2022, 18:47

iseahound wrote:
09 Jun 2022, 16:21
If you upgrade your version of ImagePut to the latest version here: https://github.com/iseahound/ImagePut/blob/master/ImagePut%20(for%20v1).ahk

Write:

Code: Select all

if ImagePutBuffer("myfile.pdf").PixelSearch(0xFF0000) ; Check if file has red pixel
   OCR("myfile.pdf")
Yes, this meets what I said, but all my transactions are determined according to instant results. I scan an area like "h150w50" but sometimes it prevents background reading. Is there a way to do this without using "ImagePut"?

Post Reply

Return to “Scripts and Functions (v1)”