How can k-means be applied here?

2 views (last 30 days)
joy
joy on 10 Aug 2014
Commented: Image Analyst on 11 Aug 2014
Hi,
Let me share my problem
I have few rectangular shapes boxes with specific height and width. Now, I have to cluster them so that the similar size boxes could be in one cluster and different size boxes shall be in another cluster. Now, if the longer side of a rectangle ( width or height) or the area s widely varies then boxes shall be dissimilar.
suppose I have a box with dimension ( 4*1) (width * height) and another box (1*4) (width * height), now both of them have same area but they have to be in different cluster. Now, if I am given a set of rectangle with (width * height) how can I apply k-means to them to clusterize, there are my doubts?
any approach from where I can start ?
regards

Answers (1)

Image Analyst
Image Analyst on 10 Aug 2014
I don't think kmeans can work with your boxes. Plus even if you manually scan your scatterplot looking for max values in your box, so that you can determine it's location, it depends on the order you use your boxes, like whether you do three 4*1 first then two 1*4 or vice versa.
If you have a lot of scatterpoints, you can turn it into an image and use quad tree decomposition, qtdecomp() in the Image Processing Toolbox:
  4 Comments
joy
joy on 11 Aug 2014
along x axis I can plot the ratio of (shorter side/longer side) of all given rectangles, in y axis I can plot the area of all given rectangles, then the generated scatterplot can be used for clustering?
any views on this? is this could be an approach?
Image Analyst
Image Analyst on 11 Aug 2014
I don't have the stats toolbox so I can't try kmeans. If you don't know the number of clusters, try one of the machine learning methods listed here: http://www.mathworks.com/machine-learning/index.html

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!