例如,看一下这个图像(只是图像搜索中散乱点的随机图像):
( 参考 )
你会看到有蓝点的位置。 让我们说蓝色代表我正在寻找的东西。 但我想找到最蓝的坐标。 意味着最密集或大多数点的中心(在图片中,它将近似[.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.
更多推荐
发布评论