Documentation ¶
Index ¶
- func ApplyDiff(golden, diff image.Image, transparency uint8) *image.RGBA
- func Compare(golden, copper image.Image, params ComparisonParameters) (bool, float64)
- func CompareByHistograms(golden, copper image.Image, params ComparisonParameters) (bool, float64)
- func CompareByParams(golden, copper image.Image) bool
- func CompareHistogramsOnly(params ComparisonParameters) (bool, float64)
- func FindDiffMask(golden, copper image.Image, params ContextParameters) *image.RGBA
- func FindDiffShapesMask(golden, copper image.Image, params ContextParameters) *image.RGBA
- func GetDiffShapes(golden, copper image.Image, params ContextParameters) map[int]Rect
- type ComparisonParameters
- type ContextParameters
- type DiffPoint
- type Histogram
- type Mask
- type NormalizedHistogram
- type Rect
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyDiff ¶
ApplyDiff applies diff as a mask with transparency It returns image with highlighted diff
func Compare ¶
func Compare(golden, copper image.Image, params ComparisonParameters) (bool, float64)
Compare compares using both - CompareByHistograms and CompareByParams methods
func CompareByHistograms ¶
func CompareByHistograms(golden, copper image.Image, params ComparisonParameters) (bool, float64)
CompareByHistograms compares two images by 3 histograms - Red, Green, Blue channels of pixels It returns the boolean result and the float64 difference between two images
func CompareByParams ¶
CompareByParams compares width and height of both images
func CompareHistogramsOnly ¶
func CompareHistogramsOnly(params ComparisonParameters) (bool, float64)
CompareHistogramsOnly is kind of copy of CompareByHistograms, which uses only pre-calculated histograms, instead of images
func FindDiffMask ¶
func FindDiffMask(golden, copper image.Image, params ContextParameters) *image.RGBA
FindDiffMask finds pixel-perfect difference between two images It returns mask of different pixels
func FindDiffShapesMask ¶
func FindDiffShapesMask(golden, copper image.Image, params ContextParameters) *image.RGBA
FindDiffShapesMask finds shapes (rectangles) inside diff It returns mask of highlighted rectangles
func GetDiffShapes ¶
func GetDiffShapes(golden, copper image.Image, params ContextParameters) map[int]Rect
GetDiffShapes finds shapes (rectangles) inside diff to avoid "too noisy" diff as a result
Types ¶
type ComparisonParameters ¶
type ComparisonParameters struct { Threshold float64 BinsCount int NormalizedGoldHist, NormalizedCopperHist NormalizedHistogram }
type ContextParameters ¶
type DiffPoint ¶
type DiffPoint struct {
X, Y int
}
func GetDiffPairs ¶
GetDiffPairs gets pairs of pixels, that are different in the both images It returns slice of pairs (x,y), representing pixel's coordinates Works with both Gray and RGBA images
func GetDiffPairsGrayscale ¶
GetDiffPairsGrayscale converts images to gray and gets pairs of pixels, that are different in the both images It returns slice of pairs (x,y), representing pixel's coordinates
type NormalizedHistogram ¶
type NormalizedHistogram = [][3]float64
func PrepareHistogram ¶
func PrepareHistogram(image image.Image, params ComparisonParameters) (normalizedHistogram NormalizedHistogram)
PrepareHistogram prepares histograms for 3 channels (r,g,b) and normalizes them It returns normalized histogram for 3 different channels