Shop OBEX P1 Docs P2 Docs Learn Events
Propeller People Counter Idea — Parallax Forums

Propeller People Counter Idea

SRLMSRLM Posts: 5,045
edited 2008-08-19 04:21 in Propeller 1
Hi. I am volunteering at an organization that is soon to host a large event. For this event, the fire marshal requires that a guest count of all admitted guests is kept in order to facilitate the safe evacuation of everybody if necessary. The main host man of this event mentioned to us volunteers that he had considered an electronic system, but found it too expensive. Instead, there will be about 20 people at any one time counting people with a hand clicker. I thought that by using·a Propeller this could be done both electronically and cheap. Here are the requirements:

There is estimated to be about 400,000 people attending the festival.
The system needs to monitor people going in and out at two gates, and exclusively out at two more
The system needs to be cheap

Other than that, the design criteria is fairly wide open. Any suggestion about how to go through with this? At this point, it is just a thought exercise, but if done soon enough I can probably get them on board for the electronic solution...

Post Edited (SRLM) : 8/2/2008 9:12:28 PM GMT
«1

Comments

  • LeonLeon Posts: 7,620
    edited 2008-08-02 20:48
    I designed the first version of their people counter when I worked for Irisys some years ago:

    www.irisys.co.uk

    It uses their own 16x16 IR sensor array with a DSP running the image processing software which is based on a Kalman filter.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle

    Post Edited (Leon) : 8/2/2008 8:56:23 PM GMT
  • SRLMSRLM Posts: 5,045
    edited 2008-08-02 21:05
    I should mention that this is for use in San Diego, CA, where local temperatures are expected to rise to the 90's. From the looks of their site, Irisys uses the heat profile of people to do the counting. However, I don't think that I have that kind of precision in any such reading when the differnce in temperatures is only a couple of degrees. Something to consider, though.
  • hippyhippy Posts: 1,981
    edited 2008-08-02 23:50
    Simplest and cheapest solution would be volunteers with clickers.

    If the event is soon I don't see how you're going to develop a comprehensive and proven body counting system from scratch. Simple things like break-beam detectors won't work unless you can stream people one at a time, and even then aren't perfect. Unless you've done extensive testing you ( and more particularly, organisers and event licence holders ) are putting trust in something which might not be reliable or could fail in some spectacular way.

    If you can stream people individually you could perhaps install turnstiles with counters. A lot may depend on what entry and exit rates you need to support, restricting flow can create more problems than it solves. If guests arrive over a two hour period spread across two gates you'll be counting in around 30 per second per gate. Even spread uniformly over two days that's one every second.

    I've never dealt with any festivals of this scale so it's outside my experience.
  • SRLMSRLM Posts: 5,045
    edited 2008-08-03 03:47
    Unless there is some brilliantly simple solution, it is unlikely that anything will be done this year. (However, there may be a second chance.) Still, the people counting is a difficult task. Leon got me thinking: What are the unique properties of the human body that we can exploit? He mentioned infrared heat signatures, but the ambient head would make it very difficult. Humans do not have a magnetic field, and their resonant frequency is 5 - 10 Hz. Probably can't use their sound to identify them, since there are so many. I know, some of these are far fetched (some are really out there...)
    Note that the event is over five days for ten hours per day, so thats 4,000 people per gate per hour, or roughly 1 person per second per gate.

    The best sensor that I come up with so far (besides a single funnel with a turnstile) is a series of plates accrosss the walking width, each plate would have a dimension of about 4" x 2', and to deal with the high volume there would have to be turnstile towers without the actual turnstiles. Each plate is a switch. The propeller could then read the order of the plates being pushed, and infer a person from the "footprint". This beats infrared beams since people can walk close together but still be distinguished. This is because one person's footprint will never be exacltly the same as anothers at any one moment of time due to the physics of the thing.

    Although a footprint reader would be tough to build, I think that it would do the job. Comments?
  • VIRANDVIRAND Posts: 656
    edited 2008-08-03 04:38
    I agree with hippy, the turnstile is simple and reliable.
    Many cities use them with train tickets to count one person per ticket getting on the train
    and also count them again when they arrive at a destination station and exit the transit system.

    The turnstile can easily have an event counter which often looks like a vehicle odometer,
    and can be triggered most simply by:
    -a microswitch pushed by bumps on the turnstile rotor for electromechanical event counter or LCD "totalizer"
    -a mechanical lever on mechanical counter pushed by bumps on the turnstile rotor. This option requires no electricity.
  • hippyhippy Posts: 1,981
    edited 2008-08-03 07:36
    40,000 per gate per day is more manageable but there will still probably be peaks of high inflow, but that then comes down to having enough channels to get people through at a fast enough rate.

    I'm not convinced about the foot-step reader because I'm not sure how that would perform in practice, especially if there is bunching of people. You're back to similar problems as IR beams and if people are bunching, they walk slower, take smaller steps and you could register multiple steps as unique individuals. It would be interesting to try it though.

    While there was some doubt about IR sensing being usable, what about overhead CCTV and motion tracking - genuine head count smile.gif I don't know what the state of play is there and it's probably more a PC rather than Propeller proposition.
  • PhilldapillPhilldapill Posts: 1,283
    edited 2008-08-03 09:46
    I find it funny that we have this amazing chip and all sorts of new technology, but the more I think about it, the more convinced I am that the simple and same old same old turnstile works the best. It may be a little slower, but it will always be spot on(except for those few clowns jumping over it). Any other technical approach seems it would be too inaccurate.

    However, I really like your footprint idea. You could possibly do this with a single plate with a sensor mounted underneath. Just position it and peripheral "obstacles" in a way that a single foot, and no more, would hit it each time a person enters/exits.
  • ColeyColey Posts: 1,110
    edited 2008-08-03 10:23
    I have used Motion Bar in 'virtual' turnstiles.

    I'm sure you could employ a prop to carry out the same principal, and will give you both in and out sensing.

    Of course it is limited, we use it in in doorways where you are not likely to get two people side by side but it works well and stops 'tailgating'

    Regards,

    Coley

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PropGFX Forums - The home of the Hybrid Development System and PropGFX Lite
  • DroneDrone Posts: 433
    edited 2008-08-04 06:37
    Frames that pass one person at a time equipped with down-looking passive infrared detectors (PIRs) fastened to the top of the frame (see Parallax part-number 555-28027). Put blinders on the PIRs to limit the field of view to the frame area only. Usually PIRs have integration time built-in, try to find one where it's adjustable or where there's little or no integration - so you can add integration in software.

    40,000 persons arrive in one hour. 2 persons per second per frame. You need six frames (he he, one frame per cog). However, frames like turnstiles are often not allowed as they hamper egress during fire/emergency. Make the frames easily removable.

    Test well and demonstrate to the Fire Marshall getting him/her to sign off (yeah-right). Buy lots of insurance and don't let any lawyers in.

    Good Luck, Dave
  • rjo_rjo_ Posts: 1,825
    edited 2008-08-04 07:11
    When you say two gates... these would be large open gates allowing multiple people to enter and leave at the same time... so you have two problems... counting people and figuring out which direction they are going. That's not so trivial. You could use an optical flow algorithm... but that would mean that the Prop-camera guys would have to come up with a nifty camera... which is just around the corner. In lieu of this, an array of force sensors embedded in the pathway(a carpet-like escarpment)... might just get you where you want to go.

    When we aren't impeded our strides and weights distinguish us to a great extent, from which our direction and head counts could be derived. When we are impeded our weight and position would distinguish us.

    You will have to get some agreement on how much error is acceptable...

    There is something almost mystical about using gobs of sensors... people will love it.
  • SRLMSRLM Posts: 5,045
    edited 2008-08-04 15:26
    Personally, I like the camera and headcounting idea, at least as far theory goes. If the ground was a contrant color (or even better, a pattern like a grid), I think it would be possible for some program to distinguish a blob moving in one dirrection or another, then track it. Unfortunately, I don't think that the Propeller can do this sort of image proccessing, so it would have to be a full size computer, and I have no experience in that realm.

    As for people dirrection, it would be okay to split in from out in a keep to the right rule. So any counter would simply have to count, not distinguish dirrection.

    As for infrared, it might work if I single out people (turnstileless passages). I had a look at the Parallax sensor, and on the external site that they give a link to the tester mentioned that it took several seconds to transition to low after motion has ceased. This obviously won't work for the high capacity that is needed. However, at http://www.futurlec.com/PIR_Sensors.shtml they offer just the sensor bits. There modules also have a delay, so I'm betting that this is put in by the software that comes in a complete setup. So if I were to get just the module to use with the propeller, then I should be safe in that regard. It looks like I would have to put in a digital converter.

    Oh, and thanks for considering the fire issues. I for the physical plant, I was thinking of 3 foot tall dividers that are about 2 feet long and 6 inches wide. Whatever electroncs that are used would be put facing sideways. I'll check to see if this would be an issue.
  • LeonLeon Posts: 7,620
    edited 2008-08-04 18:12
    SRLM said...
    Personally, I like the camera and headcounting idea, at least as far theory goes. If the ground was a contrant color (or even better, a pattern like a grid), I think it would be possible for some program to distinguish a blob moving in one dirrection or another, then track it. Unfortunately, I don't think that the Propeller can do this sort of image proccessing, so it would have to be a full size computer, and I have no experience in that realm.

    That's basically how the Irisys people counter works. The software identifies people and then tracks them through consecutive frames. It uses a 500 MIPS Blackfin DSP, but the original system I worked on managed very well with a 33 MIPS DSP. Software development took several man years of work, just porting it to the DSP took me six months.

    The system is far cheaper than a video system, of course, and isn't dependent on lighting conditions. It's widely used in supermarkets and shopping malls, worldwide. It would be worth asking Irisys about performance in high ambient temperatures.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle

    Post Edited (Leon) : 8/4/2008 6:22:54 PM GMT
  • jazzedjazzed Posts: 11,803
    edited 2008-08-04 18:30
    Maybe you can get Irisys to do a demo for your event? Nothing like a little publicity.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • SRLMSRLM Posts: 5,045
    edited 2008-08-04 20:41
    @Leon:

    Funny how the thread came back to the Irisys technique as the only reliable system. I don't think that I have several man years of work to spare, though.


    Well, I went to radio shack and got the Parallax PIR sensor, just to test it and make sure that it really won't work and see if I can modify it. Since I live in the area and temperatures are expected to reach about 100 today, I think I'll test it outside and check the feasability of any PIR sensor to work in the heat.

    If the PIR doesn't work, then it might be possible to use a certain arrangement of modulated infrareds to do the trick. The problem with the infrared beam seems to be unreliability, so to help overcome this each passage way would get five beams in the following pattern:

    |*|

    The first and last beams tell the propeller that the person is in the area, and the middle three confirm that it is just one person. So if people are bunched up close together, the vertical beams tell which section a person is in, and the slanted beams count the actual people, and, due to their direction, are more resistant to counting handbags and backpacks.
  • VIRANDVIRAND Posts: 656
    edited 2008-08-04 22:43
    Fast parallel queue people counter:

    1.People are gently led like sheep into many queues with railings and suggested to move fast and not bunch up.
    2.Continuously "SCAN" across all the queues the way a fax machine or barcode reader does from above.
    3.Convert the resulting "fax" stream into a scrolling image with people as black blobs on a white background.
    This is very simple if the scan line is much brighter than people when there are no people crossing it.
    4.Automatically count the black blobs. Very easy. Search the top of the "fax screen buffer" for black pixels, find one,
    count it, fill the whole blob it's in with white pixels immediately and repeat.
  • SRLMSRLM Posts: 5,045
    edited 2008-08-04 23:07
    @VIRAND

    Are suggesting to use a camera? I think somewhere else on the forum is a thread about using a B&W camera. That could work. Although, perhaps a cheaper and easier solution would be to use the Parallax "TSL230R Light to Frequency Converter". Then I could paint the opposite side with some garish color, like bright orange. Any method that is used would probably be easiest if it was used on each line.
  • VIRANDVIRAND Posts: 656
    edited 2008-08-04 23:57
    Certainly not a camera! That's why I said fax machine or barcode reader and avoided saying flatbed document scanner.

    The simplest scanning parts would be a laser pointer, a spinning mirror, and a phototransistor with a red filter.
    (A barcode reader can do it!) Maybe it's just too simple for you to believe it can work.

    You just need to scan just one shiny line sideways across all the queues
    to get image data that would look like a multi-lane highway full of people if it came out of a fax machine.

    But it IS important that the people actually walk through and not stand still in the scan beam.
  • rjo_rjo_ Posts: 1,825
    edited 2008-08-05 00:12
    SRLM

    The Prop will actually be an ideal platform for this type of image processing... and depending upon the time constraints is fully scalable. Probably not a good choice right now for this problem... but give it a year or two.

    For normal control apps, there is a lot of competition on the imaging front, with bookoo specialized products, but there is plenty of room on the fringes and on the frontier.

    Rich
  • DroneDrone Posts: 433
    edited 2008-08-05 02:09
    Virand said...

    But it IS important that the people actually walk through and not stand still in the scan beam.
    Besides clogging up the queue, standing still doesn't matter; the person is still counted - accurately. Envision a waterfall display. Each time a person walks through the scan beam, theres a dark mark on the display. If the person stands still, the dark mark just stays on the display as a dark stripe. Since you're only counting dark/light transitions, when the stationary person eventually moves on, only one person is added to the count. Or am I missing something here...?
  • VIRANDVIRAND Posts: 656
    edited 2008-08-05 06:36
    You are correct,
    except that my counting algorithm I described above will keep erasing the stripe and making a new one,
    so the person who stands in the beam for too long will be counted over and over again.
    Edit: (So your counting method is simpler and better than mine)

    Post Edited (VIRAND) : 8/5/2008 7:51:32 AM GMT
  • DroneDrone Posts: 433
    edited 2008-08-05 08:50
    Just remember when scanning with Virand's method (or any sampled method), to consider the rate of the people crossing the beam versus the scan rate. The scan rate should be theoretically more than twice the people-crossing rate (in reality more than twice depending on the roll-off of your anti-aliasing filter). If not, you may count more people than there actually are. Our old friend Nyquist smiles down on us once again! In case you're not familiar, here is more on the Nyquist sampling rate: en.wikipedia.org/wiki/Nyquist_rate.

    Rgds, David
  • SRLMSRLM Posts: 5,045
    edited 2008-08-05 16:01
    I like the scanning idea: sounds fast, reliable and relatively easy. However, I still have the question of safety. These are people who are going to be scanned, not supermarket goods. The laser could cause damage to their eyes if they chanced to look up. Guests could be instructed to not look up, but there are always people who will look anyway. I suppose that if the beam moved very fast, it might help lessen the damage, but it might still hurt. (Like a baby being carried...)
  • VIRANDVIRAND Posts: 656
    edited 2008-08-05 17:33
    There are very many laser scanners in supermarkets which do beam into people's eyes
    and have been for a long time. If it was even imagined to be unsafe under the most
    conservative specifications then legal action would have been taken and/or there would
    be shielding around the scanning zone with laser warning signs all around it.

    Imagine trying to burn a flea with an LED and a magnifying glass. Even if you succeed,
    LED's are still not considered dangerous, and they are much brighter than the lasers that would be used.

    It is not necessary to use a laser. It is just the easiest way AFAIK. You could instead use an LED or bulb with lenses that
    make a narrow (1 cm) beam. You could also scan in a reversed way with fluorescent or neon light under the scan line
    and where there are no people standing that light gets reflected by the spinning mirror into the phototransistor.

    Post Edited (VIRAND) : 8/5/2008 5:41:02 PM GMT
  • SRLMSRLM Posts: 5,045
    edited 2008-08-06 00:00
    What would the power level of these lasers be?
  • jazzedjazzed Posts: 11,803
    edited 2008-08-06 00:16
    Try this:
    http://en.wikipedia.org/wiki/Laser_safety

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • hippyhippy Posts: 1,981
    edited 2008-08-06 13:28
    Use high-powered lasers and some audio filtering to detect "Ouch" and it should also keep the queues moving quickly wink.gif
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2008-08-07 17:37
    I prefer sensing footfalls -- resolution required isn't onerous -- people take up real space -- and pretty discrete, wheelchairs aside. Plus any decently sized pad·could probably tell whether people are coming or going. Technically, it's not much different than the keyboard in this thread:· http://forums.parallax.com/showthread.php?p=702473 (see harley's reply)

    You might be able to kludge something that works, but it'll have to stand up for 400,000-plus·presses.
  • SRLMSRLM Posts: 5,045
    edited 2008-08-07 19:01
    Thanks for all the ideas. I'll look into both the laser idea and the footfall, and see if I can get some components. As it happens, I have a spinning mirror assembly and a laser from an old laser printer...
  • SRLMSRLM Posts: 5,045
    edited 2008-08-19 01:15
    Hmmm. Now that I think about it, each person will have a "passport" that allows them admission. These are small booklets with a blue background and a distinctive golden logo on the front. I could just take a page from the supermarket barcode scanner and have each person slide their passport on top of the terminal. This is only as good as the people, and young children don't have passports, but it seems very reliable.
  • rjo_rjo_ Posts: 1,825
    edited 2008-08-19 01:36
    When laser scanners don't work at the store... is that because there is a computer problem matching up the codes or is there an inherent problem with the interaction between the person, the laser and the barcode?

    I really like the footfall approach, because it is a little more challenging but it is also much more interesting...and it is completely unobtrusive. I hate standing in lines and there is going to be a line at the barcode reader. What is to stop people from just leaving? .

    If you come up with a footfall solution that works well, you will really have something of value. If you come up with a barcode reader, what do you have?... It's a barcode reader.
Sign In or Register to comment.