From 1da10c4bf2aabff10d15767894bf6f205b45c1f7 Mon Sep 17 00:00:00 2001 From: Nick White Date: Thu, 23 Jul 2020 16:57:18 +0100 Subject: Remove the WithSq functionality as its being replaced by SqImage --- integralimg.go | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) (limited to 'integralimg.go') diff --git a/integralimg.go b/integralimg.go index d0bcb34..97e652f 100644 --- a/integralimg.go +++ b/integralimg.go @@ -113,12 +113,6 @@ func NewSqImage(r image.Rectangle) *SqImage { return &s } -// Sq contains an Integral Image and its Square -type WithSq struct { - Img I - Sq I -} - // Window is a part of an Integral Image type Window struct { topleft uint64 @@ -184,16 +178,6 @@ func ToSqIntegralImg(img *image.Gray) I { return integral } -// ToAllIntegralImg creates a WithSq containing a regular and -// squared Integral Image -func ToAllIntegralImg(img *image.Gray) WithSq { - var s WithSq - s.Img = ToIntegralImg(img) - s.Sq = ToSqIntegralImg(img) - return s -} - - // 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 @@ -264,17 +248,12 @@ func (w Window) Proportion() float64 { return float64(area) / sum - 1 } -// MeanWindow calculates the mean value of a section of an Integral -// Image -func (i I) MeanWindow(x, y, size int) float64 { - return i.GetWindow(x, y, size).Mean() -} - // MeanStdDevWindow calculates the mean and standard deviation of -// a section on an Integral Image -func (i WithSq) MeanStdDevWindow(x, y, size int) (float64, float64) { - imean := i.Img.GetWindow(x, y, size).Mean() - smean := i.Sq.GetWindow(x, y, size).Mean() +// a section on an Integral Image, using the corresponding Square +// Integral Image. +func MeanStdDevWindow(i I, sq SqImage, x, y, size int) (float64, float64) { + imean := i.GetWindow(x, y, size).Mean() + smean := sq.GetWindow(x, y, size).Mean() variance := smean - (imean * imean) -- cgit v1.2.1-24-ge1ad