1 Introduction

Cataract is a leading cause of blindness and visual impairment [5]. It is a great challenge to prevent or delay cataract formation and treat cataract patients. It is estimated that 20.5 million (17.2 %) Americans older than 40 years have cataract, and this number will rise to 30.1 million by 2020 [22]. The prevalence of cataract is increased with aging. Data from Australia showed that this prevalence doubles with each decade of age after 40 years, so that everyone in their nineties is affected [16].

There are mainly three types of cataracts: nuclear sclerosis, cortical cataract and posterior subcapsular cataract (PSC). Damage to epithelial cells has been a focus of researchers to identify causes of PSC and cortical cataract [8]. Both PSC and cortical opacities can be observed using retro-illumination imaging. Cortical opacities are wedge or spoke shaped in the periphery of the lens. PSC opacities usually present centrally [20]. As PSC opacity lies in the center of lens, the light passing through the pupil is easily be blocked. PSC can develop rapidly, and it is more likely to cause visual impairment than other types of cataract. The presence of PSC is an important factor to determine if surgery is needed for a cataract patient [21]. This paper focuses on the extraction and grading of PSC opacities.

Many clinical cataract classification schemes have been proposed to evaluate the severity of cataract. Most of the systems grade three types of cataract independently. Slit-lamp imaging and retro-illumination imaging are two means to photograph opacities in lens. By comparison with the standard picture, cataracts are classified into different severity levels. Systems such as Lens Opacities Classification System III (LOCS III) [3] as shown in Fig. 1 are widely used in clinics. But the manual grading is always subjective, and it is hard to provide quantitative measurement of the area of opacity manually. What is more, manual assessment is time-consuming. There is clinical need for objective assessment of cataract opacities, especially in population-based studies.

Fig. 1
figure 1

LOCS III standard photographs for grading cataract [3]

Methods to detect cataracts automatically in retro-illumination images have been investigated [7, 12, 13, 17]. A global threshold method was employed by Nidek [17] to detect cataract opacity. Based on the work of Nidek, contrast-based threshold was proposed [7]. Threshold method alone is easy to detect the dark part due to uneven illumination [25]. Li et al. [12, 13] proposed a method for detecting PSC and cortical cataract. Method in [12] aims at the detection of cortical cataract, while [13] is an automatic detection of PSC. Original image was transformed to polar coordinates so that PSC opacity will present in horizontal direction in [13]. PSC opacity was detected by combining the global threshold, local threshold and edge detection method. The experimental results in [13] present a better result than methods in [7] or [17]. But the available techniques still cannot handle several situations. Cortical and PSC opacity may present as a contiguous area in retro-illumination image so that the feature of shape cannot distinguish them. And severe cortical opacity may also grow to the center of lens. In these cases, spatial filter alone cannot identify PSC correctly. PSC is not always solid, and there is texture inside the opacity. Local threshold can led to a flocculent edge detection result, while doctors regard PSC as clumps of opacity.

In this paper, a novel automatic screening method is explored for PSC. Both cortical and PSC opacities are extracted in retro-illumination images first. Then PSC opacity is distinguished from cortical opacities. These two steps are achieved by MRF model and MGC model, respectively. The PSC opacity detection by MRF model and MGC model is introduced in Sect. 2. In Sect. 2.1, watershed method and MRF are combined to extract opacity area. PSC opacity and cortical opacity present different gradient in anterior and posterior images. PSC looks sharp in posterior image, while anterior image focuses on cortical and has a clear lens edge. Based on this, MGC model is proposed to distinguish PSC and cortical opacities in Sect. 2.2. The results of MRF are combined with the result of MGC to obtain the final result, and the percentage of PSC opacity is calculated.

2 Methods

Retro-illumination image is widely used to detect cortical and PSC opacity in clinics. A healthy lens is transparent, and the intensity of retro-illumination image is even. Both an anterior and a posterior retro-illumination image are taken for the lens in clinical diagnosis. The protocol of photographing anterior and posterior retro-illumination image can be found in [10]. Figure 2 shows an example of anterior and posterior image from the same eye, in which PSC opacity presents in the center of lens and cortical opacity appears around the edge of the lens. It can be observed in Fig. 2 that PSC opacity is clearer in posterior image and cortical opacity is clearer in anterior image as focus is different in imaging. Another characteristic of PSC is that the texture inside it is not solid, which easily leads to in complete segmentation of PSC opacity.

