Ejemplo n.º 1
0
func ExampleBasicUsage() {
	filename := "fixture/golangref.tiff"
	api := setupExampleTesseractAPI()
	pix, _ := lept.PixRead(filename)
	api.BaseAPISetImage(pix)
	text := api.BaseAPIGetUTF8Text()
	fmt.Println(text)
	// output: Function pointer callbacks
	//
	// C code can call exported Go functions with their explicit name. But if a C—program wants a function pointer, a gateway function has to be written.
	// This is because we can't take the address of a Go function and give that to C—code since the cgo tool will generate a stub in C that should be
	// called. The following example shows how to integrate with C code wanting a function pointer of a give type.
	//
	// Place these source files under $GOPATH/src/ccallbacks/. Compile and run with:
}
Ejemplo n.º 2
0
func main() {
	lang := "eng"
	filename := "fixture/golangref.png"
	env := ocr.Env()
	version := ocr.Version()
	fmt.Println("tesseract version: " + version)
	api, err := ocr.BaseAPIInit3(env, lang)
	if err != nil {
		os.Exit(abort)
	}
	pix, err := lept.PixRead(filename)
	if err != nil {
		os.Exit(abort)
	}
	api.BaseAPISetImage(pix)
	text := api.BaseAPIGetUTF8Text()
	fmt.Println(text)
}