Collection of image segmentation techniques written in C and compiled to WebAssembly. Computation time in parentheses.
Digital images use gamma encodings to store luminance. Gamma correction can make image luminance appear more realistic.
K-Means: A randomized clustering algorithm to group pixels into K groups based on Euclidean distance between RGB values. A higher K leads to more detailed results.
Mean Shift: A hill climbing algorithm to iteratively find local maxima. The kernel size controls the sensitivity to smaller modes. The least two significant bits are dropped from each color component.
Split & Merge: A two stage algorithm to split an image into homogenous regions (by subdividing nonhomogeneous blocks into quadrants) and then merge similar neighboring blocks into groups. The tolerance controls the threshold at which blocks are deemed homogenous.
Balanced Histogram Thresholding: An automatic thresholding method that divides the color space by finding the midpoint of an RGB histogram.