Fig. 2
figure 2

Examples of retro-illumination image from the same eye. a Posterior image. b Anterior image

The region of interest (ROI) is detected to save computation time. The ROI in retro-illumination image is the region of lens. The lens extraction algorithm proposed in [12] is employed. Canny and Laplacian edge detector are combined to detect edge pixels. Then, the edge pixels on the convex hull are fitted to an ellipse to detect ROI. The success rate for automatic ROI detection is 98.2 %.

The main steps of the segmentation process are illustrated in Fig. 3. MRF model and MGC model are carried out on the result of watershed independently. Logic operation AND is performed between MRF and MGC result.

Fig. 3
figure 3

Flowchart of PSC extraction method

2.1 Opacity segmentation by MRF model

The extraction of opacity is performed by MRF method. After ROI extraction, Gaussian smoothing filter is employed to decrease noise. Watershed method is first employed to divide images into super-pixels with commonness. MRF is then applied to judge whether the region belongs to opacity or not. Post-processing is used to avoid large area of over-detection. PSC opacity and cortical opacity are both detected at this step.

2.1.1 Initial segmentation

Watershed method [24] uses the concept in geography that water falling on the ridge line will flow down along the steepest slope until it reaches the bottom of catchment basin. The ridge line then divides the basin into adjacent regions. Watershed segmentation algorithm is effective for the initial partition [15].

The watershed method we use is based on gradient, as the gradient near the edge is big and we hope the ridge lines appear at the boundary between opacity and background. This can ensure pixels in one super-pixel belong to the same label. The images are divided into small pieces. In order to avoid over segmentation and reduce computing time, morphological opening operation is performed on the image. The results are shown in Fig. 4. The edge of lens is always fuzzy, so the radius of the lens is reduced to λ times the original radius to avoid noises near ROI margin. This will not influence the PSC area as PSC opacity usually appears in the center. A suitable range of λ is [0.92, 0.96]. In this paper, λ = 0.95 is chosen. Posterior images are chosen to implement watershed and MRF. One reason is that there is always a clear lens boundary in posterior image. Another reason is that opacities in anterior image always have more details and textures, which will increase the number of watershed results and the computational cost in MRF.

Fig. 4
figure 4

Watershed result. For illustration propose, only the central part of Fig. 2 (b) is shown. a Original image. b Watershed method performed on original image. c Watershed result after morphological opening operation is performed on the original image

2.1.2 MRF model

Extraction of opacity is performed using a MRF method. MRF is a statistical approach which is widely used in image segmentation [1, 26]. It deals with the image segmentation as an energy minimization problem. In medical image processing, MRF model is used to determine whether a group of pixels belong to neighboring groups [18].

Images are first segmented into super-pixels like Fig. 5a. The super-pixels can be recognized as nodes in a region adjacency graph (RAG) as shown in Fig. 5b. A RAG contains two key factors, nodes \(F\,{=}\,\left\{ {F_{1} ,F_{2}, \ldots ,F_{n} } \right\}\) and a collection of all neighbor nodes E. (F i , F j ) ∊ E if F i and F j are spatially adjacent. For each F i , it can be any member of L, where L = {L 1, L 2,..., L m } denotes a set of labels. In this paper, there are only two classes of labels: the opacity and the back ground. F i together with its corresponding label is donated by ω i , and ω = {ω 1, ω 2,…, ω n }is one possible segmentation result. MRF is a method to find the maximize probability ω according to maximum a posteriori (MAP):

$$\hat{\omega } = \arg \;\mathop {\hbox{max} }\limits_{\omega \in \varOmega } \;p(\omega /f) = \arg \;\mathop {\hbox{max} }\limits_{\omega \in \varOmega } \frac{p(f/\omega )p(\omega )}{p(f)}{ = }\arg \;\mathop {\hbox{max} }\limits_{\omega \in \varOmega } \;p(f/\omega )p(\omega )$$
(1)

