Crowd counting and crowd density estimation are the important branch in crowd analysis, and are also the important information that surveillance always concerns. Although some important progress has been made in this field in recent decades, there are still some challenging problems. This paper reviews the current researches and development trends of the crowd counting and crowd density estimation methods based on computer vision. Firstly, the development background and application direction of the crowd counting and crowd density estimation technology are introduced. Secondly, the important methods proposed in recent years are summarized, which can be divided into two types from the machine learning point of view: the shallow learning based methods and the deep learning based methods. In the other hand, they can be divided into two types from learning model standpoint: the direct method (i.e., the detection based method) and the indirect method (i.e., the pixel-based, texture-based and corner point based methods). This paper introduces the shallow learning based methods in the last twenty years in detail, and makes a brief summary of the deep learning based methods in recent years. Then, a brief introduction is made on the performance evaluation techniques of crowd counting and crowd density estimation methods, and several data sets are provided for testing and evaluating these methods. Finally, the technical challenges in the field are summarized and the future research directions are prospected.