From 7e6f9f4c127bef4ecd7199a46578b3b5765c600c Mon Sep 17 00:00:00 2001 From: Nick White Date: Thu, 23 Jul 2020 16:59:57 +0100 Subject: Remove ToIntegralImg and ToSqIntegralImg as the NewImage and NewSqImage functions do the same job more flexibly --- integralimg.go | 55 ------------------------------------------------------- 1 file changed, 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 -- cgit v1.2.1-24-ge1ad