Pedestrian counting aims to compute the numbers of pedestrians entering and leaving an area of interest based on object detection and tracking techniques. This paper proposes a simple and effective approach of pedestrian counting that can effectively solve the problem of pedestrian occlusion.Firstly, the moving objects are detected by the median filtering and foreground extraction with the improved mixed Gaussian model. And then the HOG (Histogram of oriented gradient) features detection and the SVM (Support vector machine) classification are applied to identify the pedestrians. A pedestrian dataset containing 1500 positive samples, 12000 negative samples, and 420 hard examples, which gave the false discriminant results with the initial classifier, also considered as negative samples to enhance classification capability is employed. In addition, the Kalman filtering with BLOB analysis for dynamic target tracking is chosen to predict pedestrian trajectory.This method greatly reduces the target misjudgment caused by overlapping and completes the two-way counting. Experiments on pedestrian tracking and counting in video images demonstrate promising performance with satisfactory recognition rate and processing time.