Documentation
¶
Index ¶
- Constants
- func NewWhiteLinesParams() *docangle.WhiteLinesParams
- func Perplexity(img *cimg.Image) float32
- func SplitImage(img *cimg.Image, numTiles, size int) []*cimg.Image
- type Orient
- func (o *Orient) Close()
- func (o *Orient) GetImageOrientation(img *cimg.Image) (int, error)
- func (o *Orient) MakeUpright(img *cimg.Image) (*cimg.Image, error)
- func (o *Orient) Straighten(img *cimg.Image, params *docangle.WhiteLinesParams) *cimg.Image
- func (o *Orient) StraightenAndMakeUpright(img *cimg.Image, params *docangle.WhiteLinesParams) (*cimg.Image, error)
Constants ¶
const ( Angle0 = 0 Angle90 = 1 Angle180 = 2 Angle270 = 3 )
const TileSize = 32
Variables ¶
This section is empty.
Functions ¶
func NewWhiteLinesParams ¶
func NewWhiteLinesParams() *docangle.WhiteLinesParams
Create a new WhiteLinesParams with defaults
func Perplexity ¶
Return a measure of how "interesting" the image is. When selecting tiles for training or inference, we choose the tiles with the highest perplexity. This allows us to ignore blank tiles, or tiles with very little visual information.
Types ¶
type Orient ¶
type Orient struct {
// contains filtered or unexported fields
}
An Orientation neural network
func NewOrient ¶
NewOrient creates a new Orient struct and loads the neural network. The network must be closed after use, or you will leak C++ memory.
func (*Orient) GetImageOrientation ¶
Run on a whole image, and return one of 4 angles (Angle0, Angle90, Angle180, Angle270)
func (*Orient) MakeUpright ¶ added in v1.0.1
MakeUpright runs the neural network to determine if the page is upright. If necessary, rotate the page by -90, 90, or 180 degrees and return the upright image. If the page is already upright, return 'img'
func (*Orient) Straighten ¶ added in v1.0.1
Use github.com/bmharper/docangle to compute the angle of the page, and rotate the image to negate that angle. If the angle is 0, return 'img'
func (*Orient) StraightenAndMakeUpright ¶ added in v1.0.1
func (o *Orient) StraightenAndMakeUpright(img *cimg.Image, params *docangle.WhiteLinesParams) (*cimg.Image, error)
Combine Straighten and MakeUpright