update go mod vendor

This commit is contained in:
vcaesar 2019-03-01 07:46:30 -04:00
parent 06196a8934
commit b120479bcb
14 changed files with 277 additions and 40 deletions

11
go.mod
View File

@ -4,14 +4,15 @@ require (
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802
github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e
github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705 // indirect
github.com/go-ole/go-ole v1.2.2 // indirect
github.com/lxn/win v0.0.0-20181015143721-a7f87360b10e
github.com/otiai10/gosseract v2.2.0+incompatible
github.com/robotn/gohook v0.0.0-20190227135941-4e658a44067c
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/lxn/win v0.0.0-20190226192825-50e22abd4ff9
github.com/otiai10/gosseract v2.2.1+incompatible
github.com/robotn/gohook v0.0.0-20190227143424-9bf349ed0b6d
github.com/shirou/gopsutil v2.18.12+incompatible
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
github.com/vcaesar/imgo v0.0.0-20181209162409-13af122cf2fa
golang.org/x/sys v0.0.0-20190109145017-48ac38b7c8cb // indirect
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067 // indirect
golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e // indirect
)
replace (

16
go.sum
View File

@ -4,18 +4,18 @@ github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e h1:4ZrkT/RzpnRO
github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e/go.mod h1:uw9h2sd4WWHOPdJ13MQpwK5qYWKYDumDqxWWIknEQ+k=
github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705 h1:UUppSQnhf4Yc6xGxSkoQpPhb7RVzuv5Nb1mwJ5VId9s=
github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/go-ole/go-ole v1.2.2 h1:HXmymm3IQ8iAfpqlbbUGLHd+SZrnmI4y1pv+WL/3R7c=
github.com/go-ole/go-ole v1.2.2/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/golang/image v0.0.0-20181116024801-cd38e8056d9b h1:560WQdaWjsfqNwVBNZLN3uPrHCoa0OiZkFIvb/x+PwE=
github.com/golang/image v0.0.0-20181116024801-cd38e8056d9b/go.mod h1:W3cvIh6MZCq53QRt4EH8hvU9HPLAPXNxfcoJxCiaTV4=
github.com/golang/sys v0.0.0-20190109145017-48ac38b7c8cb h1:W0jr+BhzUWF6woATVXwDdmDkouJfNJEiITOjtOEIlfI=
github.com/golang/sys v0.0.0-20190109145017-48ac38b7c8cb/go.mod h1:5JyrLPvD/ZdaYkT7IqKhsP5xt7aLjA99KXRtk4EIYDk=
github.com/lxn/win v0.0.0-20181015143721-a7f87360b10e h1:dz4TzIsrPe4XtUyhLkOLdCS8UkVwJKQu4WY8VcIwo3I=
github.com/lxn/win v0.0.0-20181015143721-a7f87360b10e/go.mod h1:jACzEp9RV7NhfPJQkiCNTteU4nkZZVlvkNpYtVOZPfE=
github.com/otiai10/gosseract v2.2.0+incompatible h1:r2Icyba/doznLy0MgsDMWJADETgJNjlX78x/BBbhCUY=
github.com/otiai10/gosseract v2.2.0+incompatible/go.mod h1:XrzWItCzCpFRZ35n3YtVTgq5bLAhFIkascoRo8G32QE=
github.com/robotn/gohook v0.0.0-20190227135941-4e658a44067c h1:lhKBCH1mWQcvD2eVZevWlXYBJ2npFArzFVAFj3p6z58=
github.com/robotn/gohook v0.0.0-20190227135941-4e658a44067c/go.mod h1:YD5RyCnUEY2xqtkkgeQVZ31UAfAnVPwUxpTE5cwSXg4=
github.com/lxn/win v0.0.0-20190226192825-50e22abd4ff9 h1:7noriXA0DUpF8QGGBsuGCRn+LLs7uR0MlDfVccQuvEg=
github.com/lxn/win v0.0.0-20190226192825-50e22abd4ff9/go.mod h1:jACzEp9RV7NhfPJQkiCNTteU4nkZZVlvkNpYtVOZPfE=
github.com/otiai10/gosseract v2.2.1+incompatible h1:Ry5ltVdpdp4LAa2bMjsSJH34XHVOV7XMi41HtzL8X2I=
github.com/otiai10/gosseract v2.2.1+incompatible/go.mod h1:XrzWItCzCpFRZ35n3YtVTgq5bLAhFIkascoRo8G32QE=
github.com/robotn/gohook v0.0.0-20190227143424-9bf349ed0b6d h1:AYuqgHF+CzRt+kNH7MVXu6GL8CEScvlIkmBO7cpaMAo=
github.com/robotn/gohook v0.0.0-20190227143424-9bf349ed0b6d/go.mod h1:YD5RyCnUEY2xqtkkgeQVZ31UAfAnVPwUxpTE5cwSXg4=
github.com/shirou/gopsutil v2.18.12+incompatible h1:1eaJvGomDnH74/5cF4CTmTbLHAriGFsTZppLXDX93OM=
github.com/shirou/gopsutil v2.18.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U=

View File

@ -2,8 +2,7 @@ language: go
sudo: false
go:
- 1.1
- 1.2
- 1.3
- 1.4
- 1.9.x
- 1.10.x
- 1.11.x
- tip

3
vendor/github.com/go-ole/go-ole/go.mod generated vendored Normal file
View File

@ -0,0 +1,3 @@
module github.com/go-ole/go-ole
go 1.12

1
vendor/github.com/lxn/win/AUTHORS generated vendored
View File

@ -20,6 +20,7 @@ Cary Cherng <ccherng@gmail.com>
David Porter <david@porter.me>
gonutz
Hill <zhubicen@gmail.com>
Jason A. Donenfeld <Jason@zx2c4.com>
Joseph Watson <jtwatson@linux-consulting.us>
Kevin Pors <krpors@gmail.com>
ktye <ktye@users.noreply.github.com>

View File

@ -133,6 +133,10 @@ const (
TBM_SETPOS = WM_USER + 5
TBM_SETRANGEMIN = WM_USER + 7
TBM_SETRANGEMAX = WM_USER + 8
TBM_SETPAGESIZE = WM_USER + 21
TBM_GETPAGESIZE = WM_USER + 22
TBM_SETLINESIZE = WM_USER + 23
TBM_GETLINESIZE = WM_USER + 24
)
// TrackBar (Slider) styles

View File

@ -84,14 +84,15 @@ var (
)
type (
ATOM uint16
HANDLE uintptr
HGLOBAL HANDLE
HINSTANCE HANDLE
LCID uint32
LCTYPE uint32
LANGID uint16
HMODULE uintptr
ATOM uint16
HANDLE uintptr
HGLOBAL HANDLE
HINSTANCE HANDLE
LCID uint32
LCTYPE uint32
LANGID uint16
HMODULE uintptr
HWINEVENTHOOK HANDLE
)
type FILETIME struct {

105
vendor/github.com/lxn/win/user32.go generated vendored
View File

@ -7,6 +7,7 @@
package win
import (
"golang.org/x/sys/windows"
"syscall"
"unsafe"
)
@ -875,6 +876,54 @@ const (
WM_CLIPBOARDUPDATE = 0x031D
)
// event constants
const (
EVENT_OBJECT_CREATE = 0x8000
EVENT_OBJECT_DESTROY = 0x8001
EVENT_OBJECT_SHOW = 0x8002
EVENT_OBJECT_HIDE = 0x8003
EVENT_OBJECT_REORDER = 0x8004
EVENT_OBJECT_FOCUS = 0x8005
EVENT_OBJECT_SELECTION = 0x8006
EVENT_OBJECT_SELECTIONADD = 0x8007
EVENT_OBJECT_SELECTIONREMOVE = 0x8008
EVENT_OBJECT_SELECTIONWITHIN = 0x8009
EVENT_OBJECT_STATECHANGE = 0x800A
EVENT_OBJECT_LOCATIONCHANGE = 0x800B
EVENT_OBJECT_NAMECHANGE = 0x800C
EVENT_OBJECT_DESCRIPTIONCHANGE = 0x800D
EVENT_OBJECT_VALUECHANGE = 0x800E
EVENT_OBJECT_PARENTCHANGE = 0x800F
EVENT_OBJECT_HELPCHANGE = 0x8010
EVENT_OBJECT_DEFACTIONCHANGE = 0x8011
EVENT_OBJECT_ACCELERATORCHANGE = 0x8012
EVENT_OBJECT_INVOKED = 0x8013
EVENT_OBJECT_TEXTSELECTIONCHANGED = 0x8014
EVENT_OBJECT_CONTENTSCROLLED = 0x8015
EVENT_SYSTEM_ARRANGMENTPREVIEW = 0x8016
EVENT_OBJECT_CLOAKED = 0x8017
EVENT_OBJECT_UNCLOAKED = 0x8018
EVENT_OBJECT_LIVEREGIONCHANGED = 0x8019
EVENT_OBJECT_HOSTEDOBJECTSINVALIDATED = 0x8020
EVENT_OBJECT_DRAGSTART = 0x8021
EVENT_OBJECT_DRAGCANCEL = 0x8022
EVENT_OBJECT_DRAGCOMPLETE = 0x8023
EVENT_OBJECT_DRAGENTER = 0x8024
EVENT_OBJECT_DRAGLEAVE = 0x8025
EVENT_OBJECT_DRAGDROPPED = 0x8026
EVENT_OBJECT_IME_SHOW = 0x8027
EVENT_OBJECT_IME_HIDE = 0x8028
EVENT_OBJECT_IME_CHANGE = 0x8029
EVENT_OBJECT_END = 0x80ff
EVENT_AIA_START = 0xa000
EVENT_AIA_END = 0xafff
WINEVENT_OUTOFCONTEXT = 0x0000
WINEVENT_SKIPOWNTHREAD = 0x0001
WINEVENT_SKIPOWNPROCESS = 0x0002
WINEVENT_INCONTEXT = 0x0004
)
// mouse button constants
const (
MK_CONTROL = 0x0008
@ -1552,6 +1601,7 @@ var (
beginDeferWindowPos uintptr
beginPaint uintptr
callWindowProc uintptr
checkMenuRadioItem uintptr
clientToScreen uintptr
closeClipboard uintptr
createDialogParam uintptr
@ -1580,6 +1630,7 @@ var (
getActiveWindow uintptr
getAncestor uintptr
getCaretPos uintptr
getClassName uintptr
getClientRect uintptr
getClipboardData uintptr
getCursorPos uintptr
@ -1648,6 +1699,7 @@ var (
setRect uintptr
setScrollInfo uintptr
setTimer uintptr
setWinEventHook uintptr
setWindowLong uintptr
setWindowLongPtr uintptr
setWindowPlacement uintptr
@ -1656,6 +1708,7 @@ var (
systemParametersInfo uintptr
trackPopupMenuEx uintptr
translateMessage uintptr
unhookWinEvent uintptr
updateWindow uintptr
windowFromDC uintptr
windowFromPoint uintptr
@ -1674,6 +1727,7 @@ func init() {
beginDeferWindowPos = MustGetProcAddress(libuser32, "BeginDeferWindowPos")
beginPaint = MustGetProcAddress(libuser32, "BeginPaint")
callWindowProc = MustGetProcAddress(libuser32, "CallWindowProcW")
checkMenuRadioItem = MustGetProcAddress(libuser32, "CheckMenuRadioItem")
clientToScreen = MustGetProcAddress(libuser32, "ClientToScreen")
closeClipboard = MustGetProcAddress(libuser32, "CloseClipboard")
createDialogParam = MustGetProcAddress(libuser32, "CreateDialogParamW")
@ -1702,6 +1756,7 @@ func init() {
getActiveWindow = MustGetProcAddress(libuser32, "GetActiveWindow")
getAncestor = MustGetProcAddress(libuser32, "GetAncestor")
getCaretPos = MustGetProcAddress(libuser32, "GetCaretPos")
getClassName = MustGetProcAddress(libuser32, "GetClassNameW")
getClientRect = MustGetProcAddress(libuser32, "GetClientRect")
getClipboardData = MustGetProcAddress(libuser32, "GetClipboardData")
getCursorPos = MustGetProcAddress(libuser32, "GetCursorPos")
@ -1775,6 +1830,7 @@ func init() {
setParent = MustGetProcAddress(libuser32, "SetParent")
setScrollInfo = MustGetProcAddress(libuser32, "SetScrollInfo")
setTimer = MustGetProcAddress(libuser32, "SetTimer")
setWinEventHook = MustGetProcAddress(libuser32, "SetWinEventHook")
setWindowLong = MustGetProcAddress(libuser32, "SetWindowLongW")
// On 32 bit SetWindowLongPtrW is not available
if is64bit {
@ -1788,6 +1844,7 @@ func init() {
systemParametersInfo = MustGetProcAddress(libuser32, "SystemParametersInfoW")
trackPopupMenuEx = MustGetProcAddress(libuser32, "TrackPopupMenuEx")
translateMessage = MustGetProcAddress(libuser32, "TranslateMessage")
unhookWinEvent = MustGetProcAddress(libuser32, "UnhookWinEvent")
updateWindow = MustGetProcAddress(libuser32, "UpdateWindow")
windowFromDC = MustGetProcAddress(libuser32, "WindowFromDC")
windowFromPoint = MustGetProcAddress(libuser32, "WindowFromPoint")
@ -1854,6 +1911,18 @@ func CallWindowProc(lpPrevWndFunc uintptr, hWnd HWND, Msg uint32, wParam, lParam
return ret
}
func CheckMenuRadioItem(hmenu HMENU, first, last, check, flags uint32) bool {
ret, _, _ := syscall.Syscall6(checkMenuRadioItem, 5,
uintptr(hmenu),
uintptr(first),
uintptr(last),
uintptr(check),
uintptr(flags),
0)
return ret != 0
}
func ClientToScreen(hwnd HWND, lpPoint *POINT) bool {
ret, _, _ := syscall.Syscall(clientToScreen, 2,
uintptr(hwnd),
@ -2140,6 +2209,17 @@ func GetCaretPos(lpPoint *POINT) bool {
return ret != 0
}
func GetClassName(hWnd HWND, className *uint16, maxCount int) (int, error) {
ret, _, e := syscall.Syscall(getClassName, 3,
uintptr(hWnd),
uintptr(unsafe.Pointer(className)),
uintptr(maxCount))
if ret == 0 {
return 0, e
}
return int(ret), nil
}
func GetClientRect(hWnd HWND, rect *RECT) bool {
ret, _, _ := syscall.Syscall(getClientRect, 2,
uintptr(hWnd),
@ -2810,6 +2890,26 @@ func SetTimer(hWnd HWND, nIDEvent uintptr, uElapse uint32, lpTimerFunc uintptr)
return ret
}
type WINEVENTPROC func(hWinEventHook HWINEVENTHOOK, event uint32, hwnd HWND, idObject int32, idChild int32, idEventThread uint32, dwmsEventTime uint32) uintptr
func SetWinEventHook(eventMin uint32, eventMax uint32, hmodWinEventProc HMODULE, callbackFunction WINEVENTPROC, idProcess uint32, idThread uint32, dwFlags uint32) (HWINEVENTHOOK, error) {
ret, _, err := syscall.Syscall9(setWinEventHook, 7,
uintptr(eventMin),
uintptr(eventMax),
uintptr(hmodWinEventProc),
windows.NewCallback(callbackFunction),
uintptr(idProcess),
uintptr(idThread),
uintptr(dwFlags),
0, 0)
if ret == 0 {
return 0, err
}
return HWINEVENTHOOK(ret), nil
}
func SetWindowLong(hWnd HWND, index, value int32) int32 {
ret, _, _ := syscall.Syscall(setWindowLong, 3,
uintptr(hWnd),
@ -2894,6 +2994,11 @@ func TranslateMessage(msg *MSG) bool {
return ret != 0
}
func UnhookWinEvent(hWinHookEvent HWINEVENTHOOK) bool {
ret, _, _ := syscall.Syscall(unhookWinEvent, 1, uintptr(hWinHookEvent), 0, 0)
return ret != 0
}
func UpdateWindow(hwnd HWND) bool {
ret, _, _ := syscall.Syscall(updateWindow, 1,
uintptr(hwnd),

View File

@ -12,6 +12,7 @@ package gosseract
import "C"
import (
"fmt"
"image"
"os"
"strings"
"unsafe"
@ -146,6 +147,10 @@ func (client *Client) SetLanguage(langs ...string) error {
return nil
}
func (client *Client) DisableOutput() error {
return client.SetVariable(DEBUG_FILE, os.DevNull)
}
// SetWhitelist sets whitelist chars.
// See official documentation for whitelist here https://github.com/tesseract-ocr/tesseract/wiki/ImproveQuality#dictionaries-word-lists-and-patterns
func (client *Client) SetWhitelist(whitelist string) error {
@ -204,10 +209,12 @@ func (client *Client) init() error {
}
defer C.free(unsafe.Pointer(configfile))
res := C.Init(client.api, nil, languages, configfile)
errbuf := [512]C.char{}
res := C.Init(client.api, nil, languages, configfile, &errbuf[0])
msg := C.GoString(&errbuf[0])
if res != 0 {
// TODO: capture and vacuum stderr from Cgo
return fmt.Errorf("failed to initialize TessBaseAPI with code %d", res)
return fmt.Errorf("failed to initialize TessBaseAPI with code %d: %s", res, msg)
}
if err := client.setVariablesToInitializedAPI(); err != nil {
@ -260,3 +267,36 @@ func (client *Client) HOCRText() (out string, err error) {
out = C.GoString(C.HOCRText(client.api))
return
}
// BoundingBox contains the position, confidence and UTF8 text of the recognized word
type BoundingBox struct {
Box image.Rectangle
Word string
Confidence float64
}
// GetBoundingBoxes returns bounding boxes for each matched word
func (client *Client) GetBoundingBoxes(level PageIteratorLevel) (out []BoundingBox, err error) {
if client.api == nil {
return out, fmt.Errorf("TessBaseAPI is not constructed, please use `gosseract.NewClient`")
}
if err = client.init(); err != nil {
return
}
boxArray := C.GetBoundingBoxes(client.api, C.int(level))
length := int(boxArray.length)
defer C.free(unsafe.Pointer(boxArray.boxes))
defer C.free(unsafe.Pointer(boxArray))
for i := 0; i < length; i++ {
// cast to bounding_box: boxes + i*sizeof(box)
box := (*C.struct_bounding_box)(unsafe.Pointer(uintptr(unsafe.Pointer(boxArray.boxes)) + uintptr(i)*unsafe.Sizeof(C.struct_bounding_box{})))
out = append(out, BoundingBox{
Box: image.Rect(int(box.x1), int(box.y1), int(box.x2), int(box.y2)),
Word: C.GoString(box.word),
Confidence: float64(box.confidence),
})
}
return
}

View File

@ -39,6 +39,24 @@ const (
PSM_COUNT
)
// PageIteratorLevel maps directly to tesseracts enum tesseract::PageIteratorLevel
// represents the hierarchy of the page elements used in ResultIterator.
// https://github.com/tesseract-ocr/tesseract/blob/a18620cfea33d03032b71fe1b9fc424777e34252/ccstruct/publictypes.h#L219-L225
type PageIteratorLevel int
const (
// RIL_BLOCK - Block of text/image/separator line.
RIL_BLOCK PageIteratorLevel = iota
// RIL_PARA - Paragraph within a block.
RIL_PARA
// RIL_TEXTLINE - Line within a paragraph.
RIL_TEXTLINE
// RIL_WORD - Word within a textline.
RIL_WORD
// RIL_SYMBOL - Symbol/character within a word.
RIL_SYMBOL
)
// SettableVariable represents available strings for TessBaseAPI::SetVariable.
// See https://groups.google.com/forum/#!topic/tesseract-ocr/eHTBzrBiwvQ
// and https://github.com/tesseract-ocr/tesseract/blob/master/ccmain/tesseractclass.h
@ -47,6 +65,8 @@ type SettableVariable string
// Followings are variables which can be used for TessBaseAPI::SetVariable.
// If anything missing (I know there are many), please add one below.
const (
// DEBUG_FILE - File to send output to.
DEBUG_FILE SettableVariable = "debug_file"
// TESSEDIT_CHAR_WHITELIST - Whitelist of chars to recognize
// There is a known issue in 4.00 with LSTM
// https://github.com/tesseract-ocr/tesseract/issues/751

View File

@ -7,6 +7,8 @@
#endif
#include "tessbridge.h"
#include <stdio.h>
#include <unistd.h>
TessBaseAPI Create() {
tesseract::TessBaseAPI * api = new tesseract::TessBaseAPI();
@ -34,15 +36,33 @@ int Init(TessBaseAPI a, char* tessdataprefix, char* languages) {
return api->Init(tessdataprefix, languages);
}
int Init(TessBaseAPI a, char* tessdataprefix, char* languages, char* configfilepath) {
int Init(TessBaseAPI a, char* tessdataprefix, char* languages, char* configfilepath, char* errbuf) {
tesseract::TessBaseAPI * api = (tesseract::TessBaseAPI*)a;
// {{{ Redirect STDERR to given buffer
fflush(stderr);
int original_stderr;
original_stderr = dup(STDERR_FILENO);
freopen("/dev/null", "a", stderr);
setbuf(stderr, errbuf);
// }}}
int ret;
if (configfilepath != NULL) {
char *configs[]={configfilepath};
int configs_size = 1;
return api->Init(tessdataprefix, languages, tesseract::OEM_DEFAULT, configs, configs_size, NULL, NULL, false);
ret = api->Init(tessdataprefix, languages, tesseract::OEM_DEFAULT, configs, configs_size, NULL, NULL, false);
} else {
return api->Init(tessdataprefix, languages);
ret = api->Init(tessdataprefix, languages);
}
// {{{ Restore default stderr
freopen("/dev/null", "a", stderr);
dup2(original_stderr, STDERR_FILENO);
setbuf(stderr, NULL);
// }}}
return ret;
}
bool SetVariable(TessBaseAPI a, char* name, char* value) {
@ -80,6 +100,37 @@ char* HOCRText(TessBaseAPI a) {
return api->GetHOCRText(0);
}
bounding_boxes* GetBoundingBoxes(TessBaseAPI a, int pageIteratorLevel) {
tesseract::TessBaseAPI * api = (tesseract::TessBaseAPI*)a;
struct bounding_boxes* box_array;
box_array = (bounding_boxes*)malloc(sizeof(bounding_boxes));
// linearly resize boxes array
int realloc_threshold = 900;
int realloc_raise = 1000;
int capacity = 1000;
box_array->boxes = (bounding_box*)malloc(capacity * sizeof(bounding_box));
box_array->length = 0;
api->Recognize(NULL);
tesseract::ResultIterator* ri = api->GetIterator();
tesseract::PageIteratorLevel level = (tesseract::PageIteratorLevel)pageIteratorLevel;
if (ri != 0) {
do {
if ( box_array->length >= realloc_threshold ) {
capacity += realloc_raise;
box_array->boxes = (bounding_box*)realloc(box_array->boxes, capacity * sizeof(bounding_box));
realloc_threshold += realloc_raise;
}
box_array->boxes[box_array->length].word = ri->GetUTF8Text(level);
box_array->boxes[box_array->length].confidence = ri->Confidence(level);
ri->BoundingBox(level, &box_array->boxes[box_array->length].x1, &box_array->boxes[box_array->length].y1, &box_array->boxes[box_array->length].x2, &box_array->boxes[box_array->length].y2);
box_array->length++;
} while (ri->Next(level));
}
return box_array;
}
const char* Version(TessBaseAPI a) {
tesseract::TessBaseAPI * api = (tesseract::TessBaseAPI*)a;
const char* v = api->Version();

View File

@ -5,12 +5,24 @@ extern "C" {
typedef void* TessBaseAPI;
typedef void* PixImage;
struct bounding_box {
int x1,y1,x2,y2;
char* word;
float confidence;
};
struct bounding_boxes {
int length;
struct bounding_box* boxes;
};
TessBaseAPI Create(void);
void Free(TessBaseAPI);
void Clear(TessBaseAPI);
void ClearPersistentCache(TessBaseAPI);
int Init(TessBaseAPI, char*, char*, char*);
int Init(TessBaseAPI, char*, char*, char*, char*);
struct bounding_boxes* GetBoundingBoxes(TessBaseAPI, int);
bool SetVariable(TessBaseAPI, char*, char*);
void SetPixImage(TessBaseAPI a, PixImage pix);
void SetPageSegMode(TessBaseAPI, int);

View File

@ -34,7 +34,7 @@ environment:
PATH: C:\msys64\mingw32\bin\;C:\Program Files (x86)\NSIS\;%PATH%
# - COMPILER: MINGW_W64
# ARCHITECTURE: x64
GOVERSION: 1.11.5
GOVERSION: 1.12
# GOPATH: c:\gopath
# scripts that run after cloning repository

14
vendor/modules.txt vendored
View File

@ -10,14 +10,14 @@ github.com/BurntSushi/xgbutil/xevent
github.com/BurntSushi/xgbutil/xprop
# github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705
github.com/StackExchange/wmi
# github.com/go-ole/go-ole v1.2.2
# github.com/go-ole/go-ole v1.2.4
github.com/go-ole/go-ole
github.com/go-ole/go-ole/oleutil
# github.com/lxn/win v0.0.0-20181015143721-a7f87360b10e
# github.com/lxn/win v0.0.0-20190226192825-50e22abd4ff9
github.com/lxn/win
# github.com/otiai10/gosseract v2.2.0+incompatible
# github.com/otiai10/gosseract v2.2.1+incompatible
github.com/otiai10/gosseract
# github.com/robotn/gohook v0.0.0-20190227135941-4e658a44067c
# github.com/robotn/gohook v0.0.0-20190227143424-9bf349ed0b6d
github.com/robotn/gohook
# github.com/shirou/gopsutil v2.18.12+incompatible
github.com/shirou/gopsutil/process
@ -30,8 +30,8 @@ github.com/shirou/gopsutil/net
github.com/shirou/w32
# github.com/vcaesar/imgo v0.0.0-20181209162409-13af122cf2fa
github.com/vcaesar/imgo
# golang.org/x/image v0.0.0-20181116024801-cd38e8056d9b => github.com/golang/image v0.0.0-20181116024801-cd38e8056d9b
# golang.org/x/image v0.0.0-20190227222117-0694c2d4d067 => github.com/golang/image v0.0.0-20181116024801-cd38e8056d9b
golang.org/x/image/bmp
# golang.org/x/sys v0.0.0-20190109145017-48ac38b7c8cb => github.com/golang/sys v0.0.0-20190109145017-48ac38b7c8cb
golang.org/x/sys/unix
# golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e => github.com/golang/sys v0.0.0-20190109145017-48ac38b7c8cb
golang.org/x/sys/windows
golang.org/x/sys/unix