Closest point to a given point

前端 未结 8 2493
终归单人心
终归单人心 2020-11-30 03:22

I have a set K of randomly selected pixels in a 2D image. For every other pixel in the image I need to find out which pixel in set K is closest to it (using the standard sqr

8条回答
  •  醉酒成梦
    2020-11-30 03:54

    Put the points in a KD tree, after this it's very fast to find the nearest neighbor. See this article on wikipedia for details.

提交回复
热议问题