Documentation ¶
Index ¶
Constants ¶
const ( Outer = 0 Hole = 1 )
Variables ¶
This section is empty.
Functions ¶
func ContourStats ¶
ContourStats generates writes to stdout stats about the contour and all children. Primarily used for debugging
func ContourStatsWithCollisions ¶
ContourStatsWithCollisions generates writes to stdout stats about the contour and all children that have collisions Primarily used for debugging.
func SaveContourSliceImage ¶
func SaveContourSliceImage(filename string, c *Contour, width int, height int, flipBook bool, minContourSize int) error
SaveContourSliceImage saves a contour (and all child contours) as a PNG.
func SaveImage ¶
func SaveImage(filename string, si *SuzukiImage) error
SaveImage saves a SuzukiImage to filename
Types ¶
type Contour ¶
type Contour struct { // Points making up the contour Points []image.Point Id int // Outer or Hole. BorderType int // Id of parent ParentId int // ParentCollision indicates if colliding with parent. Just an optimisation for quick removal later on. ParentCollision bool // Parent links to contours parent Parent *Contour // Children links to contours children Children []*Contour // ConflictingContours is a map of contours that we KNOW we conflict with. This may be the parent or other // siblings ConflictingContours map[int]bool // hate to use maps here... but want uniqueness // usable or not. Not filtering out but marking that we may not use it. (say if we're conflicting with another contour) Usable bool }
Contour represents a single contour/border extracted from an image. It also tracks its parents and children.
func FindContours ¶
func FindContours(img *SuzukiImage) *Contour
FindContours takes a SuzukiImage (basic 2d slice) and determines the Contours that are present. It returns the single parent contour which in turn has all other contours as children or further generations.
type SuzukiImage ¶
SuzukiImage is the basic structure we use to define an image. Will probably replace with something more optimal if required
func LoadImage ¶
func LoadImage(filename string, erode bool) (*SuzukiImage, error)
LoadImage loads a PNG and returns a SuzukiImage. This may change since SuzukiImage may not really be required. erode flag forces the eroding of the image before converting to a SuzukiImage. This is to remove any "spikes" that may appear in the generated boundary.
func NewSuzukiImage ¶
func NewSuzukiImage(width int, height int) *SuzukiImage
NewSuzukiImage creates a new SuzukiImage of specific dimentions.
func (*SuzukiImage) DisplayAsText ¶
func (si *SuzukiImage) DisplayAsText() []string
DisplayAsText generates a string of a given image. This is purely used for debugging SMALL images
func (*SuzukiImage) Get ¶
func (si *SuzukiImage) Get(p image.Point) int
Get returns the value of a given point
func (*SuzukiImage) GetXY ¶
func (si *SuzukiImage) GetXY(x int, y int) int
GetXY returns the value of a given x/y