

Ask HN: How do I count people with computer vision? - pastaking

I'd like to build an app to count the number of customers in a store through a phone's camera. How would I go about doing this?
======
nonamegiven
"in a store through a phone's camera."

If it was _for_ the store then you'd do one or more stationary mounts of
something better and more purpose-built than a camera phone. Or something even
simpler like counting bodies in and out at the door with the door dinger
thing.

So I assume it's for surveilling the store surreptitiously, right?

I suppose it's an interesting problem for the machine vision people. But how
do you deal with people down the aisles that you can't see? How do you avoid
looking like you're collecting upskirts or kiddie porn? How do you avoid just
plain getting your face punched in?

Is there a way to count cell phone signals, from your own phone or from
special equipment? There were stories a year or so ago about some mall that
was going to track individual phones through the mall, to discern shopping
patterns and such. I imagine it's not impossible to create something that you
could use surreptitiously (again, I'm assuming).

------
logn
Well, you probably don't mean you can set up a stationary camera as if so then
you could just install some sensor at the door or a foot pad.

But if you could mount a phone...

Maybe some technique where you take a baseline photo with the store empty and
then compare that to ones with people in it. You'd have to account for natural
changes in light and ignore that in the algorithm. Shadows and bags would be
difficult. Then count the number of changed pixels from baseline, the average
number of pixels representing a person, and some sort of edge detection for
added checking.

Or, a mechanical turk worker would solve this in a few seconds for probably a
penny.

------
yid
Assuming your phone/camera is mounted in a stationary position, you could
track all the moving objects _fairly_ easily with background subtraction. I
say "fairly" because you'd likely have to incorporate motion, color and
texture detection to disambiguate between different people. A count of the
moving blobs would give you a rough number of the people in a store. It would
be an instantaneous count, so you'd probably have to take a moving average of
the time series of the number of people detected to get a reasonably accurate
value. Non-trivial, but doable.

~~~
manglav
This only works when people are separate enough so they have an individual
silhouette. If doing length of line tracking however, it becomes much more
tedious, with edge detection necessary and such. Also, if using a 360 camera,
this becomes more complex, as a person in the middle blob shape would be
completely different from a person at the edge. I am aware you can use a
filter, but it cuts out some area sometimes.

This is a surprisingly hard problem that I've explored before. Feel free to
email me about it!

------
soneca
I thought this was finally a joke on HN

Q: How do I count people with computer vision?

A: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz ...

------
Visualsoulone
I think some sort of Camera to radio detection system, chances are every
person carries a phone and then synchronize them to count matching parameters
(if the image is moving radio field will change)