where f is the observation data [9] obtained by priori knowledge and p(f) does not vary respect to any ω. It is reasonable to assume that f and ω are conditionally independent [19]. That is to say, p(f/ω) does not vary when ω changes and it can be ignored. Then Eq. (1) only concerns about p(ω):

$$\hat{\omega } = \arg \;\mathop {\hbox{max} }\limits_{\omega \in \varOmega } \;p(\omega )$$
(2)
Fig. 5
figure 5

An example of region adjacency graph. a Segmented image. b Region adjacency graph of (a)

Hammersley–Clifford theorem was employed to prove that MRF is equivalent to Gibbs random field [2], that is

$$p(\omega ) = \frac{1}{Z}\exp ( - U(\omega ))$$
(3)

Z is a normalized function \(Z = \sum_{\omega }{e^{ - U(\omega )} }\). The MAP problem can be expressed as the energy minimization problem:

$$\hat{\omega } = \arg \;\mathop {\hbox{min} \;}\limits_{\omega } U(\omega )$$
(4)

The energy U(ω) can be written as

$$U(\omega ) = \sum\limits_{Fi \in F} {V_{{F_{i} }} } + \sum\limits_{(Fi,Fj) \in E} {V_{{(F_{i} ,F_{j} )}} }$$
(5)

The energy function contains two parts. \(V_{{F_{\text{i}} }}\) is the energy of a single node, and it is only based on the property of this node. \(V_{{(F_{i} ,F_{j} )}}\) describes the potential of two neighboring nodes F i and F j , which contains the neighborhood information. \(\hat{\omega }\) is not only concerned about the node itself. Its surrounding nodes contribute to U(ω).

Super-pixels will be detected by both its own characteristics \(V_{{F_{\text{i}} }}\) and its neighbors’ characteristics \(V_{{(F_{i} ,F_{j} )}}\). It is more robust to use super-pixels as a unit and measure the characteristics of super-pixels than utilizing single pixels. As local threshold and global threshold only concern about gray scale, high gray scale super-pixels exist commonly when there are textures inside opacity. It causes gaps inside opacity detection result. Characteristics \(V_{{(F_{i} ,F_{j} )}}\) concerns about super-pixel’s correlation with its neighbors. It is more likely to determine a high gray scale super-pixel as opacity if most of its neighbors belong to opacity.

2.1.3 MRF-based segmentation

Three key factors are used to form the MRF model as described in Sect. 2.1.2. Mean gray value μ i , standard deviation σ i in each super-pixels are employed to calculate \(V_{{F_{\text{i}} }}\), and mean gradient value is employed to value \(V_{{(F_{i} ,F_{j} )}}\).

Assume that the mean value μ i of F i follows Gaussian distribution. The mean value μ L and standard deviation σ L can be obtained from observation data of each label [4]. The extraction of observation data will be explained hereinafter. Equation (5) is transformed into:

$$V_{{F_{i} }} = \frac{{(\mu_{i} - \mu_{L} )^{2} }}{{2\sigma_{L}^{2} }} + \ln \left( {\sqrt {2\pi \sigma_{L}^{2} } } \right)$$
(6)

The function \(V_{{(F_{i} ,F_{j} )}}\) is a measurement of the relationship between two neighboring regions. Let B ij denotes a set of adjacent points in two regions F i and F j l ij are the length of B ij . A form of \(V_{{(F_{i} ,F_{j} )}}\) is:

$$V_{{(F_{i} ,F_{j} )}} = \beta \frac{1}{{\sum\nolimits_{{(F_{i} ,F_{j} ) \in E}} {l_{ij} } }}\sum\limits_{{(F_{i} ,F_{j} ) \in E}} {l_{ij} \delta (\omega_{i} ,\omega_{j} )} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} K(F_{i} ,F_{j} )$$
(7)

In this equation, β is a constant and δ(ω i , ω j ) = 1 if ω i  = ω j , δ(ω i , ω j ) = −1 if ω i  ≠ ω j K(F i , F j ) is proportional to the mean gradient value of B ij , and its range is from 2 to −2. K(F i , F j ) increases the influence of gradient. The bigger the gradient in adjacent points is, the more likely two regions belong to different labels.

