The invention relates to a method for counting the number of reinforced steel bars based on computer vision, which comprises the steps of firstly acquiring an original color image of the cross section of a measured reinforced steel bar bundle, and converting the original color image into a 256-color gray image; then carrying out enhancement processing on the gray image by using a filtering window, selecting an appropriate threshold, and converting the enhancement processed image into a binary image which only has two colors which are black and white; and finally carrying out etching on the binary image by using an etching method, and calculating an Euler number of the etched binary image, wherein the value is the counted number of the reinforced steel bars. According to the invention, the whole process of counting for the reinforced steel bars is realized automatically, and the number of the reinforced steel bars can be counted in a short time, thereby reducing the labor intensity of workers and the error rate, improving the production efficiency, being high in counting accuracy and speed, and being capable of meeting requirements of automatic production.