Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Matcher ¶
type Matcher struct { MaxDifferentPixels int PixelDeltaThreshold int PixelPerChannelDeltaThreshold int IgnoredBorderThickness int // contains filtered or unexported fields }
Matcher is an image matching algorithm.
It considers two images to be equal if the following conditions are met:
- Both images are of equal size.
- The total number of different pixels is below MaxDifferentPixels.
- If PixelDeltaThreshold > 0: There are no pixels such that dR + dG + dB + dA > PixelDeltaThreshold, where d{R,G,B,A} are the per-channel deltas.
- Else: There are no pixels such that max(dR, dG, dB, dA) > PixelPerChannelDeltaThreshold, where d{R,G,B,A} are the per-channel deltas.
- If IgnoredBorderThickness > 0, then the first/last IgnoredBorderThickness rows/columns will be ignored when performing the above pixel-wise comparisons.
Note that if MaxDifferentPixels = 0 this algorithm will perform an exact image comparison. If that is intentional, consider using exact matching instead (e.g. by not specifying the image_matching_algorithm optional key).
This algorithm assumes 8-bit channels.
Valid PixelDeltaThreshold values are 0 to 1020 inclusive (0 <= d{R,G,B,A} <= 255, thus 0 <= dR + dG + dB + dA <= 255*4 = 1020).
Valid PixelPerChannelDelta values are 0 to 255 inclusive.
func (*Matcher) MaxPixelDelta ¶
MaxPixelDelta returns the maximum per-channel delta sum between the last two matched images.
func (*Matcher) NumDifferentPixels ¶
NumDifferentPixels returns the number of different pixels between the last two matched images.
func (*Matcher) PixelComparisonMethod ¶
PixelComparisonMethod returns whether pixel comparison is being done using the sum of per-channel differences or the max per-channel difference.