diff options
author | Nick White <git@njw.name> | 2020-07-25 19:18:12 +0100 |
---|---|---|
committer | Nick White <git@njw.name> | 2020-07-25 19:30:10 +0100 |
commit | a3a496c6c80d747788769410c3e5029e6669566b (patch) | |
tree | dfe2c1d16e47bda366a347e7169a52f2c7a2a585 | |
parent | 5ad45af43af2cdc832226632af2024cf416baedd (diff) |
Improve documentation and simplify test code
-rw-r--r-- | integralimg.go | 12 | ||||
-rw-r--r-- | integralimg_test.go | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/integralimg.go b/integralimg.go index 0ad734b..c088be4 100644 --- a/integralimg.go +++ b/integralimg.go @@ -6,6 +6,18 @@ // summed area tables. These are structures which precompute the // sum of pixels to the left and above each pixel, which can make // several common image processing operations much faster. +// +// integralimg.Image and integralimg.SqImage fully implement the +// image.Image and image/draw.Draw interfaces, and hence can be +// used like so: +// +// img, _, err := image.Decode(f) +// integral := integralimg.NewImage(b) +// draw.Draw(integral, b, img, b.Min, draw.Src) +// +// This package also defines a Window, which is a rectangular +// section of an integral image. This has several methods to do +// useful calculations on the part of the image represented. package integralimg import ( diff --git a/integralimg_test.go b/integralimg_test.go index 8b882db..627249f 100644 --- a/integralimg_test.go +++ b/integralimg_test.go @@ -24,7 +24,7 @@ func TestFromPNG(t *testing.T) { } b := img.Bounds() - integral := NewImage(image.Rect(0, 0, b.Dx(), b.Dy())) + integral := NewImage(b) draw.Draw(integral, b, img, b.Min, draw.Src) if !imgsequal(img, integral) { @@ -44,7 +44,7 @@ func TestSqFromPNG(t *testing.T) { } b := img.Bounds() - integral := NewSqImage(image.Rect(0, 0, b.Dx(), b.Dy())) + integral := NewSqImage(b) draw.Draw(integral, b, img, b.Min, draw.Src) if !imgsequal(img, integral) { |