People Counting Algorithm In this thesis work, a new indoor people counting algorithm Is created by using Moron D-6TH thermal sensor and Raspberry Pl. The sensor periodically generate thermal map of heat emitted in its field of view which is a one dimension array and pass the array to Raspberry for further processing. The people counting algorithm is created in Raspberry Pi by processing thermal map generated by DOT.
After processing the number of people Indoor Is obtained.
This chapter presents the hardware structure used Including DOT thermal sensor and Raspberry Pl. Rover the people counting algorithm is discussed in detail. DOT thermal sensor DOT is a new product which is designed by Moron and released in 2012. By using Moor-en’s unique MESS and ASIA technologies, it achieves a high SIN which leads to a digital output with superior noise Immunity. While standard thermal sensors are only able to measure temperature at one certain contact point, the DOT can measure the temperature of an entire area without contact.
As the figure shows, the DOT series sensors consist of a cap with silicon lens, MESS thermopile sensor chips and dedicated analog circuit and a logic circuit for digital temperature value generation. Figure 1 . Moron DOT thermal sensor structure until now DOT has only 2 types which are DOT-ALL-06 and DOT-AL-06. The main differences are DOT-ALL-06 has 16 pixel elements while DOT-AL-06 has only 8 pixel elements which means they also have different field of view. In this thesis work, we use DOT-ALL-06 for thermal map generation. Figure 2.
Types of DOT thermal sensors Operating Principle and features The radiated heat emitted from an object is collected by thermopile sensor through the silicon lens. Then the radiated heat will produce an electromotive force on the thermopile sensor. Afterwards, the analog circuit calculates the temperature of an object by using the electromotive force value and a measured temperature value bus. Compared with traditional ferroelectric sensors, DOT can catch both signals of a stationary person and moving person as it detects the far-infrared ray of an object continually rather than detecting the change of signal.
Connector The sensor has 4 pins. Table 1 . Pins of DOT thermal sensor In this thesis work, we connect these 4 pins to GPO of Raspberry Pi directly. After recessing, the temperature value of each pixel is outputted with a format of 16 bit width, singed, 10 times of deg. For example, 12. 7 co = UHF (127). The sensor repeats the measurement operation 4 times in 1 second, in other words, the thermal map is updated every 250 ms. Raspberry Pi The Raspberry Pi is a credit card sized single board computer developed in the UK by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer science in schools.
The Raspberry Pip’s hardware consists of Broadloom BECOMES system on a chip (SoC), which includes ARMOR 700 Maze processor, Videodisc IV CPU and 256 MOB or 512 MOB RAM. Unlike typical PC, Raspberry Pi does not have a built-in hard disk or solid state drive, but instead it uses an SD card for SO booting and long term storage. For the SO, we have various of choices, Arch Linux Arm, Debbie GUN/Linux, Fedora, Breeds, Netted, Plan 9, Arkansan SO, RISC SO and Slacker Linux. Figure 3.
Raspberry Pi ICC us ICC refers to Inter-elongated Circuit which is invented by Philips and used for attaching some low speed peripherals to some comparatively high speed electronic devices. ICC uses only two bidirectional open drain lines which are Serial Data Line SAD) and Serial Clock (SSL). These two lines are pulled up with resistors. Typical voltages used are +5 V or +3. 3 V, and there are still systems using other voltages. Mode. But now it is possible to support nodes running at faster speeds like 400 kibitz/s fast mode, 1 Ambit/s fast mode plus, 3. Ambit/s high speed mode and in 2012 5 Ambit/s ultra-fast mode was added. The devices connected with ICC bus are either master nodes or slave nodes. The master node generates the clock and initiates communication with slaves while the slave node receives clock signal and give a response to the master when its address s requested. It is necessary to stress that ICC bus is a multi-master bus which means any number of master nodes can be attached. Usually a bus device operates in one or two modes of four modes operation which are master transmit, master receive, slave transmit and slave receive.
Initially the master starts master transmit mode by sending a start bit followed by the address of the slave it wished to communicate with, after this a command would be sent and tells the slave whether it would write or read from the slave. If the slave exists on the bus and it will shake hands with aster by sending an JACK bit (active low for acknowledged). Start Condition Repeat Start Condition Stop Condition “JACK” Acknowledge reply “KNACK” No-acknowledge reply Figure 4. Signal chart of DOT thermal sensor Figure 4 is signal chart of Moron DOT thermal sensor. It starts operation by sending “S”, followed by the address.
After receiving “JACK”, it sends a read command and receives an “JACK” as well. Afterwards, “Sir” is sent and after another “JACK” is received, the master starts to read the temperature collected by the sensor. People Counting Algorithm Heat map and difference map The people counting algorithm is based on processing the heat map generated from map array periodically. Also in each loop, after the heat map array is obtained, a new array called difference map is produced by calculating the difference between current heat map and previous heat map (heat map of previous loop).
Our algorithm is mainly focus on processing the difference map. Figure 5. Heat map of DOT thermal sensor Figure 5 shows the heat map which in program is array hetman. The number in the left side is the detected temperature in Celsius while the number in the right side is the index number. Figure 6 presents the difference map which in program is array difference. The difference is calculated after the heat map is obtained and it is the difference between current hetman and previous hetman (heat map of previous loop).
As we can see from the figure 6 that the value of each element in difference is either O or -0. 1 . This is because nobody is moving in the detecting area so the difference does not vary much. Usually the value of each element varies between -0. 1 – 0. 1 . We have the same situation if somebody keeps stationary in the detecting area. On the contrast, once someone starts to moving in the detecting area, the difference would have a significant change in corresponding element. Usually the value is bigger than 0. 3 at least.
Both the hetman and the difference are updated every 250 ms. Figure 6. Difference map of DOT thermal sensor People counting system setting Figure 7 People counting system model In this thesis work, our focus is mainly in office domain. As we can see from figure 7, the sensor is placed on the ceiling so that the detecting area is able to cover the whole entrance area of the door. According to the dataset of DOT thermal sensor, he view angle of the sensor is 44. Inn X direction and 45. Inn Y direction. The ceiling of the office in which we do the test is 2. Mm high.
The door is mm width. With these data, we are able to calculate the detecting area is 2. Mm long and 2. Mm wide. So anyone passing the detecting area would be detected. Algorithm implementing is called “former” which consists of four elements (difference[O] – difference) in difference. The purple line is called “latter” and it consists of four elements (difference – difference[1 5]) in difference. These two virtual lines are used to determined whether a person comes in or comes out. So there are two cases which should be considered. 1. A person comes in 2.
A person comes out In case 1, “former” would be touched first and “later” is touched subsequently. Conversely, in case 2 “latter” is touched first and “former” is touched later. At the same time, a counter called number is set in the algorithm to store the number of people indoor and its initial value is O. When case 1 happens we increase the number by awhile when case 2 happens we decrease the number by 1 . This is basically the overall thought of the people counting algorithm. Figure 8 presents the flow chart of people counting algorithm and only behaviors in one loop is illustrated.
First, difference is obtained, variable former and variable latter are used to store the index number of corresponding element if “former” or “latter” is touched by somebody. Counter is a variable which is used to reset former and latter after 5 loops and number is used to store the number of persons indoor. As we can see from figure 8, after initiation “former” (difference[O] – difference) is processed first and “latter” (difference – difference[1 5]) is processed afterwards. The two virtual lines are processed by implementing a loop for each line.
If any element in the loop is larger than 3, the corresponding index number is assigned to variable former or variable latter. The initial values of variable former and latter are both O. The limitation here is the “former” and “latter” cannot be touched at the same time. So if “former” is touched first, for example difference > 3, then we assign index number 2 to variable former: former = 2. As “latter” is touched after “former”, for example difference > 3, then we assign index number 13 to variable latter, tater = 13. Conversely if “latter” is touched first and “former” is touched after.
We use the same example above, thus, former would be 13 and latter would be 2. After processing “former” and “latter”, the difference between variable former and variable latter is obtained which is variable c in program. As index number of “former” is from O to 3 and index number of “latter” is from 12 to 15. So the difference is either larger than 9 or smaller than -9. So if c > 9, it can be inferred that the order is “latter” first and “former” after, so case 2 happens and we know somebody comes out. The variable number decrease by 1.
If c < -9, it can be inferred the order is "former" first and "latter" after, so case 1 happens and we know somebody comes in. The variable number would increase by 1. Figure 8. The flow chart of people counting algorithm Apart from detailed explanation of people counting algorithm presented above, in order to guarantee the accuracy of the detecting results, some error reduction mechanism should be added into the algorithm. The first possible error should be avoided is the error probably caused by pixel O as its index number is O. Because the nitial value of variable former and variable latter is both O.
However, if pixel O is touched, variable former or variable latter would still be O. So it is difficult to distinguish whether the O is the initial value or the index number of pixel O. In order to avoid this error detection, we have to mechanisms to choose from. The first mechanism is pixel O could be disabled which means even pixel is touched, it would not be regarded as touching “former” line. This is possible as we mention before, the door of the office in which the test is made is only 1 meter wide and 3 exile (pixel 1, pixel 2 and pixel 3) are enough to cover the entrance area as long as it is placed appropriately.
The second mechanism is we could increase the index number of “former” by leach time it is touched. Thus if pixel is touched, variable former or variable latter would be assigned to 1, respectively 2, 3, 4 are assigned if subsequent 3 pixels are touched. As we can see from the figure 8, every time a successful detection ends, variable former and latter would be reset to O immediately. However, problems would still occur. We mentioned before, the thermal sensor make 4 detections in a second, that means if a person is detected, the corresponding temperature would not increase to the maximal value immediately as the detecting speed is fast.
It has an increasing process, so after a successful detection, the corresponding pixel in difference map would keep increasing and definitely it is larger than 0. 3. But the system cannot tell the difference, it would regard this as a new person, but in fact it is the same person. In order to avoid this error detection, we implement an automatic resetting mechanism which would reset variable former and latter to O after 10 detection periods starting from a successful detection.