Calculate median value.
Namespace:
AForge.MathAssembly: AForge.Math (in AForge.Math.dll) Version: 2.2.5.0 (2.2.5.0)
Syntax
Parameters
- values
- Type: array<
System..::.Int32
>[]()[]
Histogram array.
Return Value
Returns value of median.
Remarks
The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

Sample usage:

// create histogram array int[] histogram = new int[] { 1, 1, 2, 3, 6, 8, 11, 12, 7, 3 }; // calculate median value int median = Statistics.Median( histogram ); // output it (6) Console.WriteLine( "median = " + median );