summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rw-r--r--sauvola.go2
-rw-r--r--wipesides.go10
4 files changed, 9 insertions, 9 deletions
diff --git a/go.mod b/go.mod
index 858f072..a6805ed 100644
--- a/go.mod
+++ b/go.mod
@@ -4,5 +4,5 @@ go 1.14
require (
github.com/wcharczuk/go-chart/v2 v2.1.0
- rescribe.xyz/integral v0.6.0
+ rescribe.xyz/integral v0.6.1
)
diff --git a/go.sum b/go.sum
index 49ed04e..e500382 100644
--- a/go.sum
+++ b/go.sum
@@ -5,5 +5,5 @@ github.com/wcharczuk/go-chart/v2 v2.1.0/go.mod h1:yx7MvAVNcP/kN9lKXM/NTce4au4DFN
golang.org/x/image v0.0.0-20200927104501-e162460cd6b5 h1:QelT11PB4FXiDEXucrfNckHoFxwt8USGY1ajP1ZF5lM=
golang.org/x/image v0.0.0-20200927104501-e162460cd6b5/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-rescribe.xyz/integral v0.6.0 h1:CLF3sQ6th/OuG+/rp/lLR+AGOT4R7tG3IiUjSLKsriw=
-rescribe.xyz/integral v0.6.0/go.mod h1:gKJq4UaVn17RsMsUasEMcJDkTkwqeb6AzPIJtwcUipg=
+rescribe.xyz/integral v0.6.1 h1:0+4lajevAWO33sxnS33+URUbSalAh2Diti7ZWV/DbqU=
+rescribe.xyz/integral v0.6.1/go.mod h1:gKJq4UaVn17RsMsUasEMcJDkTkwqeb6AzPIJtwcUipg=
diff --git a/sauvola.go b/sauvola.go
index 75d558c..f92c5ce 100644
--- a/sauvola.go
+++ b/sauvola.go
@@ -80,5 +80,5 @@ func PreCalcedSauvola(intImg integral.Image, intSqImg integral.SqImage, img imag
func centeredRectangle(x, y, size int) image.Rectangle {
step := size / 2
- return image.Rect(x - step - 1, y - step - 1, x + step, y + step)
+ return image.Rect(x-step-1, y-step-1, x+step, y+step)
}
diff --git a/wipesides.go b/wipesides.go
index b9f5e5c..316d0b1 100644
--- a/wipesides.go
+++ b/wipesides.go
@@ -22,12 +22,12 @@ import (
// ProportionSlice returns the proportion of black pixels in a
// vertical slice of an image starting at x, width pixels wide.
func ProportionSlice(i SummableImage, x int, width int) float64 {
- r := image.Rect(x, 0, x + width, i.Bounds().Dy())
+ r := image.Rect(x, 0, x+width, i.Bounds().Dy())
in := r.Intersect(i.Bounds())
area := in.Dx() * in.Dy()
// 1 << 16 - 1 as we're using Gray16, so 1 << 16 - 1 = white
- numwhite := float64(i.Sum(in)) / float64(1 << 16 - 1)
- return float64(area) / float64(numwhite) - 1
+ numwhite := float64(i.Sum(in)) / float64(1<<16-1)
+ return float64(area)/float64(numwhite) - 1
}
// findbestedge goes through every vertical line from x to x+w to
@@ -99,7 +99,7 @@ func findedgesOutin(img SummableImage, wsize int, thresh float64) (int, int) {
maxx := img.Bounds().Dx() - 1
var lowedge, highedge int = 0, maxx
- for x := maxx-wsize; x > 0; x-- {
+ for x := maxx - wsize; x > 0; x-- {
if ProportionSlice(img, x, wsize) > thresh {
highedge = findbestedge(img, x, wsize)
break
@@ -191,7 +191,7 @@ func VWipe(img *image.Gray, wsize int, thresh float64, min int) *image.Gray {
intImg := integral.NewImage(b)
draw.Draw(intImg, b, rotimg, b.Min, draw.Src)
// TODO: test whether there are any places where Outin makes a real difference
- lowedge, highedge:= findedgesOutin(*intImg, wsize, thresh)
+ lowedge, highedge := findedgesOutin(*intImg, wsize, thresh)
if toonarrow(img, lowedge, highedge, min) {
return img
}