The equation of U(ω) is then derived:

$$U(\omega ) = \sum\limits_{Fi \in F} {\left[ {\frac{{(\mu_{i} - \mu_{L} )^{2} }}{{2\sigma_{L}^{2} }} + \ln (\sqrt {2\pi \sigma_{L}^{2} } )} \right]} + \sum\limits_{(Fi,Fj) \in E} {\left[ {\beta \frac{1}{{\sum\nolimits_{{(F_{i} ,F_{j} ) \in E}} {l_{ij} } }}\sum\limits_{{(F_{i} ,F_{j} ) \in E}} {l_{ij} \delta (\omega_{i} ,\omega_{j} )} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} K(F_{i} ,F_{j} )} \right]}$$
(8)

The factors employed in MRF include mean gray scale of super-pixel, mean gradient of adjacent points and coherence with neighbor super-pixels. According to these factors, the maximum probability of ω is obtained. Iterated conditional modes (ICM) [14] is applied to find the proper ω, in which limit iterations are used to get the segmentation result.

Observation information for both opacity and background is needed in the MRF model. Observation data f are extracted by different rules, and post-processing is processed to avoid large areas error segmentation.

It is challenging to obtain robust segmentation results in images with different severity of opacity. Images are divided into two groups according to their histograms before opacity segmentation is performed. Histograms of severe cataract images are more complicated. There are at least two peaks: one for background pixels with high gray scale and another for opacity pixels. Histograms for mild cataract opacity or healthy lens images always follow Gaussian distribution approximately.

There are multiple peaks in histograms for lens with severe cataract as shown in Fig. 6a, while simple histograms as shown in Fig. 6b are observed for images with light opacity or no opacity. After smoothing the histogram of intensity, if there are at least two peaks and the second largest peak is bigger than a quarter of the largest peak, it means that intensity distribution is extensive and opacity is always serious. For images whose peaks of intensities histogram are all smaller than 88, opacities in the image usually occupy most areas of the lens. These images are assigned to group 1. Others are assigned to group 2. Histogram in group 2 has a centralized gray scale distribution, and there is a slight opacity or no opacity in the images in group 2.

Fig. 6
figure 6

Histograms from two different groups. B is the right foot of highest peak A. A is the axis of symmetry for B and C a Histogram of group 1. D is the peak with smallest intensity. b Histogram of group 2

As the observation data affect segmentation results directly, typical values should be selected to represent opacity and background. Opacities are darker than background. Background has a higher intensity and is flat. As can be seen in Fig. 6, most pixels with intensity greater than A should belong to background. The biggest area of watershed result in this range is selected as background observation data. Intensity between A and C contains both background and opacity, thus selecting data there as observation data is easy to cause over-detection. For group 1, as the histogram shown in Fig. 6a, we choose the biggest area between C and peak D in histogram as opacity observation data. Choose data blow D would lose opacity details in high gray level. For group 2, the biggest area below C is chosen.

2.1.4 Post-processing of MRF

Images are segmented into opacity and background. Intensity inhomogeneity causes a large area of error detection near the edge of lens when the lens is healthy. When opacity area is small, the gray scale difference between opacity and background is small. MRF will fail to distinguish opacity. These cases exist in images of group 2. Gradient in opacity edge is much bigger than other places. Edge region occupies a relatively large area when opacity area is small. So gradient image is chosen to evaluate whether the result is over detected in group 2.

Experimentally, the image of gradient bigger than 13 with the closing operation is chosen as gradient image. Each pieces of MRF whose area is bigger than 0.3 times of ROI are compared with the gradient image. If the common part is smaller than 0.2 times of the piece, the common part will replace the original piece as opacity.

Figure 7 is the process of MRF in group 2. There is only one peak with corresponding intensity bigger than 88 in the histograms of these three examples, so these images belong to group 2. Areas near the edge of the lens are darker than other backgrounds. MRF regards these areas as opacity. The wrong detection areas are large and are not easy to eliminate by distance filter. Gradient in these areas is much smaller than that in opacity edge. Comparing with gradient image enables the wrong area becomes smaller or disappears. Seen from column (e), large areas of wrong pieces are avoided effectively.

