vision

package
v0.0.0-...-b509ac4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSpots = errors.New("no spots found in image")

ErrNoSpots is returned when there are no spots in the image.

Functions

This section is empty.

Types

type BigSpot

type BigSpot struct {
	Filled *image.Paletted
	Center image.Point
	Area   int
}

BigSpot is a monochromic spot with the largest area in the image.

func FindBiggestSpot

func FindBiggestSpot(img image.Image, matchingColor color.Color) (BigSpot, error)

FindBiggestSpot finds the spot with the largest area in the image.

The color parameter is the color of the spot. Colors are compared exactly, so the color of the spot must match exactly the color parameter.

type BoundaryImage

type BoundaryImage struct {
	// contains filtered or unexported fields
}

BoundaryImage is an image that marks some boundary by filling the boundary with a color and leaving the rest of the image in a different color.

func NewBoundaryImage

func NewBoundaryImage(img image.Image, bc color.Color) *BoundaryImage

NewBoundaryImage creates a new BoundaryImage from the given image and boundary color.

func (*BoundaryImage) BoundaryBox

func (bi *BoundaryImage) BoundaryBox() image.Rectangle

BoundaryBox returns the bounding box of the boundary. The bounding box is the smallest rectangle that contains the boundary.

func (*BoundaryImage) Count

func (bi *BoundaryImage) Count() int

Count returns the number of points in the boundary.

func (*BoundaryImage) EachPt

func (bi *BoundaryImage) EachPt(f func(pt image.Point) (stop bool))

EachPt calls f for each point in the boundary. If f returns true, EachPt stops and returns.

func (*BoundaryImage) PtAt

func (bi *BoundaryImage) PtAt(i int) (image.Point, bool)

func (*BoundaryImage) PtIn

func (bi *BoundaryImage) PtIn(pt image.Point) bool

PtIn returns true if the given point is in the boundary.

type SpotFinder

type SpotFinder struct {
	// contains filtered or unexported fields
}

SpotFinder finds spots in an image.

func NewSpotFinder

func NewSpotFinder(src image.Image) *SpotFinder

NewSpotFinder creates a new SpotFinder for the given image.

func (*SpotFinder) FindBiggestSpot

func (b *SpotFinder) FindBiggestSpot(matchingColor color.Color) (BigSpot, error)

FindBiggestSpot finds the spot with the largest area.

The color parameter is the color of the spot. Colors are compared exactly, so the color of the spot must match exactly the color parameter.

func (*SpotFinder) Reset

func (b *SpotFinder) Reset(src image.Image)

Reset resets the SpotFinder for the given image. This is useful if you want to reuse the SpotFinder for multiple images of the same size.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL