In order to count the number of subway cars, guiding passengers to choose the waiting car reasonably and improve the comfort of the car, a real-time number of subway cars based on improved random Hough transform (RHT) is proposed. This method collects the video image of the car after the subway starts. After the background difference and binarization, the canny operator is used to realize the edge detection and contour extraction. According to the characteristics of the human head like circle and its contour on the same curve edge, the improved RHT algorithm is used to detect the circle, and the circles with a radius of 8.0-10.0CM are selected for marking and counting. Experimental results show that this method can solve a large number of invalid accumulations caused by random sampling in traditional RHT algorithm and improve the detection speed.