Fig. 7
figure 7

Opacity detection process of group 2. a Original images after ROI detection. b Histograms of (a). c MRF results. d Gradient images. e Final results of opacity detection

2.2 PSC opacity segmentation by MGC model

Spatial feature was proposed to exclude cortical cataract in [12, 13]. Unfortunately, it cannot handle the images in which PSC and cortical are mixed together. In clinical, anterior and posterior retro-illumination images are compared to distinguish PSC from cortical. PSC looks sharp in posterior image, while anterior image focuses on cortical and have a clear lens edge. The comparison between anterior image and posterior images is extracted as a feature to distinguish cortical and PSC opacities.

2.2.1 MGC model

In this section, posterior image and anterior image are registered and watershed results are merged to compare gradient. Image registration method used in this paper is based on the method in [11]. Based on cross-correlation, scaling factor from 0.97 to 1.03 and rotation are performed on posterior image to obtain the best registration. Their mean gradient in posterior and anterior image is G p and G a , respectively. Pieces fulfill Eq. (9) will be recorded as PSC pieces.

$$G_{p} - G_{a} \ge T$$
(9)

An anterior image is segmented into super-pixels using watershed. Some super-pixels are small, and there are not enough pixels to reflex their feature. Spatial merge is employed to reduce the number of watershed result and decrease noise. Large area of super-pixel can decrease noise so that a better comparison of the gradient can be performed. Spatial distance factor D ij is employed to perform spatio-temporal merge [23]. There are two factors in D ij : A ij denotes the mean intensity difference between two neighbor regions and G ij is the mean gradient in adjoin pixels.

$$D_{ij} = \frac{1}{2}(A_{ij} + G_{ij} )$$
(10)
$$A_{ij} = \left| {\frac{1}{{N_{i} }}\sum\limits_{{(x,y) \in R_{i} }} {I(x,y)} - \frac{1}{{N_{j} }}\sum\limits_{{\left( {x,y} \right) \in R_{j} }} {I(x,y)} } \right|$$
(11)
$$G_{ij} = \frac{1}{{N_{ij} }}\sum\limits_{{(x,y) \in R_{i} \& (x,y) \in R_{j} }} {g(x,y)}$$
(12)

In Tsaig’s method [23], super-pixels will merge with its minimum D ij adjacent super-pixel if D ij is lower than a constant. This step starts from the smallest super-pixel and stops if all the sizes of super-pixels are bigger than 300 pixels. The original restrict condition that D ij should lower than a constant is abandoned in our method. It aims at protecting small super-pixels which belong to different type with all of its surroundings. This has been achieved by the combination of MRF and MGC. Figure 8a shows the watershed merge result of Fig. 2. Posterior image is segmented to super-pixels using the merging result of anterior, which is shown as Fig. 8b.

Fig. 8
figure 8

Example of watershed merge. a Watershed merge on anterior image. b Watershed merge on posterior image

PSC is clearer than cortical in posterior image, and texture can be seen distinctly. The gradient in posterior and anterior image of each super-pixel is compared to judge whether this super-pixel is PSC. Generally, the gradient in posterior image should be bigger than that in anterior image for PSC. However, gradient of PSC in posterior image sometimes is smaller than that in anterior image due to focus and illumination problems. So threshold of gradient difference we use to distinguish PSC and cortical is not fixed. Experiments show that here is linear relationship between the mean gradient ratio and threshold, which is illustrated in Fig. 9. The linear relationship can be described as follows,

$$T_{\text{psc}} = k\frac{{G_{a} }}{{G_{p} }} + b$$
(13)

where G a and G b are the mean gradient of anterior image and posterior image, respectively. In practice, \(k = - 6. 8 0\) and \(b = 7. 2 7\).

Fig. 9
figure 9

Relationship between mean gradient ratio and threshold

