Documentation ¶
Index ¶
- Constants
- Variables
- func GTFromFile(p string, stat bool) (string, bool)
- func ImageFromFile(stripped string) (string, bool)
- func LLocsFromFile(p string, stat bool) (string, bool)
- func OpenImgFile(path string) (image.Image, error)
- func OpenTxtFile(path string) (string, error)
- func ReadImgFile(in io.Reader) (image.Image, error)
- func ReadTxtFile(in io.Reader) (string, error)
- func Strip(p string) string
- func TxtFromFile(p string, stat bool) (string, bool)
- func Walk(dir, ext string, recursive bool, f WalkFunc) error
- type Cmd
- type LLoc
- type LLocs
- type WalkFunc
Constants ¶
const ( GTExt = ".gt.txt" TxtExt = ".txt" LLocsExt = ".llocs" BinPngExt = ".bin.png" DewPngExt = ".dew.png" PngExt = ".png" NrmPngExt = ".nrm.png" /* GT4HistOCR */ )
File extensions for gt, img, txt and llocs files.
Variables ¶
ImageExtensions defines the different possible extensions for line image files. The order of the extensions defines which files are used for image files. Change this if you need other image file priorities.
Functions ¶
func GTFromFile ¶ added in v0.9.4
GTFromFile returns the according gt file for the given stripped or unstripped path and whether it exists. If stat is set to false, just the according gt path and false are returend; it is not checked in this case if the resulting file path exists. In any case the according gt file path is returned.
func ImageFromFile ¶ added in v0.9.4
ImageFromFile returns the according line image file for the given stripped or unstripped path and whether it exists. In order to identify the right extension, the file path is checked with stat. If no existing image file path can be found this function returns "", false.
func LLocsFromFile ¶ added in v0.9.4
LLocsFromFile returns the according llocs file for the given stripped path and whether it exists. If stat is set to false, just the according gt path and false are returend; it is not checked in this case if the resulting file path exists. In any case the according llocs file path is returned.
func OpenImgFile ¶
OpenImgFile reads the image's data from a png encoded file.
func OpenTxtFile ¶
OpenTxtFile opens a txt or gt file and reads it content line.
func ReadImgFile ¶
ReadImgFile reads the image's data from a png encoded file.
func ReadTxtFile ¶
ReadTxtFile read the content line from a txt or gt file.
func Strip ¶
Strip returns the bare file path for a given path with all extensions stripped. If the path's file name starts with a leading dot, the whole file name will be removed.
func TxtFromFile ¶ added in v0.9.4
TxtFromFile returns the according txt file for the given stripped or unstripped path and whether it exists. If stat is set to false, just the according gt path and false are returend; it is not checked in this case if the resulting file path exists. In any case the according txt file path is returned.
Types ¶
type Cmd ¶ added in v0.9.1
Cmd wraps information to run gocropus commands.
type LLocs ¶
type LLocs []LLoc
LLocs represents character information for one recognized line.
func OpenLLocsFile ¶
OpenLLocsFile opens a llocs file and returns its contents.
func ReadLLocsFile ¶
ReadLLocsFile read the contents from a llocs file.
type WalkFunc ¶
WalkFunc defines the type for the callback function used in Walk. It is called with the paths of the existing Ocropy file image set. The first path is the gt, the second path is the img, the third path is the txt and the fourth path is the llocs file path. If any file path does not exist the according value is set to the empty string "".