 # Analyze blob statistics

Calulates histograms of blobs in a gray scale image. The blobs are marked with labels given in the labeled image input. Calculates also statistical features from the histograms.

## Inputs

image
Input image.
labels
A labeled image which is typically created from the input image with DetectBlobsTool. Each connected blob in the output image is marked with a distinct numeric label. Pixels that belong to the first detected blob are ones, the pixels that belong to the second one with twos and so on. Background is zero.

## Outputs

histogram
A M-by-N matrix of histograms. M is the number of blobs and N is the maximum number of gray levels in the input image. M depends on the dynamic scale of the input image, but is always at least 256. Each contains a histogram calculated from those pixels in the input image which coincide with the corresponding label in the label image.
first
The index of the first non-zero value in the histogram. -1 if all values are zeros, otherwise the value is on range 0...N-1. A M-by-1 matrix.
last
The index of the last non-zero value in the histogram. -1 if all values are zeros, otherwise the value is on range 0...N-1. A M-by-1 matrix.
range
last - first + 1, or zero if the histogram is all zeros. A M-by-1 matrix.
sum
Sum of all entries in the histogram. A M-by-1 matrix.
mean
Mean of the dataset from which the histogram was calculated. A M-by-1 matrix.
weightedSum
Sum of all entries in the histogram weighted by the index of each entry. Computed as sum * mean. A M-by-1 matrix.
minIndex
The index of the minimum value. If there are many indices with the same value, this is the first one. A M-by-1 matrix.
maxIndex
The index of the maximum value. If there are many indices with the same value, this is the first one. A M-by-1 matrix.
variance
Variance of the dataset from which the histogram was calculated. A M-by-1 matrix.
stdDev
Standard deviation of the dataset from which the histogram was calculated. Computed as square root of variance. A M-by-1 matrix.
stdMean
Mean deviation of the dataset from which the histogram was calculated. Computed as average of absolute differences to the mean value. A M-by-1 matrix.
median
Median of the dataset from which the histogram was calculated. A M-by-1 matrix.
skewness
Skewness of the dataset from which the histogram was calculated. A M-by-1 matrix.
kurtosis
Kurtosis of the dataset from which the histogram was calculated. A M-by-1 matrix.