summaryrefslogtreecommitdiff
path: root/preproc/sauvola.go
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-05-14 10:30:35 +0100
committerNick White <git@njw.name>2019-05-14 10:30:35 +0100
commit2946ba02f25a7ae605464031099580b3ae2ce22c (patch)
tree292ff2ed50ae5731d20ec8e8a5f5b57c950ea8de /preproc/sauvola.go
parent3b12c59f37f0dc58ad1886052c03f4c81a2a5b78 (diff)
gofmt
Diffstat (limited to 'preproc/sauvola.go')
-rw-r--r--preproc/sauvola.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/preproc/sauvola.go b/preproc/sauvola.go
index 2ed9a92..046bb7d 100644
--- a/preproc/sauvola.go
+++ b/preproc/sauvola.go
@@ -17,7 +17,7 @@ func Sauvola(img *image.Gray, ksize float64, windowsize int) *image.Gray {
for x := b.Min.X; x < b.Max.X; x++ {
window := surrounding(img, x, y, windowsize)
m, dev := meanstddev(window)
- threshold := m * (1 + ksize * ((dev / 128) - 1))
+ threshold := m * (1 + ksize*((dev/128)-1))
if img.GrayAt(x, y).Y < uint8(threshold) {
new.SetGray(x, y, color.Gray{0})
} else {
@@ -42,7 +42,7 @@ func IntegralSauvola(img *image.Gray, ksize float64, windowsize int) *image.Gray
for y := b.Min.Y; y < b.Max.Y; y++ {
for x := b.Min.X; x < b.Max.X; x++ {
m, dev := integrals.MeanStdDevWindow(x, y, windowsize)
- threshold := m * (1 + ksize * ((dev / 128) - 1))
+ threshold := m * (1 + ksize*((dev/128)-1))
if img.GrayAt(x, y).Y < uint8(threshold) {
new.SetGray(x, y, color.Gray{0})
} else {
@@ -63,7 +63,7 @@ func PreCalcedSauvola(integrals integralimg.WithSq, img *image.Gray, ksize float
for y := b.Min.Y; y < b.Max.Y; y++ {
for x := b.Min.X; x < b.Max.X; x++ {
m, dev := integrals.MeanStdDevWindow(x, y, windowsize)
- threshold := m * (1 + ksize * ((dev / 128) - 1))
+ threshold := m * (1 + ksize*((dev/128)-1))
if img.GrayAt(x, y).Y < uint8(threshold) {
new.SetGray(x, y, color.Gray{0})
} else {