本文介绍了2D列表中的聚类上的边界框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有


ex:x = [[1,1,1,0,0,0,0,0,0,0,0,1,1, 1,1,0,0,0],

[1,1,1,0,1,1,0,0,0,0,0,1,1,1,1, 0,0,0],

[1,1,1,0,1,1,1,0,1,1,0,1,1,1,0,0,0, 0],

[0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0]]

我想要的是一个边界框,我们在这个区域找到了

1'的集群。所以例如在上面的列表中,前3个roes和colums有1'' s

所以那个盒子的面积是3x3

所以我的最后一个阵列应该有一个大约的区域阵列

1''像

area = [9,4 ....]

希望我对我的问题很清楚。

解决方案




不清楚是否群集必须是矩形并填充他们的边界框

或是否


[[0,0,0,0,0],

+ ----- +

[0,| 1,1,| 0,0],

| |

[0,| 0,1,| 0,0],

+ ----- +

[0,0 ,0,0,0]]


是一个有三个1'的集群。或者实际上是否是边界框。必须是矩形的。

即,对角线簇怎么样?

,__,

[[0,0,| 1,| 0 ,0],

_ / _ /,__,

[0,/ 1,/ 0,0,| 1],

_ / _ / _ / /

[1,/ 0,0,/ 1,/ 0],

_ / /

[ 0,0,/ 1,/ 0,0]]


或者应该是

+ ------------ - +

[[| 0,0,1,0,0 |],

| |

[| 0,1,0,0,1 |],

| |

[| 1,0,0,1,0 |],

| |

[| 0,0,1,0,0 |]]

+ ------------- +


因为长度为3对角线的两个3x3正方形会重叠。


问候,

Bengt Richter



If I have

ex: x = [[1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0],
[1,1,1,0,1,1,0,0,0,0,0,1,1,1,1,0,0,0],
[1,1,1,0,1,1,1,0,1,1,0,1,1,1,0,0,0,0],
[0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0]]
what I want is a boundingbox over the region where we find clusters of
1''s.So for instance in the above list first 3 roes and colums have 1''s
so the area of that box is 3x3
so my final array should have an array of approx areas of clusters of
1''s like
area = [ 9,4 ....]
Hope I am clear with my question.

解决方案



Not quite clear on if "clusters" have to be rectangular and fill their bounding boxes
or whether

[[0, 0, 0, 0, 0],
+-----+
[0,|1, 1,|0, 0],
| |
[0,|0, 1,|0, 0],
+-----+
[0, 0, 0, 0, 0]]

is a cluster with three 1''s. Or indeed whether "bounding boxes" have to be rectangular.
I.e., what about diagonal clusters?
,__,
[[0, 0,|1,|0, 0],
_/ _/ ,__,
[0,/1,/0, 0,|1],
_/ _/ _/ /
[1,/0, 0,/1,/0],
_/ /
[0, 0,/1,/0, 0]]

Or should that be
+-------------+
[[|0, 0, 1, 0, 0|],
| |
[|0, 1, 0, 0, 1|],
| |
[|1, 0, 0, 1, 0|],
| |
[|0, 0, 1, 0, 0|]]
+-------------+

since two 3x3 squares around the length-3 diagonals would overlap.

Regards,
Bengt Richter



这篇关于2D列表中的聚类上的边界框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 08:06