diff options
author | Nick White <git@njw.name> | 2020-08-03 15:57:34 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-08-03 15:57:34 +0100 |
commit | eca5854cfec5ec4a13312bd5fdae81f66be3a673 (patch) | |
tree | 3265e8e348129664f70b444f6abb48ab6a013650 /integralimg.go | |
parent | a7fca431e4eceb5523943e14620e1f2f2f563aed (diff) |
gofmt
Diffstat (limited to 'integralimg.go')
-rw-r--r-- | integralimg.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/integralimg.go b/integralimg.go index a197920..f53938d 100644 --- a/integralimg.go +++ b/integralimg.go @@ -115,7 +115,7 @@ func (i SqImage) At(x, y int) color.Color { func (i SqImage) Set(x, y int, c color.Color) { gray := uint64(color.Gray16Model.Convert(c).(color.Gray16).Y) - Image(i).set64(x, y, gray * gray) + Image(i).set64(x, y, gray*gray) } // NewSqImage returns a new squared integral Image with the given bounds. @@ -143,8 +143,8 @@ func (i Image) topLeft(r image.Rectangle) uint64 { b := i.Bounds() x := r.Min.X - 1 y := r.Min.Y - 1 - x = lowest(x, b.Max.X - 1) - y = lowest(y, b.Max.Y - 1) + x = lowest(x, b.Max.X-1) + y = lowest(y, b.Max.Y-1) if x < 0 || y < 0 { return 0 } @@ -153,9 +153,9 @@ func (i Image) topLeft(r image.Rectangle) uint64 { func (i Image) topRight(r image.Rectangle) uint64 { b := i.Bounds() - x := lowest(r.Max.X - 1, b.Max.X - 1) + x := lowest(r.Max.X-1, b.Max.X-1) y := r.Min.Y - 1 - y = lowest(y, b.Max.Y - 1) + y = lowest(y, b.Max.Y-1) if x < 0 || y < 0 { return 0 } @@ -165,8 +165,8 @@ func (i Image) topRight(r image.Rectangle) uint64 { func (i Image) bottomLeft(r image.Rectangle) uint64 { b := i.Bounds() x := r.Min.X - 1 - x = lowest(x, b.Max.X - 1) - y := lowest(r.Max.Y - 1, b.Max.Y - 1) + x = lowest(x, b.Max.X-1) + y := lowest(r.Max.Y-1, b.Max.Y-1) if x < 0 || y < 0 { return 0 } @@ -175,8 +175,8 @@ func (i Image) bottomLeft(r image.Rectangle) uint64 { func (i Image) bottomRight(r image.Rectangle) uint64 { b := i.Bounds() - x := lowest(r.Max.X - 1, b.Max.X - 1) - y := lowest(r.Max.Y - 1, b.Max.Y - 1) + x := lowest(r.Max.X-1, b.Max.X-1) + y := lowest(r.Max.Y-1, b.Max.Y-1) return i[y][x] } @@ -188,7 +188,7 @@ func (i Image) Sum(r image.Rectangle) uint64 { // Mean returns the average value of pixels in a rectangle func (i Image) Mean(r image.Rectangle) float64 { in := r.Intersect(i.Bounds()) - return float64(i.Sum(r)) / float64(in.Dx() * in.Dy()) + return float64(i.Sum(r)) / float64(in.Dx()*in.Dy()) } // Sum returns the sum of all pixels in a rectangle |