The ovary is a complex endocrine organ that shows significant structural and functional changes in the female reproductive system over recurrent cycles. There are different types of follicles in the ovarian tissue. The reproductive potential of each individual depends on the numbers of these follicles. However, genetic mutations, toxins, and some specific drugs have an effect on follicles. To determine these effects, it is of great importance to count the follicles. The number of follicles in the ovary is usually counted manually by experts, which is a tedious, time-consuming and intense process. In some cases, the experts count the follicles in a subjective way due to their knowledge. In this study, for the first time, a method has been proposed for automatically counting the follicles of ovarian tissue. Our method primarily involves filter-based segmentation applied to whole slide histological images, based on a convolutional neural network (CNN). A new method is also proposed to eliminate the noise that occurs after the segmentation process and to determine the boundaries of the follicles. Finally, the follicles whose boundaries are determined are classified. To evaluate its performance, the results of the proposed method were compared with those obtained by two different experts and the results of the Faster R-CNN model. The number of follicles obtained by the proposed method was very close to the number of follicles counted by the experts. It was also found that the proposed method was much more successful than the Faster R-CNN model.