Documentation ¶
Overview ¶
preproc contains various image processing methods which are useful for preprocessing page images for OCR. It contains both library functions to incorporate into your own projects and standalone tools which can be used directly.
Index ¶
- func BinToZeroInv(bin *image.Gray, orig *image.RGBA) (*image.RGBA, error)
- func IntegralSauvola(img *image.Gray, ksize float64, windowsize int) *image.Gray
- func PreCalcedSauvola(integrals integralimg.WithSq, img *image.Gray, ksize float64, windowsize int) *image.Gray
- func PreProcMulti(inPath string, ksizes []float64, binType string, binWsize int, wipe bool, ...) ([]string, error)
- func Sauvola(img *image.Gray, ksize float64, windowsize int) *image.Gray
- func VWipe(img *image.Gray, wsize int, thresh float64, min int) *image.Gray
- func Wipe(img *image.Gray, wsize int, thresh float64, min int) *image.Gray
- func WipeFile(inPath string, outPath string, hwsize int, hthresh float64, hmin int, ...) error
- type UsefulImg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinToZeroInv ¶
BinToZeroInv converts a binary thresholded image to a zero inverse binary thresholded image
func IntegralSauvola ¶
Implements Sauvola's algorithm using Integral Images, see paper "Efficient Implementation of Local Adaptive Thresholding Techniques Using Integral Images" and https://stackoverflow.com/questions/13110733/computing-image-integral
func PreCalcedSauvola ¶
func PreCalcedSauvola(integrals integralimg.WithSq, img *image.Gray, ksize float64, windowsize int) *image.Gray
PreCalcedSauvola Implements Sauvola's algorithm using precalculated Integral Images
func PreProcMulti ¶
func PreProcMulti(inPath string, ksizes []float64, binType string, binWsize int, wipe bool, wipeWsize int, wipeMinWidthPerc int) ([]string, error)
PreProcMulti binarizes and preprocesses an image with multiple binarisation levels. inPath: Path of input image. ksizes: Slice of k values to pass to Sauvola algorithm binType: Type of binarization threshold. binary or zeroinv are currently implemented. binWsize: Window size for sauvola binarization algorithm. Set automatically based on resolution if 0. wipe: Whether to wipe (clear sides) the image wipeWsize: Window size for wiping algorithm wipeMinWidthPerc: Minimum percentage of the image width for the content width calculation to be considered valid
func Sauvola ¶
Implements Sauvola's algorithm for text binarization, see paper "Adaptive document image binarization" (2000)
func VWipe ¶ added in v0.1.1
VWipe fills the sections of image which fall outside the vertical content area with white, providing the content area is above min %
func Wipe ¶
Wipe fills the sections of image which fall outside the content area with white, providing the content area is above min %
func WipeFile ¶
func WipeFile(inPath string, outPath string, hwsize int, hthresh float64, hmin int, vwsize int, vthresh float64, vmin int) error
WipeFile wipes an image file, filling the sections of the image which fall outside the content area with white, providing the content area is above min %. inPath: path of the input image. outPath: path to save the output image. hwsize: window size for horizontal wipe algorithm. hthresh: threshold for horizontal wipe algorithm. hmin: minimum % of content area width to consider valid. vwsize: window size for vertical wipe algorithm. vthresh: threshold for vertical wipe algorithm. vmin: minimum % of content area height to consider valid.
Types ¶
type UsefulImg ¶
type UsefulImg interface { // TODO: name better; maybe verb, x-er // TODO: implement these for regular image, and use them to make // image functions generic for integral and non- images MeanWindow() MeanStdDevWindow() }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
binarize
binarize does fast Integral Image sauvola binarisation on an image
|
binarize does fast Integral Image sauvola binarisation on an image |
preproc
preproc runs binarisation and wipe preprocessing on an image
|
preproc runs binarisation and wipe preprocessing on an image |
preprocmulti
preprocmulti runs binarisation with a variety of different binarisation levels, preprocessing and saving each version
|
preprocmulti runs binarisation with a variety of different binarisation levels, preprocessing and saving each version |
splittable
splittable is an experimental program to split a table into individual cells suitable for OCR
|
splittable is an experimental program to split a table into individual cells suitable for OCR |
wipe
wipe wipes sections of an image which are outside of an automatically determined content area
|
wipe wipes sections of an image which are outside of an automatically determined content area |