MCPcopy
hub / github.com/fogleman/primitive / differenceFull

Function differenceFull

primitive/core.go:65–89  ·  view source on GitHub ↗
(a, b *image.RGBA)

Source from the content-addressed store, hash-verified

63}
64
65func differenceFull(a, b *image.RGBA) float64 {
66 size := a.Bounds().Size()
67 w, h := size.X, size.Y
68 var total uint64
69 for y := 0; y < h; y++ {
70 i := a.PixOffset(0, y)
71 for x := 0; x < w; x++ {
72 ar := int(a.Pix[i])
73 ag := int(a.Pix[i+1])
74 ab := int(a.Pix[i+2])
75 aa := int(a.Pix[i+3])
76 br := int(b.Pix[i])
77 bg := int(b.Pix[i+1])
78 bb := int(b.Pix[i+2])
79 ba := int(b.Pix[i+3])
80 i += 4
81 dr := ar - br
82 dg := ag - bg
83 db := ab - bb
84 da := aa - ba
85 total += uint64(dr*dr + dg*dg + db*db + da*da)
86 }
87 }
88 return math.Sqrt(float64(total)/float64(w*h*4)) / 255
89}
90
91func differencePartial(target, before, after *image.RGBA, score float64, lines []Scanline) float64 {
92 size := target.Bounds().Size()

Callers 1

NewModelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…