Wolfram mathematica Mathematica中二维图的聚类

Wolfram mathematica Mathematica中二维图的聚类,wolfram-mathematica,cluster-analysis,Wolfram Mathematica,Cluster Analysis,我想找到一种方法来集群这些磁盘,因为它们彼此接近。 Mathematica有内置功能来做这样的事情吗 编辑 在尝试FindCluster时,我遇到了一些不便: 与: laListe={{{{10, 17}, 1}, {{33, 12}, 1}, {{32, 17}, 1}, {{9, 10},1}, {{22, 24}, 1},{{27, 6}, 2}, {{25, 13}, 2}, {{30, 9}, 2}}, {{{14, 12}, 1},{{19,

我想找到一种方法来集群这些磁盘,因为它们彼此接近。 Mathematica有内置功能来做这样的事情吗

编辑

在尝试FindCluster时,我遇到了一些不便:

与:

laListe={{{{10, 17}, 1}, {{33, 12}, 1}, {{32, 17}, 1}, {{9, 10},1}, 
         {{22, 24}, 1},{{27, 6}, 2}, {{25, 13}, 2}, {{30, 9}, 2}}, 
         {{{14, 12}, 1},{{19, 17}, 1}, {{7, 21}, 1}, {{7, 24},1}, 
         {{27, 19}, 1}, {{12, 16}, 2}, {{13, 20}, 2}, {{20, 22}, 2}}}

FrameXYs = {{4.32, 3.23}, {35.68, 26.75}}


Row[Function[compNo, 
             Graphics[{White, EdgeForm[Thick], 
             Rectangle @@ FrameXYs, 
             Black, 
             Disk[Sequence @@ laListe[[compNo, #]]] & /@ 
             Range[Length@laListe[[compNo]]]}, ImageSize -> 300]] /@ 
             {1, 2}]
FindClusters是否不使用小数:

list1={{{24.413, 6.5978}, {7.68887, 7.2147}, {29.357, 13.2822}, 
       {6.22436, 9.7145}, {22.7162, 17.7198}, {13.6851, 5.7635}, 
       {18.8062, 12.9946}, {8.04889, 16.7414}}}
输出:

鉴于:

  {{{{24.413, 6.5978}, {7.68887, 7.2147}, {29.357, 13.2822}, 
     {6.22436,9.7145}, {22.7162, 17.7198}, {13.6851, 5.7635}, 
     {18.8062,12.9946}, {8.04889, 16.7414}}}}
输出:

  FindClusters[Flatten[Round[list1], 1]]
然后,为了做到这一点,我必须去掉磁盘直径,这对我来说是非常重要的视觉集群。 然后我想捕捉对齐。当5个磁盘未分组但对齐时。当我在几篇文章中进行测试时,并没有发现这样的东西

我正在尝试的一件事是使用以下方法“点化”磁盘:

   {{{24, 7}, {29, 13}, {23, 18}, {14, 6}, {19, 13}}, 
    {{8, 7}, {6, 10}, {8, 17}}}
我最初用它来计算这些磁盘的面积。我觉得这可能有助于满足我的需要,以适应半径,但实施是棘手的,我甚至不知道它是否相关

另外,我希望这只是小数的问题,但我不能使用FindClusters[list],而是必须给它我想要的群集数FindClusters[list,3],而我想要的是有相同的算法,可以在不同的组合上找到不同的群集数

您会考虑使用FindClusters进行特定设置和/或距离函数吗

编辑

我发现了一些有趣的东西,多亏了之前的技巧,多亏了这里的专家。只是一个想法,我需要找到一种量化的方法,并将新图像以矩阵形式或其他形式使用

pointize[{{x_,y_},r_},size_:12] :=
                                  Table[{x+r Cos[i ((2\[Pi])/size)],
                                  y+r Sin[i ((2\[Pi])/size)]},{i,0,size}]

是的,你应该做你想做的事。
有一个问题。您可能需要将数据展平为一个
n
乘以3的矩阵。

或者,您可以使用以下方法:

     Binarize[ImageCorrelate[comp1, GaussianMatrix[40]], .95]

您也可以使用
膨胀
,这取决于您想要的区域类型

Table[Colorize[
  MorphologicalComponents[Blur[ColorNegate@comp1, i], .05]], {i, 1, 60, 10}]

顺便说一句,这里有一种使用
FindClusters
的方法,效率不高,可能会产生非直观的结果:

Table[Colorize@
  MorphologicalComponents@Dilation[ColorNegate@comp1, DiskMatrix@i], {i,1,60,10}]

编辑

您可能可以管理
FindClusters
选项以获得更好的结果。例如:

ImageRotate[Rasterize[
  Show[
    ListPlot@
    FindClusters[Position[ImageData@Binarize@ColorNegate@comp1, 1, {2}], 3],
  Axes -> False, AspectRatio -> Automatic]], 3 Pi/2]

从这里,你也可以看到凸面外壳:

ImageRotate[Rasterize[Show[
   ListPlot@
    FindClusters[
     Position[ImageData@Binarize@Rasterize[ColorNegate@comp1, RasterSize -> 200], 
     1, {2}], 
    3, Method -> {"Agglomerate", "Linkage" -> "Complete"}], 
   Axes -> False, AspectRatio -> Automatic]], 3 Pi/2]
200],
1, {2}], 
3、方法->{“凝聚”,“连接”->“完整”}];
ImageRotate[图形[多边形(#[[ConvexHull[#]])和/@fc,帧->真],3π/2]

看到我的答案了吗?我不明白为什么要去掉气泡直径——它实际上是你的三维空间,不是吗?此外,您不必指定要查找的群集数。你最近对高斯斑点的编辑很酷,但我认为这是一个单独的问题。Verbeia,我想我在查找群集方面不灵活,我想我不能在其中包含我的三维(半径),我会更加努力。非常感谢belisarius!最后一个正是我正在计算的。就像巫师先生和尤达一样,我不知道你在做什么,但每次都很神奇+1使用基础Mathematica系统的这么多不同部分来实现一个非常棒的完整实现。@Verbeia这正是我觉得使用Mma非常有趣的原因
ImageRotate[Rasterize[
  Show[
    ListPlot@
    FindClusters[Position[ImageData@Binarize@ColorNegate@comp1, 1, {2}], 3],
  Axes -> False, AspectRatio -> Automatic]], 3 Pi/2]
ImageRotate[Rasterize[Show[
   ListPlot@
    FindClusters[
     Position[ImageData@Binarize@Rasterize[ColorNegate@comp1, RasterSize -> 200], 
     1, {2}], 
    3, Method -> {"Agglomerate", "Linkage" -> "Complete"}], 
   Axes -> False, AspectRatio -> Automatic]], 3 Pi/2]
<< ComputationalGeometry`
fc = FindClusters[
       Position[
         ImageData@Binarize@
            Rasterize[ColorNegate@comp1, RasterSize -> 200], 
       1, {2}], 
     3, Method -> {"Agglomerate", "Linkage" -> "Complete"}];
ImageRotate[Graphics[Polygon@(#[[ConvexHull[#]]]) & /@ fc, Frame->True], 3 Pi/2]