histogram

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package histogram provides basic histogram types and functions to analyze RGBA images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Histogram

type Histogram struct {
	Bins []int
}

Histogram holds a variable length slice of bins, which keeps track of sample counts.

func (*Histogram) Cumulative

func (h *Histogram) Cumulative() *Histogram

Cumulative returns a new Histogram in which each bin is the cumulative value of its previous bins

func (*Histogram) Image

func (h *Histogram) Image() *image.Gray

Image returns a grayscale image representation of the Histogram. The width and height of the image will be equivalent to the number of Bins in the Histogram.

func (*Histogram) Max

func (h *Histogram) Max() int

Max returns the highest count found in the histogram bins.

func (*Histogram) Min

func (h *Histogram) Min() int

Min returns the lowest count found in the histogram bins.

type RGBAHistogram

type RGBAHistogram struct {
	R Histogram
	G Histogram
	B Histogram
	A Histogram
}

RGBAHistogram holds a sub-histogram per RGBA channel. Each channel histogram contains 256 bins (8-bit color depth per channel).

func NewRGBAHistogram

func NewRGBAHistogram(img image.Image) *RGBAHistogram

NewRGBAHistogram constructs a RGBAHistogram out of the provided image. A sub-histogram is created per RGBA channel with 256 bins each.

func (*RGBAHistogram) Cumulative

func (h *RGBAHistogram) Cumulative() *RGBAHistogram

Cumulative returns a new RGBAHistogram in which each bin is the cumulative value of its previous bins per channel.

func (*RGBAHistogram) Image

func (h *RGBAHistogram) Image() *image.RGBA

Image returns an RGBA image representation of the RGBAHistogram. An image width of 256 represents the 256 Bins per channel and the image height of 256 represents the max normalized histogram value per channel. Each RGB channel from the histogram is mapped to its corresponding channel in the image, so that for example if the red channel is extracted from the image, it corresponds to the red channel histogram.

Jump to

Keyboard shortcuts

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