integralimg

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

README

# rescribe.xyz/integralimg package

This package contains methods and structures for dealing with
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.

This is a Go package, and can be installed in the standard go way,
by running `go get rescribe.xyz/integralimg` and documentation
can be read with the `go doc` command or online at
<https://pkg.go.dev/rescribe.xyz/integralimg>.

## Bugs

The standard deviation and mean functions don't produce precisely
the same result as those run on non integral images. The difference
is small enough that it has little effect for most uses, but it
ought to be identical.

## TODO

Write tests for the package.

## Contributions

Any and all comments, bug reports, patches or pull requests would
be very welcomely received. Please email them to <nick@rescribe.xyz>.

## License

This package is licensed under the GPLv3. See the LICENSE file for
more details.

Documentation

Overview

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.

integralimg.Image and integralimg.SqImage fully implement the image.Image and image/draw.Draw interfaces, and hence can be used like so:

img, _, err := image.Decode(f)
integral := integralimg.NewImage(b)
draw.Draw(integral, b, img, b.Min, draw.Src)

The Sum(), Mean() and MeanStdDev() functions provided for the integral versions of Images significantly speed up many common image processing operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MeanStdDev added in v0.3.0

func MeanStdDev(i Image, sq SqImage, r image.Rectangle) (float64, float64)

MeanStdDev calculates the mean and standard deviation of a section of an image, using the corresponding regular and square integral images.

Types

type Image added in v0.2.0

type Image [][]uint64

Image is an integral Image

func NewImage added in v0.2.0

func NewImage(r image.Rectangle) *Image

NewImage returns a new integral Image with the given bounds.

func (Image) At added in v0.2.0

func (i Image) At(x, y int) color.Color

func (Image) Bounds added in v0.2.0

func (i Image) Bounds() image.Rectangle

func (Image) ColorModel added in v0.2.0

func (i Image) ColorModel() color.Model

func (Image) Mean added in v0.3.0

func (i Image) Mean(r image.Rectangle) float64

Mean returns the average value of pixels in a rectangle

func (Image) Set added in v0.2.0

func (i Image) Set(x, y int, c color.Color)

func (Image) Sum added in v0.3.0

func (i Image) Sum(r image.Rectangle) uint64

Sum returns the sum of all pixels in a rectangle

type SqImage added in v0.2.0

type SqImage [][]uint64

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.

func NewSqImage added in v0.2.0

func NewSqImage(r image.Rectangle) *SqImage

NewSqImage returns a new squared integral Image with the given bounds.

func (SqImage) At added in v0.2.0

func (i SqImage) At(x, y int) color.Color

func (SqImage) Bounds added in v0.2.0

func (i SqImage) Bounds() image.Rectangle

func (SqImage) ColorModel added in v0.2.0

func (i SqImage) ColorModel() color.Model

func (SqImage) Mean added in v0.3.0

func (i SqImage) Mean(r image.Rectangle) float64

Mean returns the average value of pixels in a rectangle

func (SqImage) Set added in v0.2.0

func (i SqImage) Set(x, y int, c color.Color)

func (SqImage) Sum added in v0.3.0

func (i SqImage) Sum(r image.Rectangle) uint64

Sum returns the sum of all pixels in a rectangle

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL