Documentation
¶
Overview ¶
Package seed provides utilities for deterministic seed generation for k-means clustering. This is used by input plugins that process images to ensure reproducible color extraction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Calculate ¶
Calculate determines the seed value based on the seed mode. img: the image to extract seed from (required for ModeContent) imagePath: the path to the image file (required for ModeFilepath) config: seed configuration
func CalculateContentSeed ¶
CalculateContentSeed generates a deterministic seed from image content. This hashes the pixel data to create a seed that's consistent for the same image content, regardless of filename or location.
func CalculateFilepathSeed ¶
CalculateFilepathSeed generates a deterministic seed from the absolute file path. This creates a seed that's consistent for the same file path, allowing different images at the same location to produce different results.
func GenerateRandomSeed ¶
func GenerateRandomSeed() int64
GenerateRandomSeed generates a non-deterministic random seed.
Types ¶
type Config ¶
type Config struct {
Mode Mode // Seed mode
Value *int64 // Seed value (only used when Mode is ModeManual)
}
Config holds configuration for seed generation.
type Mode ¶
type Mode string
Mode determines how the random seed for k-means clustering is generated.
const ( // ModeContent generates seed from image content hash (default, deterministic by content). ModeContent Mode = "content" // ModeFilepath generates seed from absolute file path hash (deterministic by path). ModeFilepath Mode = "filepath" // ModeManual uses a user-provided seed value. ModeManual Mode = "manual" // ModeRandom uses non-deterministic random seed (varies each run). ModeRandom Mode = "random" )