summaryrefslogtreecommitdiff
path: root/cmd/pggraph
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-07-24 18:59:51 +0100
committerNick White <git@njw.name>2020-07-24 18:59:51 +0100
commit797a8dca9408eb58620bc33dde9b5da51bbfee5f (patch)
tree30f164405261c2ef09a896a3dc3d4704e24b0fd1 /cmd/pggraph
parent70e3b595b02977e90c533756a8837c019d51d182 (diff)
Update commands to use the updated interfacesv0.2.0
Diffstat (limited to 'cmd/pggraph')
-rw-r--r--cmd/pggraph/main.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/cmd/pggraph/main.go b/cmd/pggraph/main.go
index 12b2f52..6c13fe2 100644
--- a/cmd/pggraph/main.go
+++ b/cmd/pggraph/main.go
@@ -166,17 +166,19 @@ func main() {
log.Fatalf("Could not decode image: %v\n", err)
}
b := img.Bounds()
- gray := image.NewGray(image.Rect(0, 0, b.Dx(), b.Dy()))
- draw.Draw(gray, b, img, b.Min, draw.Src)
if *vertical {
- gray = sideways(gray)
+ gray := image.NewGray(b)
+ draw.Draw(gray, b, img, b.Min, draw.Src)
+ img = sideways(gray)
+ b = img.Bounds()
}
- integral := integralimg.ToIntegralImg(gray)
+ intImg := integralimg.NewImage(b)
+ draw.Draw(intImg, b, img, b.Min, draw.Src)
points := make(map[int]float64)
- maxx := len(integral[0]) - 1
+ maxx := b.Dx() - 1
for x := 0; x+*width < maxx; x += *width {
- w := integral.GetVerticalWindow(x, *width)
+ w := intImg.GetVerticalWindow(x, *width)
points[x] = w.Proportion()
}