Video analysis covers many research topics such as people tracking, crowd analysis etc. Traditionally people counting systems uses laser sensor  for detection but they need more resources and it is not that effective. In  the authors proposed a real-time crowd density estimator based on Markov Random Fields. By the rapid growth of surveillance system in public and private place, human and human behavior detection became most popular research area. People counting techniques includes counting by detection, counting by statistics, and counting by tracking. In recent years, human detection using deep-learning became most popular method to work on. But it is very expensive and difficult to implement in raspberry pi. Raspberry pi 3b has Quad Core 1.2GHz Broadcom BCM2837 64bit CPU with 1GB RAM through which deep learning process will be difficult to implement. Raspberry Pi3 made computer vision possible on the Pi platform using Python and OpenCV perspective. It also has Integrated 802.11n wireless and Bluetooth which also help to implement computer vision in various dimensions.
Some people counting system has been made based on face detection. In paper , the author used face detection to locate people, then Kalman filter to track people movement and then counts people according to movement paths. But faces detection is possible when a camera is set on a location where people face appears to the frame. Face detection based system has not been successful because for face detection camera should always install towards face area.
Counting the number of people that enter and exit from some commercial area or private area is very important in today’s surveillance system. To count the camera is either installed on the ceiling or on the wall with different angle. In this case face detection will be very challenging task.
In this paper, we process the people counting system where the raspberry pi along with pi camera will be mounted on the ceiling at the entrance of the laboratories, commercial place, etc. this will help to detect the number of people entered to particular place and also tracks the number of people came out from the place. Firstly, in order to reduce computation costs and cope with various complex surveillance situations for foreground extraction, an adaptive components number selection strategy for mixture of Gaussians model is proposed. Secondly, blob detection is done to classify people. Thirdly, each pedestrian is tracked through consecutive frames using the Kalman filter techniques and cost function. Finally, the resulting trajectories are analyzed to count people entering or leaving the room. Every business with a physical space should count customer traffic in order to see the bigger picture of what is going on in their business. Entry and exit number will help commercial place like supermarkets to track their customer. This proposed system separates the counts by entrance, it utilizes readers mounted at the entrances to count people as the walk into the facility or zone. It will also help to generate business intelligent report with the help of its data and enabling store owner and business managers to make informed business decision.
II. PROPOSED SYSTEM
People counting is a challenging task and has attracted much attention in the area of video surveillance. The proposed system presents an automatic people counting system based on face detection, where the number of people passing through a gate or door is counted by setting a video camera. System of people counting is important for security application (for example, in the circumstance of a clearing, it is key to know what number of individuals are available inside the observation zone at any given time), passerby activity administration, visitors stream estimation. The counter requires two stages: discovery of individuals and following to check individuals directionally. It also focuses on an implementation of OpenCV in an embedded system like raspberry Pi to create a mini-standalone station for counting people. The basic idea is to first use the frame difference to detect the rough edges of moving people and then use the blob detection along with erode and dilation to classify people. Person will be tracked by following the detected human blob and then this person will have counted if its touches the counting line. It is mainly containing five modules i.e. getting video frames, setting tracking area, detecting human and counting people.
In this proposed system opencv3.1 and pi-camera is used to capture video frames. Pi-camera is used to make the whole system a compact which can be installed in any place. In OpenCV, a video can be read either by using the feed from a camera connected to a computer or by reading a video file. The first step towards reading a video file is to create a VideoCapture object. Its argument can be either the device index or the name of the video file to be read.
Here four lines has been initialized as shown in Figure 2. Red line denotes the entry point of people, if people blob cross the red line it counts one person enters. Blue line denotes exit point i.e. if a person crosses it will count as one person exited. Other two lines denotes entry and exit limit point. The lines are drawn using OpenCV polylines method of imgproc class. In polylines method the parameters are as follows: where is the object being drawn to, the coordinates, should we “connect” the final and starting dot, the color, and again the thickness.
Human detection is done using background subtraction. For background subtraction Mixture of Gaussian  technique is used. After background subtraction threshold is used to understand the moving object more clearly. Then we find the human blob by searching the contour in the frame. Blob i.e. Binary Large OBject and refers to a group of connected pixels in a binary image. The term "Large" indicates that only objects of a certain size are of interest and that the other "small" binary objects are usually noise. The contour detector combines multiple local cues into a globalization framework based on spectral clustering. Here contour has been classified to detect human. Contours can be explained simply as a curve joining all the continuous points (along the boundary), having same color or intensity. The contours are a useful tool for shape analysis and object detection and recognition
After human detection we find the midpoint of the contour and then we track the X and Y position in the frame. To find the centroid of contours, moments function of in OpenCV is used. After moments Centroid is given by the relations, Cx=M10/M00 and Cy=M01/M00. This will return the centroid X and Y position. The tracking starts from the entry and exit limit point. When a person appears crosses the limit line, the location of the person is tracked as he moves forward. All the tracked location is saved so that we can check whether the person has crossed the entry or exit point. Along with tracking point an id is assigned to all the moving person. When person is located on limit point and it is checked whether the person was located on entry limit or exit limit. Using the limit point it is then tracked whether the detected person moving towards entry or exit point. This X and Y axis location helps us to find whether the person has crossed the defined area or not. Here tracking starts from the entry-limit point to exit-limit point. If the person crossed the entry or exit point it will counted respectively.
This paper presents a people counting system using raspberry pi based background subtraction and blob tracking. A counting line is defined on the video frame and tracks the detected people who crossed that line. Finally, we display the number of people has entered and exited from a place. By testing the system in the laboratory and few videos, experiment results show that this system has impressive real-time performance and high accuracy. However, the is some issue on wrong counting. The experimental results show that this raspberry Pi-based system can be used as a simple people counter station.