CrImage::Util::Histogram
Inherits Reference / Object
Represents a histogram of pixel intensity values.
A histogram shows the distribution of pixel brightness levels (0-255) in an image. Useful for analyzing image characteristics and applying contrast enhancements.
The histogram contains 256 bins, one for each possible intensity value, and tracks the total number of pixels analyzed.
Constructors
Instance methods
Calculates the mean (average) intensity value across all pixels.
Returns: Average brightness value (0.0-255.0)
Calculates the median intensity value (50th percentile).
Returns: The intensity value at which half the pixels are darker
Returns the intensity value at the specified percentile (0-100).
For example, percentile(95) returns the brightness level below which 95% of pixels fall.
Parameters:
p: Percentile value (0.0-100.0)
Returns: Intensity value at that percentile
Raises: ArgumentError if percentile is outside 0-100 range
Calculates the standard deviation of intensity values.
Measures the spread of brightness values. Higher values indicate more contrast, lower values indicate more uniform brightness.
Returns: Standard deviation of pixel intensities