summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2020-07-23 16:59:57 +0100
committerNick White <git@njw.name>2020-07-23 16:59:57 +0100
commit7e6f9f4c127bef4ecd7199a46578b3b5765c600c (patch)
treef276f6806031a2680b5891697970766282a791dd
parent1da10c4bf2aabff10d15767894bf6f205b45c1f7 (diff)
Remove ToIntegralImg and ToSqIntegralImg as the NewImage and NewSqImage functions do the same job more flexibly
-rw-r--r--integralimg.go55
1 files changed, 0 insertions, 55 deletions
diff --git a/integralimg.go b/integralimg.go
index 97e652f..9b9ad16 100644
--- a/integralimg.go
+++ b/integralimg.go
@@ -123,61 +123,6 @@ type Window struct {
height int
}
-// ToIntegralImg creates an integral image
-func ToIntegralImg(img *image.Gray) I {
- var integral I
- var oldy, oldx, oldxy uint64
- b := img.Bounds()
- for y := b.Min.Y; y < b.Max.Y; y++ {
- newrow := []uint64{}
- for x := b.Min.X; x < b.Max.X; x++ {
- oldx, oldy, oldxy = 0, 0, 0
- if x > 0 {
- oldx = newrow[x-1]
- }
- if y > 0 {
- oldy = integral[y-1][x]
- }
- if x > 0 && y > 0 {
- oldxy = integral[y-1][x-1]
- }
- pixel := uint64(img.GrayAt(x, y).Y)
- i := pixel + oldx + oldy - oldxy
- newrow = append(newrow, i)
- }
- integral = append(integral, newrow)
- }
- return integral
-}
-
-// ToSqIntegralImg creates an integral image of the square of all
-// pixel values
-func ToSqIntegralImg(img *image.Gray) I {
- var integral I
- var oldy, oldx, oldxy uint64
- b := img.Bounds()
- for y := b.Min.Y; y < b.Max.Y; y++ {
- newrow := []uint64{}
- for x := b.Min.X; x < b.Max.X; x++ {
- oldx, oldy, oldxy = 0, 0, 0
- if x > 0 {
- oldx = newrow[x-1]
- }
- if y > 0 {
- oldy = integral[y-1][x]
- }
- if x > 0 && y > 0 {
- oldxy = integral[y-1][x-1]
- }
- pixel := uint64(img.GrayAt(x, y).Y)
- i := pixel * pixel + oldx + oldy - oldxy
- newrow = append(newrow, i)
- }
- integral = append(integral, newrow)
- }
- return integral
-}
-
// GetWindow gets the values of the corners of a square part of an
// Integral Image, plus the dimensions of the part, which can
// be used to quickly calculate the mean of the area