# How can I quantify how 'evenly distributed' a given set of points are in a 2D plane?

I am working on an estimation problem involving cameras, where the quality of a location of the camera is quantified by multiple factors: such as how many feature points (salient features in a given image) are visible in its field of view, as well as how evenly distributed they are in that space. The points are defined by their 2D coordinates in the image plane and then the challenge is to come up with a parameter that determines how evenly they're distributed throughout the image plane. The dimensions of the image are known.

If 100 points are visible in the image but if they're all in a straight line, or grouped together in a corner, it's not a very good set, but if they're distributed evenly like a checkered pattern, it's perfect. What is a good way to define a parameter for this? The first thing I thought about was a Voronoi diagram, which would intuitively (visually) inform me of the distribution but I am having trouble actually quantifying it as a number that I can pass to my algorithm.

At the end, I am looking for a number that quantifies this 'quality of distribution' of points, which will then be passed to an optimization pipeline that attempts to pick better viewpoints by minimizing (or maximizing) this number.

• – Aretino Feb 9 '17 at 20:26
• As in taking the X, Y, Z coordinates for all points separately and checking how 'high' the SD is in all dimensions? – HighVoltage Feb 9 '17 at 20:31
• No, only the projection of points on the camera plane. – Aretino Feb 9 '17 at 20:33
• The Voronoi diagram sounds like a good approach; the statistics of the nearest-neighbour link lengths should be indicative. The possibility of getting the point in a straight line might mean you need another test too. – Joffan Feb 9 '17 at 23:32

## 1 Answer

Perhaps overlay a grid on the image, count the number of points in each cell and calculate the variance of that statistic. You can experiment with the number of cells.

One question. Does evenly distributed points of interest mean a good image or a bad one? I would suspect neither as an aesthetic criterion.

• I've considered that option, which is basically image binning. One problem that comes to mind is that, because this is an optimization problem, I would have to evaluate numerous 'samples', which means performing this counting some thousands of times and that seems too intensive. I am going to try and benchmark it anyway: but I wonder if there's a way to make the bin counting more efficient, instead of exhaustively searching through the points? And to answer your question, evenly distributed points = good image. – HighVoltage Nov 4 '18 at 17:16
• Presumably you have to identify the points. So you could bin them as you find them. That saves a loop when you're done. – Ethan Bolker Nov 4 '18 at 19:46
• In what way is 2d binning "too intensive"? It is a standard technique and there should be very efficient implementations. You should clearly state whether you would like to have a "proper" solution, such as binning and doing a statistical test or whether you need something lightning quick implemented in Assembler and are willing to settle for some approximations. – g g Nov 6 '18 at 18:30