Skip to content

HMath.Image.Histogram

Module index · Numerical conventions

Description

Unit-range, per-channel histograms, equalization, thresholds, and CLAHE. Values must be in [0,1]; exactly one belongs to the last bin. CLAHE clips tile counts, redistributes excess without exceeding the feasible clip cap, and bilinearly interpolates mappings at tile centers.

On this page

API Purpose
histogram Given bin count in [2,4096] then image with every sample in [0,1], return one Int count list per channel.
equalizeHistogram CDF-min equalization with quantized bin mapping.
clahe 2D adaptive equalization. clipFactor>=1 is relative to uniform tile occupancy; the cap is max(ceil(tileSamplesbins),floor(factor*tileSamplesbins)).
threshold Strict comparison x>level; each channel is thresholded independently.
otsu Otsu between-class variance maximum.
adaptiveThreshold Local mean or Gaussian threshold: x > localMean-offset.

Documentation

histogram

histogram :: Int -> Image -> Either MathError [[Int]] Source #

Given bin count in [2,4096] then image with every sample in [0,1], return one Int count list per channel. Values at 1 enter the final bin. Invalid count/range fails.

equalizeHistogram

equalizeHistogram :: Int -> Image -> Either MathError Image Source #

CDF-min equalization with quantized bin mapping. A single occupied bin is left unchanged, avoiding an arbitrary jump on constant images.

clahe

clahe :: Int -> (Int, Int) -> Double -> Image -> Either MathError Image Source #

2D adaptive equalization. clipFactor>=1 is relative to uniform tile occupancy; the cap is max(ceil(tileSamplesbins),floor(factor*tileSamplesbins)). Tiles at image ends may be smaller. Intensities are quantized without channel coupling. At most 4,096 tiles and 1,048,576 stored histogram bins.

threshold

threshold :: Double -> Image -> Either MathError Image Source #

Strict comparison x>level; each channel is thresholded independently.

otsu

otsu :: Int -> Image -> Either MathError ([Double], Image) Source #

Otsu between-class variance maximum. Lowest threshold wins ties. Returns one bin-edge threshold per channel; a constant channel returns its value.

adaptiveThreshold

adaptiveThreshold :: Bool -> Boundary -> Int -> Double -> Image -> Either MathError Image Source #

Local mean or Gaussian threshold: x > localMean-offset. Gaussian uses sigma=max(0.5,radius/2); boundary extension is explicit.