If you want to take a shot at it yourself, get
gocr.exe, and (optional: to get the captured text directly, instead of reading an output file) get
cmdret.dll and cmdstub.exe (gocr.exe is a 16-bit application that needs the cmdstub.exe)
gocr accepts only grey-scale pictures of a specific format (pnm/pgm/pbm/ppm/pcx), I don't know if there is GDI code to save or get that type of picture data, but you should take a look at the GDI scripts anyway, for taking a screenshot of a specific portion of the screen (I think I used Irfanview and
djpeg.exe? I don't remember)
Flow: screenshot of (a portion of) the screen > save as/convert to grey-scale pnm file > feed pnm file gocr > get gocr's output
The (simplest) command line/AHK for gocr:
Code:
RunWait, %comspec% /c gocr -i screenshot.pnm -o output.txt, %A_ScriptDir%
gocr options:
Quote:
Optical Character Recognition --- gocr 0.40
using: gocr [options] pnm_file_name # use - for stdin
options:
-h - get this help
-i name - input image file (pnm,pgm,pbm,ppm,pcx,...)
-i - - read PNM from stdin (djpeg -gray a.jpg | gocr -)
-o name - output file (redirection of stdout)
-e name - logging file (redirection of stderr)
-x name - progress output (file or fifo)
-p name - database path (including final slash, default is ./db/)
-f fmt - output format (ISO8859_1 TeX HTML XML UTF8 ASCII)
-l num - threshold grey level 0<160<=255 (0 = autodetect)
-d num - dust_size (remove smaller clusters, -1 = autodetect)
-s num - spacewidth/dots (0 = autodetect)
-v num - verbose [summed]
1 print more info
2 list shapes of boxes (see -c)
4 list pattern of boxes (see -c)
8 print pattern after recognition
16 print line infos
32 debug outXX.pgm
-c string - list of chars (_ = not recognized chars, debug)
-C string - char filter (ex. hexdigits: 0-9A-Fx, only ASCII)
-m num - operation modes, ~ = switch off
2 use database (early development)
4 layout analysis, zoning (development)
8 ~ compare non recognized chars
16 ~ divide overlapping chars
32 ~ context correction
64 char packing (development)
130 extend database, prompts user (128+2, early development)
256 switch off the OCR engine (makes sense together with -m 2)
-n 1 only numbers
examples:
gocr -v 33 text1.pbm # some infos + out30.bmp
gocr -v 7 -c _YV text1.pbm # list unknown, Y and V chars
djpeg -pnm -gray text.jpg | gocr - # use jpeg-file via pipe
HTH
(rehash from
Optical Character Recognition (OCR) - gocr [CLI] and the other postings on this topic)