## 1 Introduction  
The eyes can be considered a mirror of the human body, allowing for non-invasive diagnosis of numerous illnesses [1]. In particular, the retina can be used as a useful indicator of many diseases. As a person grows older, several diseases leave significant indicative signs in the retina. According to the fact sheet of the World Health Organization (WHO), blindness and vision impairment affect about 2.22 billion people around the world. One billion of them have a chance to prevent the decrease in vision if they are recognized and diagnosed at an earlier stage [2]. Diabetic retinopathy (DR) and glaucoma, which are the focus of the present work, are regarded as the most important causes of blindness, mainly due to the progress in life prospects and permissive lifestyles [3]. DR is a complication of diabetes that inevitably leads to the terminal state of vision loss. Glaucoma is a chronic ocular disease caused by increased fluid pressure in the optic nerve and ends up also harming peripheral vision [4]. Globally, it is estimated that at least 6.9 million people have glaucoma and 4.5 million have DR [5]. The International Diabetic Federation estimates that, worldwide, one in every ten people suffers from diabetes [6], and that those persons have a significant chance to suffer from DR and glaucoma impairments. Moreover, it is estimated that the number of people who suffer from glaucoma is expected to reach 111.8 million by 2040 [7]. DR and glaucoma are irreversible diseases, so detecting them at an early stage is critical to avoid further deterioration in the retina. On the other hand, some countries, especially in the developing world, have a severe shortage of oculist doctors [8], requiring computer-aided diagnosis, such as the one proposed in the present work. Luckily, images of the retina can help in diagnosing several retinal diseases, including DR and glaucoma [9]. This process is usually carried out and interpreted manually, which is laborious and prone to error due to minute image details, as shown in Figure 1. Consequently, if this process is automated, it would help ophthalmologists with a supportive tool that makes both diagnosis and decision making faster, easier, less expensive, and more accurate. To this end, computer vision and imaging techniques, such as those in the present work, can be leveraged. For ophthalmic fundus imaging analysis, well-known modalities, such as 2D fundus images and 3D optical coherence tomography (OCT), can be employed [10]. In this study, the 2D fundus image modality is adopted due to its low cost and the simplicity in computation compared with 3D OCT modality images [11]. To this end, we use three publicly available datasets of retinal fundus images. It should be noted, however, that disease diagnosis via pathological structures of fundus images poses numerous challenges, such as:  
1. Finding relevant datasets for each disease is laborious;
2. Labeling (annotating) the dataset usually requires ophthalmology experts, and can be problematic due to such considerations as privacy, safety, or ethics. The only alternative is to use publicly available images, as is done in the present work;  
Figure 1: The subtle and tiny intensity variations in the fundus image are too difficult to identify by the naked eye, and this is where the proposed CAD system can help. Subtle and tiny variations between intensity values of retinal objects, as shown in Figure 1, can cause errors;
4. The curvature of the retina, in addition to photographic capturing conditions, can often cause illumination spots in retinal fundus images, negatively affecting their quality. 5. Retinal diseases share common characteristics in the fundus images, giving rise to confusion. This article tackles the above challenges, culminating in an accurate retinal diagnostic and prognostic system that discriminates among DR, glaucoma, and normal (free of diseases) cases using a retinal fundus image. To this end, the RGB image is first transformed into its elementary components: red (R), green (G), and blue (B) channels.