Documentation
¶
Index ¶
- Constants
- func ContourStats(c *Contour, offset int)
- func ContourStatsWithCollisions(c *Contour, offset int)
- func LoadImage(filename string, erode int, dilate int) (*common.SuzukiImage, error)
- func SaveContourSliceImage(filename string, c *Contour, width int, height int, flipBook bool, ...) error
- func SaveImage(filename string, si *common.SuzukiImage) error
- type Contour
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 LoadImage ¶
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.
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 *common.SuzukiImage) (*Contour, error)
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.