Cortical opacity only lies relatively far from the center. Spatial filter is employed, and opacity will be excluded if it lies outside 0.45 times of radius. To avoid noises, pieces less than 50 pixels are removed.

2.2.2 Fusion of MRF and MGC

Segmentation result by MGC may contain backgrounds because of the influence of other texture details in lens and illumination. What is more, spatial merge is rough. Background super-pixel may merge into opacity super-pixel. Opacity detection result via MRF is used to ensure MGC result belongs to opacity. Common parts of result by MGC and opacity detection by MRF are used to post-processing.

Comparing mean gradient has limitations for both group 1 and group 2. PSC in group 1 is light, and area is small. There may be no gradient difference between the two images. If opacity area of MRF result is lower than 5 % of the ROI and it is located within 0.4 of radius, it will be recognized as PSC opacity. In group 2, large area opacity may have pieces in center that is solid and this is hard to distinguish by MGC. Convex hull of opacity is employed to avoid this phenomenon. If merged super-pixels are inside convex hull, it will be added to PSC opacity. Figure 10 shows the process of combination of MRF and MGC. Its original image is shown in Fig. 2. Figure 10c is parts of PSC opacity, but it lacks some pieces in edge and inside the opacity. Convex hull solves this problem, and its result is shown in Fig. 10d.

Fig. 10
figure 10

Combination of MRF and MGC. a MRF result that contains both PSC and cortical cataract. b MGC result which includes pieces in background and cortical cataract. c Common parts of (a) and (b), and the red line is its convex hull. d Final PSC detection result (color figure online)

2.3 Grading

The percentage of opacity areas is calculated, and images are then graded according to Wisconsin grading system. Table 1 shows Wisconsin grading system. Grade 1 means that there is no PSC opacity in the lens. Threshold between grade 2 and grade 3 is 5 %. The greater the grade is, the more serious PSC people suffer.

Table 1 Wisconsin grading system

3 Results

The retro-illumination images we use in this paper are from Singapore Malay Eye Study (SiMES) [6]. SiMES is a population-based study, and the images were taken using Niked EAS-1000 camera.

Cataract data and manual grading results are available. Manual PSC grading follows the Wisconsin cataract grading system [10]. For manual grading, the lens is set into nine sections. Graders estimate opacity levels in each segment and add up them.

Table 2 demonstrates the experimental results in this paper. G stands for grader’s grading results, and AD stands for automatic detection in the table. Total 519 pairs of illumination images are randomly chosen. Among which 317 belong to grade 1, 99 belong to grade 2, and 103 belong to grade 3 according to grader’s grading. The accuracy of each grade is 91.7, 83.8, 91.3 %, respectively. Method in [13] is compared using the same dataset with only posterior images. The results are shown in Table 3. The accuracy of method in [13] is 82.9, 70.7 and 69.2 % for grade 1, 2 and 3, respectively. Accuracy of each grade is improved in the proposed method, especially in grade 3 when PSC opacity is serious. Sensitivity and specificity are used to evaluate the performance of the proposed method:

Table 2 Evaluation of the proposed method
Table 3 Results of the method in [13]
$${\text{Specificity = }}\frac{{{\text{Number}}\;{\text{of}}\;{\text{correctly}}\;{\text{detected}}\;{\text{images}}\;{\text{with}}\;{\text{no}}\;{\text{PSC}}\;{\text{opacity}}{\kern 1pt} }}{{{\text{Number}}\;{\text{of}}\;{\text{images}}\;{\text{with}}\;{\text{no}}\;{\text{PSC}}\;{\text{opacity}}}}$$
(14)
$${\text{Sensitivity = }}\frac{{{\text{Number}}\;{\text{of}}\;{\text{correctly}}\;{\text{detected}}\;{\kern 1pt} {\text{images}}\;{\text{with}}\;{\text{PSC}}\;{\text{opacity}}{\kern 1pt} }}{{{\text{Total}}\;{\text{number}}\;{\text{f images}}\;{\text{with}}\;{\text{PSC}}\;{\text{opacity}}}}$$
(15)

The sensitivity and specificity are 90.7 and 90.1 %, compared with 82.9 and 82.3 % of the method in [13].

