使用2D tilemap中的散点列表,我如何找到这些点的中心?(Using list of scattered points in 2D tilemap, how would I find the c

编程入门 行业动态 更新时间:2024-10-23 23:34:30
使用2D tilemap中的散点列表,我如何找到这些点的中心?(Using list of scattered points in 2D tilemap, how would I find the center of those points?)

例如,看一下这个图像(只是图像搜索中散乱点的随机图像):

( 参考 )

你会看到有蓝点的位置。 让我们说蓝色代表我正在寻找的东西。 但我想找到最蓝的坐标。 意味着最密集或大多数点的中心(在图片中,它将近似[.5,.5])。

如果我有一个每个蓝点(x,y坐标)的arrayList,那么如何使用这些点来找到这些点的中心/最密集区域?

Have a look at this image for example (just a random image of scattered points from image search):

(reference)

You'll see the locations with blue points. Let's say the blue represents what I'm looking for. But I want to find the coordinates where there is the most blue. Meaning the most dense or center of most points (in the picture, it would approximate [.5, .5]).

If I have an arrayList of each and every blue point (x,y coordinates), then how do I use those points to find the center/most dense area of those points?

最满意答案

有几种选择,取决于您需要什么。 最简单的是平均值,所有点的平均值 :您将所有点加起来并除以它们的数字。 获得最密集的区域很复杂,因为首先你必须提出“密集”的定义。 一种选择是:对于每个点P,找到7个最近邻居N_P1 ... N_P7。 第7个邻居具有最小距离的点P | P-N_P7 | 是它周围密度最高的点,你选择P作为中心。 您可以使用任何适合您的号码替换7。 您甚至可以用数据集中的某个参数替换它,比如总点数的1/3。

There are several options, dependent on what precisely you need. The simplest would be the mean, the average of all points: You sum all points up and divide by their number. Getting the most dense area is complicated, because at first you have to come up with a definition of "dense". One option would be: For each point P, find the 7 nearest neighbors N_P1...N_P7. The point P where the 7th neighbor has the smallest distance |P-N_P7| is the point with the highest density around it and you pick P as center. You can replace that 7 with any number that works for you. You could even replace it with some parameter from your data set, say 1/3 of the total number of points.

更多推荐

本文发布于:2023-08-01 03:33:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1354001.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:列表   中心   list   tilemap   find

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!