0
$\begingroup$

I have relatively uniformly colored images and I extracted colors using k-means. k means 1 showed the best results for my modeling purposes, k means 2 not so much, and with k-means 3 there ceased to be differences between some channels of samples.

Is this a reasonable approach and is it technically different from calculating the mean of all pixels in the image.

Can it be said that I took the mean of all pixels if the result is the same?

$\endgroup$

1 Answer 1

0
$\begingroup$

Welcome to CrossValidated! If when you say "k-means 1" you mean a k-mean algorithm with only 1 cluster, then I think the centers of the cluster are represented by the multivariate mean vector, i.e. the vector that contains the mean of all the variables you input in the k-means.

See below, the centers of the kmeans() function are equal to the means of the two variables:

set.seed(123)
x <- rbind(matrix(rnorm(100, sd = 0.3), ncol = 2),
           matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2))
colnames(x) <- c("x", "y")
cl <- kmeans(x, 1)


mean(x[,1]);mean(x[,2])
cl$centers
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.