Hi, Iseahound,
Speaking of accuracy, I was thinking of using blacklist and creating two different ocr()'s. One for alpha and one for numeric. Is there a blacklist function like whitelist?
Thank you.
Vis2 - Image to Text OCR()
Re: Vis2 - Image to Text OCR()
Update: There is some heavy development going on at the moment. Going forward, there will be less of a dependence on Tesseract. Just a reminder that this project is not dead.
-
- Posts: 934
- Joined: 30 Sep 2017, 03:59
- Location: Romania
- Contact:
Re: Vis2 - Image to Text OCR()
Very good to hear this!
Good luck and thank you for developing it further.
Good luck and thank you for developing it further.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
Re: Vis2 - Image to Text OCR()
Hi, I like this work very much. Thank you.
My English is not good.
I don't understand how to run this function from a macro I created.
I want to send the coordinates and copy the text. But how.
Thanks.
My English is not good.
I don't understand how to run this function from a macro I created.
I want to send the coordinates and copy the text. But how.
Thanks.
Re: Vis2 - Image to Text OCR()
I tried the tool and it gives excellent result. I hope new development could reduce package size (24 Mo)and dependences
Thank you so much!
Re: Vis2 - Image to Text OCR()
Hello Iseahound, I like your tesseract wrapper and I'am watching your progress since month's. I'am using your library for some experiments with pdf files.
I missed a solution to use my own leptonica and tesseract directory's. More than about 3 times I changed your Vis2.ahk file at this position to the path's I use.
Today I just wanted to write a function in the hope that you find this useful. The function will write's the path of tesseract, tessdata and leptonica_util to an .ini file.
If someone want to use tesseract from your repository the function will write and read relative path's. So you can leave a ready made .ini file in your \lib directory of your repository.
Is this file is deleted or some key are deleted or missed, my function will ask for it.
This is an ini-file with relative paths:
Part1:
Part2:
I missed a solution to use my own leptonica and tesseract directory's. More than about 3 times I changed your Vis2.ahk file at this position to the path's I use.
Code: Select all
class Tesseract {
static leptonica := A_ScriptDir "\bin\leptonica_util\leptonica_util.exe"
static tesseract := A_ScriptDir "\bin\tesseract\tesseract.exe"
static tessdata_best := A_ScriptDir "\bin\tesseract\tessdata_best"
static tessdata_fast := A_ScriptDir "\bin\tesseract\tessdata_fast"
If someone want to use tesseract from your repository the function will write and read relative path's. So you can leave a ready made .ini file in your \lib directory of your repository.
Is this file is deleted or some key are deleted or missed, my function will ask for it.
This is an ini-file with relative paths:
Code: Select all
[leptonica]
exePath=\bin\leptonica_util\leptonica_util.exe
[tesseract]
exePath=\bin\tesseract\tesseract.exe
data_best=\bin\tesseract\tessdata_best
tessdata_fast=\bin\tesseract\tessdata_fast
Code: Select all
class Tesseract {
static leptonica := Vis2.stdlib.paths("leptonica")
static tesseract := Vis2.stdlib.paths("tesseract")
static tessdata_best := Vis2.stdlib.paths("tessdata_best")
static tessdata_fast := Vis2.stdlib.paths("tessdata_fast")
...
Code: Select all
class stdlib {
...
; for user customable paths to leptonica and tesseract
paths(toWhat){
static lastdir
If Instr(toWhat, "leptonica")
{
IniRead, leptonica, % A_ScriptDir "\lib\Vis2.ini", leptonica, exePath
If ( (leptonica="ERROR") or !InStr(leptonica, "leptonica_util.exe") )
{
Vis2.Graphics.Subtitle.Render("You have not specified a path to leptonica_util.exe.`nPlease select the file now!", "t7000 xCenter y5% p1.35% c88EAB6 r8", "s2.23% cBlack")
again:=1
While (again=1)
{
FileSelectFile, leptonica,, C:, Please select leptonica.exe, *.exe
If InStr(leptonica, "leptonica_util.exe")
again=0
}
If Instr(leptonica, A_ScriptDir)
leptonica:= StrReplace(leptonica, A_ScriptDir)
IniWrite, % leptonica, % A_ScriptDir "\lib\Vis2.ini", leptonica, exePath
If ErrorLevel
throw Exception("Can not write to ini file!",, A_ScriptDir "\lib\Vis2.ini")
}
lastDir:= Vis2.stdlib.GetParentDir(leptonica)
return SubStr(leptonica, 1, 1) = "\" ? A_ScriptDir . leptonica : leptonica
}
If Instr(toWhat, "tesseract")
{
IniRead, tesseract, % A_ScriptDir "\lib\Vis2.ini", tesseract, exePath
If ( (tesseract="ERROR") or !InStr(tesseract, "tesseract.exe") )
{
Vis2.Graphics.Subtitle.Render("You have not specified a path to tesseract.exe.`nPlease select the file now!", "t7000 xCenter y5% p1.35% c88EAB6 r8", "s2.23% cBlack")
again:=1
While (again=1)
{
FileSelectFile, tesseract,, % lastDir, Please select tesseract.exe, *.exe
If InStr(tesseract, "tesseract.exe")
again=0
}
If Instr(tesseract, A_ScriptDir)
tesseract:= StrReplace(tesseract, A_ScriptDir)
IniWrite, % tesseract, % A_ScriptDir "\lib\Vis2.ini", tesseract, exePath
If ErrorLevel
throw Exception("Can not write to ini file!",, A_ScriptDir "\lib\Vis2.ini")
}
lastDir:= Vis2.stdlib.GetParentDir(tesseract)
return SubStr(tesseract, 1, 1) = "\" ? A_ScriptDir . tesseract : tesseract
}
If Instr(toWhat, "tessdata_best")
{
IniRead, tessdata_best, % A_ScriptDir "\lib\Vis2.ini", tesseract, data_best
If (tessdata_best="ERROR")
{
Vis2.Graphics.Subtitle.Render("You have not specified a path to tessdata_best.`nPlease select the path now!", "t7000 xCenter y5% p1.35% c88EAB6 r8", "s2.23% cBlack")
again:=1
While (again=1)
{
FileSelectFolder, tessdata_best, % lastDir, 2, Please select path to tessdata_best
again:=ErrorLevel
}
If Instr(tessdata_best, A_ScriptDir)
tessdata_best:= StrReplace(tessdata_best, A_ScriptDir)
IniWrite, % tessdata_best, % A_ScriptDir "\lib\Vis2.ini", tesseract, data_best
If ErrorLevel
throw Exception("Can not write to ini file!",, A_ScriptDir "\lib\Vis2.ini")
}
lastDir:= Vis2.stdlib.GetParentDir(tessdata_best)
return SubStr(tessdata_best, 1, 1) = "\" ? A_ScriptDir . tessdata_best : tessdata_best
}
If Instr(toWhat, "tessdata_fast")
{
IniRead, tessdata_fast, % A_ScriptDir "\lib\Vis2.ini", tesseract, tessdata_fast
If (tessdata_fast="ERROR")
{
Vis2.Graphics.Subtitle.Render("You have not specified a path to tessdata_fast.`nPlease select the path now!", "t7000 xCenter y5% p1.35% c88EAB6 r8", "s2.23% cBlack")
again:=1
While (again=1)
{
FileSelectFolder, tessdata_fast, % lastDir, 2, Please select path to tessdata_fast
again:=ErrorLevel
}
If Instr(tessdata_fast, A_ScriptDir)
tessdata_fast:= StrReplace(tessdata_fast, A_ScriptDir)
IniWrite, % tessdata_fast, % A_ScriptDir "\lib\Vis2.ini", tesseract, tessdata_fast
If ErrorLevel
throw Exception("Can not write to ini file!",, A_ScriptDir "\lib\Vis2.ini")
}
return SubStr(tessdata_fast, 1, 1) = "\" ? A_ScriptDir . tessdata_fast : tessdata_fast
}
}
; small RegEx function to get parent dir from a given string
GetParentDir(Dir){
Return RegExReplace(Dir, "\\[^\\]+$")
}
}
class Text {
Re: Vis2 - Image to Text OCR()
Hi,
First, Iseahound this is a beautiful tool, thank you for that.
Second, is there a way to find coordinate position of string that I am searching for.
Usually there is only one unique string, but somethimes there are few of them on same page.
First, Iseahound this is a beautiful tool, thank you for that.
Second, is there a way to find coordinate position of string that I am searching for.
Usually there is only one unique string, but somethimes there are few of them on same page.
Re: Vis2 - Image to Text OCR()
And one more question is how to increase limit of characters to be able read the whole picture from once?
For now I only get part of the page as a result.
For now I only get part of the page as a result.
-
- Posts: 23
- Joined: 11 Jan 2019, 18:42
Re: Vis2 - Image to Text OCR()
hi, i'm tryng to use it, after download ai have runned demo.ahk but i have the following error.
i use SciTE4AutoHotkey
Version 3.0.06.01
i use SciTE4AutoHotkey
Version 3.0.06.01
- Attachments
-
- errore_vis2.png (67.16 KiB) Viewed 7279 times
Re: Vis2 - Image to Text OCR()
The syntax for the directive is #include ...automatLife84 wrote: ↑18 Mar 2019, 04:33hi, i'm tryng to use it, after download ai have runned demo.ahk but i have the following error.
(copy/paste error )
-
- Posts: 23
- Joined: 11 Jan 2019, 18:42
Re: Vis2 - Image to Text OCR()
Sorry for the distraction error.
with the #include directive the error persists
with the #include directive the error persists
- Attachments
-
- errore_vis2.png (67.43 KiB) Viewed 7244 times
Re: Vis2 - Image to Text OCR()
Since the error message doesn't say "Function library not found.", but "not ... recognized action", my best guess is that your AHK version is ancient, pre-2011.
The used syntax with <...> was introduced in [v1.0.90+], September 2010. If that's the case, either update or use one of the older syntax alternatives.
-
- Posts: 23
- Joined: 11 Jan 2019, 18:42
Re: Vis2 - Image to Text OCR()
i have update the directive code like this
#include %A_ScriptDir%\lib\Vis2.ahk
but i have the same error
#include %A_ScriptDir%\lib\Vis2.ahk
but i have the same error
-
- Posts: 23
- Joined: 11 Jan 2019, 18:42
Re: Vis2 - Image to Text OCR()
i have unistall and reinstalled ahk + scite and now work
thanks
thanks
-
- Posts: 23
- Joined: 11 Jan 2019, 18:42
Re: Vis2 - Image to Text OCR()
thanks for this great script.
it's possible when whe put Screen Coordinates as an Array to display a rectangle box to display te selection Coordinates
text:= OCR([0, 100, 200, 150])
thanks in advance
it's possible when whe put Screen Coordinates as an Array to display a rectangle box to display te selection Coordinates
text:= OCR([0, 100, 200, 150])
thanks in advance
Re: Vis2 - Image to Text OCR()
Love this lib, but I use GNU aspell http://aspell.net to filter the output to have little to no misspellings or errors, just thought you'd want to consider integrating it, or functionality similar to further refining the output of tesseract. It's free, command line, open source & supports multiple languages though, but maybe you could even use COM to use the office spell checker, anyway, just suggestions & thanks for this brilliant wrapper
Re: Vis2 - Image to Text OCR()
Currently working on a Graphics library to help display important information. Thanks everyone for using this!
-
- Posts: 23
- Joined: 11 Jan 2019, 18:42
Re: Vis2 - Image to Text OCR()
i love this lib, it save my life.. it's possible to return the Screen Coordinates of a searched text ?
Re: Vis2 - Image to Text OCR()
Some computer when run error with this code :
---------------------------
demo.ahk
---------------------------
Error at line 42 in #include file "C:\Users\admin\Desktop\Vis2-master\Lib\JSON.ahk".
Line Text: JSON.Functor
Error: Unknown class.
The program will exit.
---------------------------
OK
---------------------------
how can i Fixit
---------------------------
demo.ahk
---------------------------
Error at line 42 in #include file "C:\Users\admin\Desktop\Vis2-master\Lib\JSON.ahk".
Line Text: JSON.Functor
Error: Unknown class.
The program will exit.
---------------------------
OK
---------------------------
how can i Fixit
Re: Vis2 - Image to Text OCR()
Hello mate !
Just a litte question,
How can i get x,y and width and Height ?
Do you know a software where i can draw an array and it get back the vallues ?
Thanks,
Just a litte question,
How can i get x,y and width and Height ?
Do you know a software where i can draw an array and it get back the vallues ?
Thanks,
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 87 guests