Documentation ¶
Index ¶
- func Abs(a int) int
- func Color(img image.Image, x, y int) (int, int, int)
- func DecodeXY(p int) (int, int)
- func DetectLine(img *BinaryImage)
- func EncodeXY(x, y int) int
- func HSVToRGB(h, s, v float64) (r, g, b uint8)
- func HoleNumberInBinaryImage(img *BinaryImage) int
- func LineProb(path []int) float64
- func Max(a, b int) int
- func Max3(a, b, c int) int
- func Mean(h []float64) float64
- func MiddleValue(a UInt32Sorter) uint16
- func Min(a, b int) int
- func Neighbor8Encoding(img *BinaryImage, x, y int) int
- func Neighbor8Sum(img *BinaryImage, x, y int) int
- func Neighbor8Values(img *BinaryImage, x, y int) []int
- func NeighborColorDiff(img image.Image, x, y int) int
- func RGBToHSV(r, g, b uint8) (h, s, v float64)
- func Var(h []float64) float64
- func VarH(h []float64) float64
- type AverageSmooth
- type BiColorProcessor
- type BinaryImage
- func Convert2BinaryImage(img image.Image) *BinaryImage
- func CopyBinaryImage(src *BinaryImage) *BinaryImage
- func ExtractAllConnectedComponent(img image.Image, dx, dy int) []*BinaryImage
- func ExtractAllConnectedComponentInBinaryImage(img *BinaryImage, dx, dy int) []*BinaryImage
- func ExtractLines(img *BinaryImage) *BinaryImage
- func NewBinaryImage(width, height int) *BinaryImage
- func RemoveLineWithNPixelOpen(img *BinaryImage, n int) *BinaryImage
- func Rotate(img *BinaryImage, theta float64) *BinaryImage
- func (self *BinaryImage) Close(x, y int)
- func (self *BinaryImage) Encode() string
- func (self *BinaryImage) ExtractFeatures() []float64
- func (self *BinaryImage) FeatureEncode() int
- func (self *BinaryImage) FrontSize() int
- func (self *BinaryImage) Get(x, y int) int
- func (self *BinaryImage) IsOpen(x, y int) bool
- func (self *BinaryImage) Open(x, y int)
- func (self *BinaryImage) Save(name string)
- type BinaryImageMeanSmooth
- type BinaryImageProcessor
- type BoundBinaryImage
- type ColorCount
- type EntropyBasedBiColor
- type Erosion
- type GrayImage
- type ImageProcessor
- type MaxColorBasedBiColor
- type MeanShift
- type PathNode
- type PeakAverageBasedBiColor
- type Point
- type RemoveBinaryImageBorder
- type RemoveIsolatePoints
- type RemoveXAxis
- type ScaleBinaryImage
- type Thining
- type UInt32Sorter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectLine ¶
func DetectLine(img *BinaryImage)
func HoleNumberInBinaryImage ¶
func HoleNumberInBinaryImage(img *BinaryImage) int
func MiddleValue ¶
func MiddleValue(a UInt32Sorter) uint16
func Neighbor8Encoding ¶
func Neighbor8Encoding(img *BinaryImage, x, y int) int
func Neighbor8Sum ¶
func Neighbor8Sum(img *BinaryImage, x, y int) int
func Neighbor8Values ¶
func Neighbor8Values(img *BinaryImage, x, y int) []int
Types ¶
type AverageSmooth ¶
type AverageSmooth struct { }
type BiColorProcessor ¶
type BiColorProcessor interface {
Process(img image.Image) *BinaryImage
}
type BinaryImage ¶
func Convert2BinaryImage ¶
func Convert2BinaryImage(img image.Image) *BinaryImage
func CopyBinaryImage ¶
func CopyBinaryImage(src *BinaryImage) *BinaryImage
func ExtractAllConnectedComponent ¶
func ExtractAllConnectedComponent(img image.Image, dx, dy int) []*BinaryImage
func ExtractAllConnectedComponentInBinaryImage ¶
func ExtractAllConnectedComponentInBinaryImage(img *BinaryImage, dx, dy int) []*BinaryImage
func ExtractLines ¶
func ExtractLines(img *BinaryImage) *BinaryImage
func ExtractLines(img *BinaryImage) *BinaryImage { ends := []int{} for x := 0; x < img.Width; x++ { for y := 0; y < img.Height; y++ { p := EncodeXY(x, y) if Neighbor8OpenCount(img, p) == 1 { ends = append(ends, p) } } } for i, p1 := range ends { for j, p2 := range ends { if j <= i { continue } if HasLine(img, p1, p2) { } } } }
func AddLine(img *BinaryImage, p1, p2) *BinaryImage{ for }
func HasLine(img *BinaryImage, p1, p2 int) bool { x1, y1 := p1 x2, y2 := p2 if Abs(x1-x2) < 10 && Abs(y1-y2) < 10 { return false } if Abs(x1-x2) > Abs(y1, y2) { var xl, xr, yl, yr int if x1 < x2 { xl, xr = x1, x2 yl, yr = y1, y2 } else { xl, xr = x2, x1 yl, yr = y2, y1 } open := 0.0 total := 0.0 for x := xl + 1; x < xr; x++ { y = yl + (x-xl)*(yr-yl)/(xr-xl) if Neighbor8Sum(x, y) > 0 { open += 1.0 } total += 1.0 } if open/total > 0.9 { return true } else { return false } } else { var xb, xt, yb, yt int if y1 < y2 { yb, yt = y1, y2 xb, xt = x1, x2 } else { yb, yt = y2, y1 xt, xb = x2, x1 } open := 0.0 total := 0.0 for y := yb + 1; y < yt; y++ { x = xb + (xt-xb)*(y-yb)/(yt-yb) if Neighbor8Sum(x, y) > 0 { open += 1.0 } total += 1.0 } if open/total > 0.9 { return true } else { return false } } return false }
func NewBinaryImage ¶
func NewBinaryImage(width, height int) *BinaryImage
func RemoveLineWithNPixelOpen ¶
func RemoveLineWithNPixelOpen(img *BinaryImage, n int) *BinaryImage
func Rotate ¶
func Rotate(img *BinaryImage, theta float64) *BinaryImage
func (*BinaryImage) Close ¶
func (self *BinaryImage) Close(x, y int)
func (*BinaryImage) Encode ¶
func (self *BinaryImage) Encode() string
func (*BinaryImage) ExtractFeatures ¶
func (self *BinaryImage) ExtractFeatures() []float64
func (*BinaryImage) FeatureEncode ¶
func (self *BinaryImage) FeatureEncode() int
func (*BinaryImage) FrontSize ¶
func (self *BinaryImage) FrontSize() int
func (*BinaryImage) Get ¶
func (self *BinaryImage) Get(x, y int) int
func (*BinaryImage) IsOpen ¶
func (self *BinaryImage) IsOpen(x, y int) bool
func (*BinaryImage) Open ¶
func (self *BinaryImage) Open(x, y int)
func (*BinaryImage) Save ¶
func (self *BinaryImage) Save(name string)
type BinaryImageMeanSmooth ¶
type BinaryImageMeanSmooth struct {
Threshold int
}
func (*BinaryImageMeanSmooth) Process ¶
func (self *BinaryImageMeanSmooth) Process(img *BinaryImage) *BinaryImage
type BinaryImageProcessor ¶
type BinaryImageProcessor interface {
Process(img *BinaryImage) *BinaryImage
}
type BoundBinaryImage ¶
type BoundBinaryImage struct {
XMinOpen, YMinOpen int
}
func (*BoundBinaryImage) Process ¶
func (self *BoundBinaryImage) Process(img *BinaryImage) *BinaryImage
type ColorCount ¶
type EntropyBasedBiColor ¶
type EntropyBasedBiColor struct { }
func (*EntropyBasedBiColor) Process ¶
func (self *EntropyBasedBiColor) Process(img image.Image) *BinaryImage
type Erosion ¶
type Erosion struct {
Mask []Point
}
func (*Erosion) Process ¶
func (self *Erosion) Process(img *BinaryImage) *BinaryImage
type MaxColorBasedBiColor ¶
type MaxColorBasedBiColor struct { }
func (*MaxColorBasedBiColor) Process ¶
func (self *MaxColorBasedBiColor) Process(img image.Image) *BinaryImage
type PathNode ¶
type PathNode struct {
// contains filtered or unexported fields
}
func BFSPathExtract ¶
func BFSPathExtract(img *BinaryImage, x0, y0 int) []*PathNode
func CopyPathNode ¶
func NewPathNode ¶
func NewPathNode() *PathNode
func (*PathNode) GetLastPoint ¶
type PeakAverageBasedBiColor ¶
type PeakAverageBasedBiColor struct { }
func (*PeakAverageBasedBiColor) Process ¶
func (self *PeakAverageBasedBiColor) Process(img image.Image) *BinaryImage
type RemoveBinaryImageBorder ¶
type RemoveBinaryImageBorder struct { }
func (*RemoveBinaryImageBorder) Process ¶
func (self *RemoveBinaryImageBorder) Process(img *BinaryImage) *BinaryImage
type RemoveIsolatePoints ¶
type RemoveIsolatePoints struct { }
func (*RemoveIsolatePoints) Process ¶
func (self *RemoveIsolatePoints) Process(img *BinaryImage) *BinaryImage
type RemoveXAxis ¶
type RemoveXAxis struct {
K int
}
func (*RemoveXAxis) Process ¶
func (self *RemoveXAxis) Process(img *BinaryImage) *BinaryImage
type ScaleBinaryImage ¶
type ScaleBinaryImage struct {
Height int
}
func (*ScaleBinaryImage) Process ¶
func (self *ScaleBinaryImage) Process(img *BinaryImage) *BinaryImage
type Thining ¶
type Thining struct { }
func (*Thining) Process ¶
func (self *Thining) Process(img *BinaryImage) *BinaryImage
type UInt32Sorter ¶
type UInt32Sorter []uint32
func (UInt32Sorter) Len ¶
func (ms UInt32Sorter) Len() int
func (UInt32Sorter) Less ¶
func (ms UInt32Sorter) Less(i, j int) bool
func (UInt32Sorter) Swap ¶
func (ms UInt32Sorter) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.