I made a Kmeans cluster and discovered cluster centers using the OpenCV C ++ API.
kmeans(data_points, clusterCount, labels, TermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 10, 1.0), 3, KMEANS_PP_CENTERS, cluster_centers);
Then I use the Euclidean distance to find the closest cluster for a new data point for all cluster centers .
int distance = find_EucledianDist(new_datapoint, cluster_centers);
How to use Mahalanobis Distance instead of Euclidean Distance ? I know that I need to calculate the covariance matrix and invert it and find the Mahalanobis distance.
However, I donβt know how I do it and in which ORDER (find the Kova matrix, the inverted matrix from which the data / matrix is)?
garak source share