summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README6
-rw-r--r--example_test.go26
-rw-r--r--go.mod2
-rw-r--r--integral.go (renamed from integralimg.go)16
-rw-r--r--integral_test.go (renamed from integralimg_test.go)2
5 files changed, 26 insertions, 26 deletions
diff --git a/README b/README
index 329fb00..ed682ad 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-# rescribe.xyz/integralimg package
+# rescribe.xyz/integral package
This package contains methods and structures for dealing with
Integral Images, aka Summed Area Tables. These are structures
@@ -7,9 +7,9 @@ pixel, which can make several common image processing
operations much faster.
This is a Go package, and can be installed in the standard go way,
-by running `go get rescribe.xyz/integralimg` and documentation
+by running `go get rescribe.xyz/integral` and documentation
can be read with the `go doc` command or online at
-<https://pkg.go.dev/rescribe.xyz/integralimg>.
+<https://pkg.go.dev/rescribe.xyz/integral>.
## Contributions
diff --git a/example_test.go b/example_test.go
index 8958557..542fbf1 100644
--- a/example_test.go
+++ b/example_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by the GPLv3
// license that can be found in the LICENSE file.
-package integralimg_test
+package integral_test
import (
"fmt"
@@ -12,7 +12,7 @@ import (
"log"
"os"
- "rescribe.xyz/integralimg"
+ "rescribe.xyz/integral"
)
func ExampleImage_Sum() {
@@ -26,9 +26,9 @@ func ExampleImage_Sum() {
log.Fatal(err)
}
b := img.Bounds()
- integral := integralimg.NewImage(b)
- draw.Draw(integral, b, img, b.Min, draw.Src)
- fmt.Printf("Sum: %d\n", integral.Sum(b))
+ in := integral.NewImage(b)
+ draw.Draw(in, b, img, b.Min, draw.Src)
+ fmt.Printf("Sum: %d\n", in.Sum(b))
// Output:
// Sum: 601340165
}
@@ -44,9 +44,9 @@ func ExampleImage_Mean() {
log.Fatal(err)
}
b := img.Bounds()
- integral := integralimg.NewImage(b)
- draw.Draw(integral, b, img, b.Min, draw.Src)
- fmt.Printf("Mean: %f\n", integral.Mean(b))
+ in := integral.NewImage(b)
+ draw.Draw(in, b, img, b.Min, draw.Src)
+ fmt.Printf("Mean: %f\n", in.Mean(b))
// Output:
// Mean: 54677.229042
}
@@ -62,11 +62,11 @@ func ExampleMeanStdDev() {
log.Fatal(err)
}
b := img.Bounds()
- integral := integralimg.NewImage(b)
- sqIntegral := integralimg.NewSqImage(b)
- draw.Draw(integral, b, img, b.Min, draw.Src)
- draw.Draw(sqIntegral, b, img, b.Min, draw.Src)
- mean, stddev := integralimg.MeanStdDev(*integral, *sqIntegral, b)
+ in := integral.NewImage(b)
+ sq := integral.NewSqImage(b)
+ draw.Draw(in, b, img, b.Min, draw.Src)
+ draw.Draw(sq, b, img, b.Min, draw.Src)
+ mean, stddev := integral.MeanStdDev(*in, *sq, b)
fmt.Printf("Mean: %f, Standard Deviation: %f\n", mean, stddev)
// Output:
// Mean: 54677.229042, Standard Deviation: 21643.721672
diff --git a/go.mod b/go.mod
index 9e06b2d..78b4623 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,3 @@
-module rescribe.xyz/integralimg
+module rescribe.xyz/integral
go 1.14
diff --git a/integralimg.go b/integral.go
index d4d25f1..e3d09bb 100644
--- a/integralimg.go
+++ b/integral.go
@@ -2,22 +2,22 @@
// Use of this source code is governed by the GPLv3
// license that can be found in the LICENSE file.
-// integralimg is a package for processing integral images, aka
+// integral is a package for processing integral images, aka
// 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.
//
// A lot of image processing operations rely on many calculations
// of the sum or mean of a set of pixels. As these have been
-// precalculated for an integral Image, these calculations are
+// precalculated for an integral image, these calculations are
// much faster. Image.Sum() and Image.Mean() functions are provided
// by this package to take advantage of this.
//
// Another common requirement is standard deviation over an area
// of an image. This can be calculated by creating an integral
-// Image and squared integral Image (SqImage) for a base image, and
+// image and squared integral image (SqImage) for a base image, and
// passing them to the MeanStdDev() function provided.
-package integralimg
+package integral
import (
"image"
@@ -25,10 +25,10 @@ import (
"math"
)
-// Image is an integral Image
+// Image is an integral image
type Image [][]uint64
-// SqImage is a Square integral Image.
+// SqImage is a Square integral image.
// A squared integral image is an integral image for which the square of
// each pixel is saved; this is useful for efficiently calculating
// Standard Deviation.
@@ -89,7 +89,7 @@ func (i Image) Set(x, y int, c color.Color) {
i.set64(x, y, uint64(gray))
}
-// NewImage returns a new integral Image with the given bounds.
+// NewImage returns a new integral image with the given bounds.
func NewImage(r image.Rectangle) *Image {
w, h := r.Dx(), r.Dy()
var rows Image
@@ -117,7 +117,7 @@ func (i SqImage) Set(x, y int, c color.Color) {
Image(i).set64(x, y, gray*gray)
}
-// NewSqImage returns a new squared integral Image with the given bounds.
+// NewSqImage returns a new squared integral image with the given bounds.
func NewSqImage(r image.Rectangle) *SqImage {
i := NewImage(r)
s := SqImage(*i)
diff --git a/integralimg_test.go b/integral_test.go
index 885ff61..513c7c4 100644
--- a/integralimg_test.go
+++ b/integral_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by the GPLv3
// license that can be found in the LICENSE file.
-package integralimg
+package integral
import (
"image"