I am using the image below.
I want to run a simple
ClusteringComponents, using the
KMeans method and
DistanceFunction. Just to make sure there is no problem with the implementation of
ClusteringComponents with images, I use the data of the Image and operate on the second level of the list obtained via
ImageData. So my call to
ClusteringComponents looks like this:
ClusteringComponents[ ImageData[ImageResize[image, 500, Resampling -> "NearestLeft"]], 4, 2, Method -> "KMeans", DistanceFunction -> EuclideanDistance] // Colorize
image being the image below and the
ImageResize is just here for reference, because the resolution in x-direction should already be 500. The result is not what I expect and what it should be when using
And here comes the surprising right result: As the
KMeans-algorithm should be invariant under duplication operation, i.e. just instering every entry multiple times, the following code (which is due to
Resampling->"NearestLeft" just inserting every entry 4 times) should give the same result as the code before just with twice the resolution:
ClusteringComponents[ ImageData[ImageResize[image, 1000, Resampling -> "NearestLeft"]], 4, 2, Method -> "KMeans", DistanceFunction -> EuclideanDistance] // Colorize
At least on my Mac (Mac OS X Mavericks, Mathematica 10.0.0) the results are surprisingly not the same, the second piece of code yielding the "right" result, while the first one is not. Am I missing something or is this a bug?