http://www.emgu.com
Implements k-means algorithm that finds centers of cluster_count clusters and groups the input samples around the clusters. On output labels(i) contains a cluster index for sample stored in the i-th row of samples matrix
Namespace:
Emgu.CV
Assembly:
Emgu.CV.World (in Emgu.CV.World.dll) Version: 4.1.1.3497 (4.1.1.3497)
Syntaxpublic static double Kmeans(
IInputArray data,
int k,
IOutputArray bestLabels,
MCvTermCriteria termcrit,
int attempts,
KMeansInitType flags,
IOutputArray centers = null
)
Public Shared Function Kmeans (
data As IInputArray,
k As Integer,
bestLabels As IOutputArray,
termcrit As MCvTermCriteria,
attempts As Integer,
flags As KMeansInitType,
Optional centers As IOutputArray = Nothing
) As Double
public:
static double Kmeans(
IInputArray^ data,
int k,
IOutputArray^ bestLabels,
MCvTermCriteria termcrit,
int attempts,
KMeansInitType flags,
IOutputArray^ centers = nullptr
)
static member Kmeans :
data : IInputArray *
k : int *
bestLabels : IOutputArray *
termcrit : MCvTermCriteria *
attempts : int *
flags : KMeansInitType *
?centers : IOutputArray
(* Defaults:
let _centers = defaultArg centers null
*)
-> float
Parameters
- data
- Type: Emgu.CVIInputArray
Floating-point matrix of input samples, one row per sample - k
- Type: SystemInt32
Number of clusters to split the set by. - bestLabels
- Type: Emgu.CVIOutputArray
Output integer vector storing cluster indices for every sample - termcrit
- Type: Emgu.CV.StructureMCvTermCriteria
Specifies maximum number of iterations and/or accuracy (distance the centers move by between the subsequent iterations) - attempts
- Type: SystemInt32
The number of attempts. Use 2 if not sure - flags
- Type: Emgu.CV.CvEnumKMeansInitType
Flags, use 0 if not sure - centers (Optional)
- Type: Emgu.CVIOutputArray
Pointer to array of centers, use IntPtr.Zero if not sure
Return Value
Type:
DoubleThe function returns the compactness measure. The best (minimum) value is chosen and the corresponding labels and the compactness value are returned by the function.
See Also