Documentation ¶
Index ¶
- type Matcher
- func (m *Matcher) FailedSampleArea() image.Rectangle
- func (m *Matcher) Match(expected, actual image.Image) bool
- func (m *Matcher) MaxDifferentPixelsPerAreaOutOfRange() bool
- func (m *Matcher) NumDifferentPixels() int
- func (m *Matcher) SampleAreaChannelDeltaThresholdOutOfRange() bool
- func (m *Matcher) SampleAreaWidthTooLarge() bool
- func (m *Matcher) SampleAreaWidthTooSmall() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Matcher ¶
type Matcher struct { // SampleAreaWidth allows values 1+, although 1 is the same as exact matching. SampleAreaWidth int // MaxDifferentPixelsPerArea allows values 0-SampleAreaWidth^2, although the // extremes are equivalent to exact matching and a blanket pass, respectively. MaxDifferentPixelsPerArea int // SampleAreaChannelDeltaThreshold allows values 0-255, although 255 is // equivalent to a blanket pass. SampleAreaChannelDeltaThreshold int // contains filtered or unexported fields }
Matcher is a non-exact image matching algorithm.
Instead of comparing pixels one-by-one, areas of pixels are compared together and are considered identical if a certain number of pixels in that area are identical.
The primary use case for this is large images that are susceptible to random noise throughout the entire image. Such actual color difference can be quite large and still not be noticeable to a human as long as such differences are not closely grouped together.
func (*Matcher) FailedSampleArea ¶
FailedSampleAreaStart returns the point corresponding the the top left corner of the first failed sample area.
func (*Matcher) MaxDifferentPixelsPerAreaOutOfRange ¶
MaxDifferentPixelsPerAreaOutOfRange returns whether the comparison failed because the provided max different pixels per area is too large or small to be used.
func (*Matcher) NumDifferentPixels ¶
NumDifferentPixels returns the number of pixels that differed in the failed sample area.
func (*Matcher) SampleAreaChannelDeltaThresholdOutOfRange ¶
SampleAreaChannelDeltaThresholdOutOfRange returns whether the comparison failed because the provided pixel delta threshold is too large or small to be used.
func (*Matcher) SampleAreaWidthTooLarge ¶
SampleAreaWidthTooLarge returns whether the comparison failed because the provided sample area is too large to be used.
func (*Matcher) SampleAreaWidthTooSmall ¶
SampleAreaWidthTooSmall returns whether the comparison failed because the provided sample area is too small to be used.