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 ¶
Cumulative returns a new Histogram in which each bin is the cumulative value of its previous bins
func (*Histogram) Image ¶
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.
type RGBAHistogram ¶
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.