How to find distance between each person in a large population(any component)?

An interesting problem which I feel is wildly beyond the scope of an arduino. (OR A PI)

Lets make it easy and suppose you are assessing the mean population density in a sensibly closed environment. (ie with few entrance/exit points)

Then you can evaluate the number inside by sensing who is going in and out. Seperate the exits from the entrances and you can count them with a sensor.

The mean pop density is then number inside / floor area.

Of course that doesnt tell you how they are clumping once inside.

Perhaps you could use a thermal imaging camera and software (on a PC) to assess that.