sample_area

package
v0.0.0-...-0abec67 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

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

func (m *Matcher) FailedSampleArea() image.Rectangle

FailedSampleAreaStart returns the point corresponding the the top left corner of the first failed sample area.

func (*Matcher) Match

func (m *Matcher) Match(expected, actual image.Image) bool

Match implements the imgmatching.Matcher interface.

func (*Matcher) MaxDifferentPixelsPerAreaOutOfRange

func (m *Matcher) MaxDifferentPixelsPerAreaOutOfRange() bool

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

func (m *Matcher) NumDifferentPixels() int

NumDifferentPixels returns the number of pixels that differed in the failed sample area.

func (*Matcher) SampleAreaChannelDeltaThresholdOutOfRange

func (m *Matcher) SampleAreaChannelDeltaThresholdOutOfRange() bool

SampleAreaChannelDeltaThresholdOutOfRange returns whether the comparison failed because the provided pixel delta threshold is too large or small to be used.

func (*Matcher) SampleAreaWidthTooLarge

func (m *Matcher) SampleAreaWidthTooLarge() bool

SampleAreaWidthTooLarge returns whether the comparison failed because the provided sample area is too large to be used.

func (*Matcher) SampleAreaWidthTooSmall

func (m *Matcher) SampleAreaWidthTooSmall() bool

SampleAreaWidthTooSmall returns whether the comparison failed because the provided sample area is too small to be used.

Jump to

Keyboard shortcuts

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