histogram

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: BSD-2-Clause Imports: 4 Imported by: 2

Documentation

Overview

Package histogram provides methods to compute approximate color histograms in the HSV color space.

Index

Constants

View Source
const (
	// RoundClosest will round to the closest value using math.Round
	RoundClosest = iota

	// RoundUp will round to the closest bigger value using math.Ceil
	RoundUp

	// RoundDown will round to the closest lower value using math.Trunc
	RoundDown
)

Variables

This section is empty.

Functions

func With32Bins

func With32Bins(img image.Image, roundType int) []float64

With32Bins returns a color histogram with 32 bins for the input image. The values in the bins will represent the percentage of pixels mapped to a certain Hue and Saturation level. It is VERY IMPORTANT TO NOTICE that the percentages are rounded, so the sum of all percentages may not be equal to 100. The Hue will be mapped to 8 levels, indexes {0,4,8,12,16,20,24,28}. The Saturation will be mapped to 4 levels, indexes hue_level + {0,1,2,3}. The Value channel is not taken into consideration, as to give invariance to light intensity.

func With32BinsConcurrent

func With32BinsConcurrent(img image.Image, roundType int) []float64

With32BinsConcurrent returns a color histogram with 32 bins for the input image. This concurrent version will check whether the image is taller or wider and iterate over the biggest dimension of the two, using use one goroutine per column/row. The values in the bins will represent the percentage of pixels mapped to a certain Hue and Saturation level. It is VERY IMPORTANT TO NOTICE that the percentages are rounded, so the sum of all percentages may not be equal to 100. The Hue will be mapped to 8 levels, indexes {0,4,8,12,16,20,24,28}. The Saturation will be mapped to 4 levels, indexes hue_level + {0,1,2,3}. The Value channel is not taken into consideration, as to give invariance to light intensity.

func With64Bins

func With64Bins(img image.Image, roundType int) []float64

With64Bins returns a color histogram with 64 bins for the input image. The values in the bins will represent the percentage of pixels mapped to a certain Hue, Saturation and Value level. The output can be considered as two 32 bin histograms, where the second batch of 32 bins represents colors with Value above 50. It is VERY IMPORTANT TO NOTICE that the percentages are rounded, so the sum of all percentages may not be equal to 100. The Hue will be mapped to 8 levels, indexes {0,4,8,12,16,20,24,28}. The Saturation will be mapped to 4 levels, indexes H_level + {0,1,2,3}. The Value will be mapped to 2 levels, indexes H_level + S_level + {0,32}.

func With64BinsConcurrent

func With64BinsConcurrent(img image.Image, roundType int) []float64

With64BinsConcurrent returns a color histogram with 64 bins for the input image. This concurrent version will check whether the image is taller or wider and iterate over the biggest dimension of the two, using use one goroutine per column/row. The values in the bins will represent the percentage of pixels mapped to a certain Hue, Saturation and Value level. The output can be considered as two 32 bin histograms, where the second batch of 32 bins represents colors with Value above 50. It is VERY IMPORTANT TO NOTICE that the percentages are rounded, so the sum of all percentages may not be equal to 100. The Hue will be mapped to 8 levels, indexes {0,4,8,12,16,20,24,28}. The Saturation will be mapped to 4 levels, indexes H_level + {0,1,2,3}. The Value will be mapped to 2 levels, indexes H_level + S_level + {0,32}.

Types

This section is empty.

Jump to

Keyboard shortcuts

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