Back to

package integralimg

Latest Go to latest
Published: Apr 14, 2020 | License: GPL3 | Module:


integralimg 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.


type I

type I [][]uint64

I is the Integral Image

func ToIntegralImg

func ToIntegralImg(img *image.Gray) I

ToIntegralImg creates an integral image

func ToSqIntegralImg

func ToSqIntegralImg(img *image.Gray) I

ToSqIntegralImg creates an integral image of the square of all pixel values

func (I) GetHorizontalWindow

func (i I) GetHorizontalWindow(y, height int) Window

GetHorizontalWindow gets the values of the corners of a horizontal slice of an Integral Image, starting at y

func (I) GetVerticalWindow

func (i I) GetVerticalWindow(x, width int) Window

GetVerticalWindow gets the values of the corners of a vertical slice of an Integral Image, starting at x

func (I) GetWindow

func (i I) GetWindow(x, y, size int) Window

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

func (I) MeanWindow

func (i I) MeanWindow(x, y, size int) float64

MeanWindow calculates the mean value of a section of an Integral Image

type Window

type Window struct {
	// contains filtered or unexported fields

Window is a part of an Integral Image

func (Window) Mean

func (w Window) Mean() float64

Mean returns the average value of pixels in a Window

func (Window) Proportion

func (w Window) Proportion() float64

Proportion returns the proportion of pixels which are on

func (Window) Size

func (w Window) Size() int

Size returns the total size of a Window

func (Window) Sum

func (w Window) Sum() uint64

Sum returns the sum of all pixels in a Window

type WithSq

type WithSq struct {
	Img I
	Sq  I

Sq contains an Integral Image and its Square

func ToAllIntegralImg

func ToAllIntegralImg(img *image.Gray) WithSq

ToAllIntegralImg creates a WithSq containing a regular and squared Integral Image

func (WithSq) MeanStdDevWindow

func (i WithSq) MeanStdDevWindow(x, y, size int) (float64, float64)

MeanStdDevWindow calculates the mean and standard deviation of a section on an Integral Image

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier