1 Introduction

Diabetic Retinopathy (DR) is caused when the insulin production in the body is not sufficient and the increased glucose level causes the blood vessels in the eye to swell leading to leakage in the retina. There are two types of Diabetic Retinopathy (DR) i. Non–Proliferative Diabetic Retinopathy (NPDR) and ii. Proliferative Diabetic Retinopathy (PDR). In NPDR the blood vessels get damaged and leak fluid and small amount of blood while, in PDR the abnormal blood vessels start growing on the retina and stop the flow of blood to the retina. DR is diagnosed in patients that have been suffering from diabetes for ten to fifteen years and have no symptoms until the loss of vision [4], deciding whether the patient suffers from DR is difficult for the Ophthalmologist which makes identifying the progression of the disease difficult too. It is one of the major causes of blindness in adults suffering from diabetes, research suggests that early detection, regular examination and cure can decrease DR by 95% [29]. Automated detection of DR using fundus image of the retina has made the detection of retinal diseases much easier and less time consuming for ophthalmologists. The main cause of the formation of exudates and microaneurysms is the leakage of proteins and lipids from the blood vessels into the retina. This paper focuses on extracting exudates and microaneurysms for detecting DR, where it can detect both at an early stage. An automated method for the detection of DR using fundus retinal images is outlined in this paper in Section 3. Morphological operations were used for the detection of exudates and microaneurysms and Support Vector Machine (SVM) was used for the detection of the progression/severity of the disease.

It is important to carry out mass screening of people suffering from diabetes for the early diagnosis of diabetic retinopathy towards which systems using imaging techniques can prove to be very useful and effective. Early diagnosis of the disease can prove to be difficult but it is possible while the progression of the symptoms and disease can be monitored through such systems effectively. Decision regarding the treatment and course of action can be based on systems as proposed by ophthalmologists. The proposed method can be used on the detection of defects in manufactured items, naturally occurring tissues or any problem that requires extracting features of interest and severity detection.

This paper is outlined as follows: Section 2 discusses the related literature for the automatic detection of diabetic retinopathy. The Proposed methodology is outlined in Section 3 with the help of experimental results, Section 4 gives the conclusion of the proposed work and the future work is given in Section 5. An example of a fundus retinal image with exudates is given in Fig. 1.

Fig. 1
figure 1

Shows the exudates in a fundus image

2 Related work

Many studies have been carried out on the automatic detection and classification of diabetic retinopathy using various techniques in the recent years. These can be divided into the following categories: i. morphological operations, ii. color, iii. Deep learning and iv. other methods used for automatically identifying DR.

2.1 Morphological operations

Gandhi et al. [10] have proposed a method for the automatic detection and classification of abnormalities in Diabetic Retinopathy using morphological operations for the extraction of blood vessels, the Canny edge detector was used for the elimination of optic disc and SVM classifier was used for the classification of the disease. Priya et al. [21] have presented a method to classify diabetic retinopathic abnormalities to extract the features of retinal image and then to analyze the progression of the disease by using neural networks and SVM classifier. Aquino et al. [3] have outlineded a morphological and edge recognition method for the optic disc localization. Kuruvilla et al. [15] have proposed a method in which blood vessels were detected by morphological operations, optic disc by segmentation and microaneurysms and haemorrhages were detected by using the moat operator. Kande et al. [16] have proposed a mathematical morphology method for recognition of haemorrhages and microaneurysms. Raja et al. [24] have addressed the problem of detecting optic disc and blood vessels in retinal images by using the binary morphological operation for blood vessel detection and anisotropic diffusion filters were used for segmenting the optic disc. Nayak et al. [19] have detected exudates and blood vessels using Morphological operations, texture analysis, and for the identification of the progression of the disease they used artificial neural network (ANN).

2.2 Color

According to Abbadi et al. [8] claim that exudates can be found in fundus image by using specific color channels and then eliminating these from the fundus image as these are the main cause of blindness. Oktoeberza et al. have proposed a method using the red channel of the fundus image for the segmentation of the optic disc, where further operations are performed on the extracted channel [20].

2.3 Deep learning

Gulshan et al. [12] used a deep convolutional neural network or the automatic detection of DR and diabetic macular edema where the results were verified by ophthalmologist. Gargeya et al. [11] proposed a deep learning algorithm for the automatic detection of DR by using color fundus images by classifying the images as healthy or not healthy. Ting et al. [26] evaluate the performance of a deep learning system for detecting DR and related eye diseases against human evaluators. Doshi et al. [7] diagnose the severity (five stages) of DR using deep learning by using a GPU.

2.4 Other methods

Kumari et al. [17] proposed a method in which optic disc is extracted using propagation through the radii process and template matching is used to detect exudates. Dehghani et al. [5] used histogram specification for identifying the optic disc. Walter et al. [28] use morphological filtering and watershed transformation to detect the optic disk while, exudates are detected using high grey level variation ad the contours detected by using morphological reconstruction.

The method proposed in this paper uses various morphological operators on the red and green channels of the fundus images for extracting the morphological features while using a SVM classifier for assessing the progression/severity of diabetic retinopathy. The method is computationally inexpensive and is implemented using simple techniques using a non-invasive method. This method will help ophthalmologists to identify the disease quickly.

3 Detection and grading of diabetic retinopathy

The proposed methodology for the detection and grading of Diabetic Retinopathy (DR) is outlined in this section. Figure 2 gives the diagrammatic overview of the proposed methodology for the automatic detection and classification of DR using the fundus image database (diaretdb1_v_1_1 [6]) while Fig. 10 outlines an example for DR detection and severity classification, using the steps highlighted in Fig. 2. The fundus images are acquired from the publically available database for DR called the calibration level 1 fundus images. These images are pre-processed by inverting the green channel from the input image. The Canny edge detector is applied to the image for the detection of the different morphological features in the fundus image. Morphological operations such as dilation (Eq. 1) and erosion (Eq. 2) are applied to the resultant images for the detection and elimination of the exudates and microaneurysms.

Fig. 2
figure 2

Shows the flowchart for DR detection and classification

$$ A\bigoplus B=\left\{z|{\left(\hat{B}\right)}_z\cap A\ne \phi \right\} $$
(1)
$$ A-B=\left\{z|{(B)}_z\subseteq A\right\} $$
(2)

The next step is to grade the detected abnormalities in the retinal images and decide whether the disease can be classified as mild or moderate using SVM.

3.1 Image acquisition

In this paper, the retinal fundus images used to examine and emulate the performance of the automatic detection system were retrieved from the open access database diaretdb1_v_1_1 [6]. The database consists of 84 colored fundus images in which 5 images are without any signs of abnormality and the rest of the images are affected by DR.

3.2 Contrast enhancement

Histogram equalization [30] has been used for the contrast enhancement of the retinal fundus images. This was done in order to regulate the image intensities and to improve disparity of light intensity. Black shades show higher intensity and white shades show low intensity in the binary image.

3.3 Feature extraction

In order to detect exudates and microaneurysms it is important to extract the blood vessels and optic disc. Exudates and the optic disc have a similar bright yellow color while, microaneursyms are similar to blood vessels resulting in the ophthalmologists not being able to effectively identify the disease and its progression.

3.3.1 Exudate detection

Exudate can be detected through the extraction of the optic disc. The optic disc has properties similar to those used as follows. The contrast of the input image is enhanced by inverting the green channel. The edges are detected using the Canny edge detector. The closing morphological operation was performed for enhancing the region of interest. Thresholding was performed for the segmentation of background. After segmentation of background gaps of exudate and optic disc are filled up and edges can be detected by using Canny edge detection. Then the (xy) axis mask is applied to the optic disk. Finally the optic disk is extracted and the exudates are detected as shown in Fig. 3.

Fig. 3
figure 3

Shows the (a) fundus image (b) preprocessed image (c) edges detection of fundus image (d) exudate and OD clearing by performing closing operation (e) removing background from exudate and OD by thresholding (f) filled up all gaps of exudate and OD (g) detect edges of exudate and OD by Canny edge detection (h) mask on OD (i) detect exudate

3.3.2 Microaneurysms detection

Microaneurysms can be detected through the extraction of blood vessels by using the following method. The contrast of the fundus image is enhanced by inverting the green channel. Canny edge detection is performed on the red channel of the fundus image as this channel has a small dynamic range and the optic disc is the brightest part of the fundus image. Morphological operations are used to fill holes in the image and outline the boundaries of the different components of the fundus image. It is difficult to differentiate between microaneurysms and blood vessels’ boundary due to similar structures. The image boundary is subtracted from the Canny edge detected image, the resultant image would be without the boundary. Microaneurysms and undesirable relics can be obtained by the subtraction of unfilled gaps image from the image where the gaps have been filled and blood vessels can be detected by the subtraction of dilated image from the histogram image. After the detection of blood vessels Canny edge detection can be applied on the thresholded blood vessels. The Canny edge detected blood vessels image is subtracted from the without boundary image and the holes are filled. Finally, microaneurysms can be detected by the subtraction of microaneurysms and undesirable relic image from the image where the holes have been filled. Figure 4 outlines the steps for the detection of microaneurysms.

Fig. 4
figure 4

Shows the (a) preprocessed image by extracting and inverting the red channels (b) detect edges of red channel (c) boundary of image (d) without boundaries Canny edge detection image (e) filled up holes (f) microaneurysms undesirable relic image (g) BV (h) thresholded BV (i) detected edges of BV by Canny edge detection (j) subtracted BV from Canny edge detection image (k) filled up gaps (l) detected microaneurysms

3.3.3 Addition of exudate and microaneurysms detection images

The images in which exudates and microaneurysms were detected are now added for the classification of the disease. Figure 5 shows the exudates and microaneurysms image.

Fig. 5
figure 5

Shows the Microaneurysms and exudates in one image

3.4 Classification for grading DR

The exudates and microaneurysms image is used as an input to the support vector machine (SVM) classifier for the classification of the disease. SVM classifies the data by choosing the best separation line (hyperplane) that isolates data of one class from the data of the alternative class. SVM classifier labels the diseased and healthy part of the image by different values where −1 indicates the healthy part and + 1 indicates the diseased part. The classifier is used to evaluate training data to find the best way to identify the progression of DR, abnormality of a retinal fundus image as mild or moderate.

The classification results are shown in the Figs. 6, 7 and 8. These results have been confirmed by an Ophthalmologist. Figure 6 shows the fundus image of moderate NPDR along with the detected result, Fig. 7 shows the fundus image of mild NPDR along with the detected result, Fig. 8 shows the fundus image of a healthy retina along with the results using the proposed method.

Fig. 6
figure 6

Shows the (a) fundus image of moderate NPDR and (b) its Corresponding result after applying the algorithm for the detection of NPDR

Fig. 7
figure 7

Shows the (a) fundus image of mild stage of NPDR and (b) its Corresponding result after applying the algorithm for the detection of NPDR

Fig. 8
figure 8

Shows the (a) fundus image of a healthy retina and (b) its Corresponding result after applying the algorithm for the detection of NPDR

After classification of the image the following result is obtained in which represents the healthy training data, represents the healthy classified data, the represents the abnormal training data, the represents the abnormal classified data and the support vector represent the data points that are nearest to the separating line; these data points are on the border of the block. Figure 9 shows the classification results.

Fig. 9
figure 9

Shows the () healthy training data,() healthy classified data, (+) abnormal training data,() classified data, Support vector data points that are nearest to the separating line

4 Conclusions

The proposed method clearly distinguished the exudates and microaneurysms, from the optic disc and blood vessels. As the optic disc and blood vessels have similar properties in terms of intensity levels as that of microaneurysms and exudates, they are completely eliminated for the detection of diabetic retinopathy. The morphological operations of dilation and erosion along with Canny edge detector was used to detect the diabetic retinopathy effectively. The results of the detection of DR were used to identify the progression/severity of the disease by using the SVM classifier. The classifier was used to classify the retinal fundus image as i. healthy, ii. mild or iii. moderate case of DR helping the Ophthalmologists to decide the course of action to be taken for dealing with DR. The system further increases the clarity of the diagnosis of Diabetic Retinopathy in assisting the Ophthalmologists (Fig. 10).

Fig. 10
figure 10

Depicts an example of the Detection and classification of DR

In Table 1 TP denotes the true positives, TN denotes true negatives, FP denotes false positives, P denotes positive samples, N denotes negative samples and FN denotes false negatives. Using the formula given in Eqs. 3 and 4 the specificity and sensitivity are computed.

Table 1 Gives the results for the SVM classifier for the classification of the detected DR using positive predictive, negative predictive values, sensitivity and specificity calculations
$$ \mathrm{Sensitivity}=\mathrm{TP}\mathrm{R}=\mathrm{TP}/\mathrm{P}=\mathrm{TP}/\left(\mathrm{TP}+\mathrm{FN}\right) $$
(3)
$$ \mathrm{Specificity}=\mathrm{SPC}=\mathrm{TN}/\mathrm{N}=\mathrm{TN}/\left(\mathrm{TN}+\mathrm{FP}\right) $$
(4)

In the images 1 and 3 (Table 1) the sensitivity and specificity is 100%t that is in both of these images no abnormal areas were detected. In the image 2 the sensitivity is 57.2% and the specificity is 85.8%, so 57.2% area is detected as abnormal and 85.8% area is detected to be normal. Figure 6. (a) shows the original image of moderate NPDR and its corresponding result for the detection of NPDR using the proposed methodology is given in Fig.6. (b). In the image 6 the sensitivity is 53.3% and the specificity is 88.8% the results show that the disease is moderate as 7.2% area is detected as abnormal and 85.8% area is detected to be normal. Figure 7. (a) shows the original image for mild NPDR and its corresponding result for the detection of NPDR using the proposed methodology is given in Fig. 7. (b). Figure 8. (a) shows the original image of healthy eye and its corresponding result for the detection of NPDR using the proposed methodology is given in Fig. 8. (b). As shown in Table 2 the proposed method has outperformed all the other methods on the dataset [6] used for testing the proposed method of this paper.

Table 2 Gives the comparative results for the sensitivity and specificity of the given methods on the dataset [6] used for the proposed method in this paper

The proposed method is applicable to the detection anomalies in manufactured items, naturally occurring tissues or any problem that requires extracting features of interest and severity detection of the anomalous nature of the detected features.

5 Future work

This research work will be used as a basis for formulating an automated system that would be implemented on hardware, in terms of a device which would be able to detect retinopathy by placing it on the eye. The device would be able to capture fundus images and process them according to the proposed work. The results would be communicated to the user through a change of status of indicator lights on the user panel if a case of retinopathy is detected and otherwise. The system that has been proposed would be cost effective so that health practitioners can identify cases of retinopathy more effectively and quickly. The aspect of confidentiality needs to be considered while designing the system, as the data might be shared over insecure networks and the possibility of breach of confidentiality of a patient needs to be tackled with methods as proposed by [2, 13] for securing the data while, the method proposed in [14] can be used to authenticate the images and their owners.