[gdal-dev] Heuristics to classify raster data ?

Joaquim Luis jluis at ualg.pt
Fri Mar 7 17:22:42 PST 2014


> Hum, I read a bit http://en.wikipedia.org/wiki/K-means_clustering and not
> being familiar with it, it is not obvious how that could lead to the binary
> result I expect ;-) I was hoping for a ready-made solution for my problem. I'm
> kind of demanding tonight ;-)

Well, too late for tonight.

I guessed you would want a ready-to-use solution but what I can offer is 
only my Mirone (and actually not mine originally) solution but I know 
that's not what you need. But still, if you want to make a Windows 
detour an play with the  "Image -> k-means classification" you can see 
it action and it's quite instructive.
Apparently the strategy I had in mind is a bit different from 
Dimitriy's. My idea, driven by how it works in Mirone, is that you can 
select in advance the number of clusters, and get them. So you can 
analyze later their degree of uniformity. A map is expected to have few 
well distinct classes so if you ask for, let's say 5 or 6, each one of 
the will be rather coherent, with a low cluster variance (a measure of 
the spreading about the cluster center). An image, on the other hand is 
expected to have a high variance if one only allow a few clusters (the 5 
or 6 above).

Maybe this code can be of use for you. I never tested it but it's a C 
code with Matlab wrap functions to interface with it (a MEX), and the 
guy is good programmer.

http://www.mathworks.com/matlabcentral/fileexchange/33541-fast-k-means-clustering

Joaquim




More information about the gdal-dev mailing list