Documentation
¶
Overview ¶
Package colorsim provides background-robust image color similarity based on Gaussian center-weighted HSV histograms.
Index ¶
- Constants
- Variables
- func BhattacharyyaDistance(a, b []float64) (float64, error)
- func ColorDistance(imgA, imgB image.Image) float64
- func ColorHist(img image.Image, hBins, sBins int, sigma, minWeight float64) []float64
- func DecodeAny(r io.Reader) (image.Image, string, error)
- func RGBToHSV(r, g, b uint8) (h, s, v float64)
Constants ¶
View Source
const ( // DefaultSigma is normalized Gaussian sigma, independent of image size. DefaultSigma = 0.55 // DefaultHBins is the default number of hue bins. DefaultHBins = 36 // DefaultSBins is the default number of saturation bins. DefaultSBins = 16 // DefaultMinWeight is the floor for per-pixel Gaussian weight. DefaultMinWeight = 0.05 // DefaultSimilarityThreshold is a practical default split: // distance < threshold -> close, distance >= threshold -> distinct. DefaultSimilarityThreshold = 0.35 )
Variables ¶
View Source
var ( // ErrHistogramLengthMismatch indicates two histograms have different sizes. ErrHistogramLengthMismatch = errors.New("histograms must have the same length") // ErrEmptyHistogram indicates an empty histogram input. ErrEmptyHistogram = errors.New("histograms must not be empty") // ErrNilReader indicates a nil input reader. ErrNilReader = errors.New("reader must not be nil") // ErrEmptyInput indicates an empty byte stream. ErrEmptyInput = errors.New("input is empty") // ErrUnsupportedFormat indicates data is not in a supported image format. ErrUnsupportedFormat = errors.New("unsupported image format") )
Functions ¶
func BhattacharyyaDistance ¶
BhattacharyyaDistance computes the Bhattacharyya distance between two normalized histograms.
BC = sum_i sqrt(p[i] * q[i]) D = sqrt(max(0, 1 - BC))
func ColorDistance ¶
ColorDistance computes color distance using default parameters.
func ColorHist ¶
ColorHist computes a Gaussian center-weighted 2D HSV histogram (H,S only) and normalizes it so the sum equals 1.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.