sobel

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

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

Go to latest
Published: Oct 31, 2024 License: BSD-3-Clause Imports: 5 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 {
	fuzzy.Matcher
	EdgeThreshold int // Valid values are 0 to 255 inclusive.
	// contains filtered or unexported fields
}

Matcher is an image matching algorithm.

It extends the fuzzy.Matcher algorithm by performing edge detection using the Sobel operator[1] and ignoring any pixels that are part of an edge.

The algorithm performs the following steps:

  1. It applies the Sobel operator to the expected image, producing a 0 to 255 value per pixel indicating how likely it is to be part of an edge.
  2. It zeroes-out any (x,y) coordinates on *both* images where the aforementioned value exceeds EdgeThreshold. Note that this assumes both images are of equal size.
  3. It passes the two resulting images to the fuzzy.Matcher algorithm (using parameters MaxDifferentPixels, PixelDeltaThreshold, PixelPerChannelDeltaThreshold and IgnoredBorderThickness) and returns its return value.

[1] https://en.wikipedia.org/wiki/Sobel_operator

func (*Matcher) ActualImageWithEdgesRemoved

func (m *Matcher) ActualImageWithEdgesRemoved() image.Image

ActualImageWithEdgesRemoved returns the right image from the last Match method call with its edges removed.

func (*Matcher) ExpectedImageWithEdgesRemoved

func (m *Matcher) ExpectedImageWithEdgesRemoved() image.Image

ExpectedImageWithEdgesRemoved returns the left image from the last Match method call with its edges removed.

func (*Matcher) Match

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

Match implements the imgmatching.Matcher interface.

func (*Matcher) SobelOutput

func (m *Matcher) SobelOutput() image.Image

SobelOutput returns an image with the output of applying the Sobel operator to the expected image from the last Match method call.

Jump to

Keyboard shortcuts

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