4 Discussion

Some segmentation results are shown in Fig. 11a–c and are examples of group 1, and the rest are images in group 2. The percentages of PSC opacity area are 18.75, 40.08, 20.80, 5.24, 5.43 and 5.92 %, respectively, which are manual grading results. Experimental results by our method are 15.84, 37.00, 20.45, 3.52, 4.48 and 4.62 %.

Fig. 11
figure 11

PSC detection result of two different groups. ac belong to group 1 and d, e belong to group 2. The first row is anterior images, and the second row is posterior images. MRF and MGC results are shown in the third row and fourth row, respectively. The fifth row is our final detection results, and the last row is the results by method in [13] for comparison

It can be observed from the figures that the proposed method significantly improves the accuracy of PSC detection when PSC is serious in retro-illumination images. Method in [13] can detect PSC opacity successfully in cases in Fig. 11d–f. When there are strong textures and bright part inside PSC opacity, local threshold and edge detection used in [13] can only detect some parts of opacity. After spatial location filter, only a small part of opacity in the center is left, as shown in Fig. 11a. For (b) and (c), PSC is severe and it overlaps with cortical cataract opacity in retro-illumination image. It is hard to separate them by posterior image or anterior image alone. Edge detection and spatial filter failed to distinguish PSC from cortical when their boundary is not distinct.

Observation data f for opacity and background in MRF model are obtained automatically according to histogram. The proposed method is robust for intensity inhomogeneity. Effect of intensity inhomogeneity is minimized by the method proposed in Sect. 2.1.4. In Sect. 2.1.4, the threshold of gradient and area of MRF pieces are obtained empirically. And parameters k and b as shown in Eq. (13) are obtained empirically. The optimal setting of these parameters may change in a small range for different image acquisition settings.

Our method not only improves the grading accuracy, but also enhances the morphological description of PSC. MRF method is robust inside the opacity cluster. When judging the label, the potential function not only concerns about the super-pixel itself but also concerns about its neighbors. If a super-pixel is surrounded by opacity, it is more likely to have an opacity label. Posterior image focuses on PSC. Its gradient in PSC opacity should be bigger than that in anterior image. Difference of gradient value is then employed to eliminate cortical opacity. Different value of threshold is tested, and experimental results showed that it is hard to choose a threshold that can extract PSC perfectly. Experiments on 300 pairs of image prove that Eq. (13) can exclude cortical opacity in a maximum extent. Gradient comparison alone is not enough to obtain accurate detection of PSC opacity. There are noisy pieces of background in the experimental results of MGC as shown in the fourth row of Fig. 11. And some pieces in PSC opacity center are missed. After combining with MRF result and the usage of the convex hull method, PSC opacity is extracted more accurately.

There is still some over-detection problem for some cases. For example, there is no PSC opacity as shown in Fig. 12a with grader’s grading. Bright textures like water traces seriously affect the precision of MRF. MRF regards the dark parts above bright textures as opacity, and step 3.2.2 failed to exclude them. Mean gradient comparison can reduce the area of opacity. But the water traces texture causes a high gradient ratio between anterior image and posterior image. Threshold is −1.21 according to Eq. (13). A large area of opacity is detected. More features should be considered in PSC detection in the future.

Fig. 12
figure 12

Examples of wrong detection. a Anterior image. Area in yellow ellipse is the water traces textures. b Posterior image. c Detection result with proposed method (color figure online)

5 Conclusions

A new method is proposed to detect PSC opacity automatically. MRF is employed to estimate opacities in retro-illumination images firstly. Watershed is used to have an initial segmentation, and MRF is applied to obtain opacity in the lens. Secondly, mean gradient information is used, and MGC is proposed to extract PSC opacity. Then, MRF model and MGC model are combined, and spatial information is employed to get final result. The sensitivity and specificity are 91.2 and 90.1 %, respectively, with 518 pairs experiment data. Accuracy of PSC detection and grading has been improved compared with available literature. The setting of the parameters is for PSC detection, and thus, the obtained cortical opacity is not very accurate. The algorithm to detect cortical opacity precisely will be investigated in future work.