AN IMPLEMENTATION THAT DIAGNOSIS ANISOCORIA DISEASE USING IMAGE PROCESSING TECHNIQUES

Human pupil abnormalities can be an indicator of many diseases. Anisocoria is a common condition that has been estimated at 20% of the average population. It is specified by inequality in the size of the pupils of the eyes. This paper proposes an anisocoria determining algorithm from a digital image by using the MATLAB computing environment that involves the usage of MATLAB Computer Vision and Image Processing Toolbox. The image used in this work as input data is an image that has been fetched from Siblings Image Database. An input image where anisocoria is present has been downloaded from the Internet. The paper gives an idea of understanding how pupil detection and measurement can be used in medical and psychology diagnostics by using a simple algorithm.


INTRODUCTION
As the old proverb says the face is the mirror of the soul, and the eyes are the gateway to it. Eyes can be a harbinger of body health. Many diseases can be diagnosed with symptoms that can appear in one eye or both eyes. Human pupil abnormalities can be an indicator of diabetes, multiple sclerosis, schizophrenia, autism, Alzheimer and Parkinson diseases, depression, alcohol and drug addiction (Iacoviello, 2006).
The pupil is a black part of the eye that should lie in the centre of the iris (coloured part). The standard shape of the pupil is circular, and small muscles of the iris regulate its size, the sphincter pupillae responsible for constriction and dilator pupillae as its name says for dilation. The pupil gets wider in dim light (5-8 mm), narrower in the bright light (5-8 mm) but under the ordinary conditions of lighting it should appear neither too large nor too small.
The size of the pupil depends on a persons' age; larger pupils are found in small children. Usually, the size of the pupil is the same in each eye, with both eyes dilating or constricting together.
Anisocoria is a condition estimated at 20% of the average population. It is specified by inequality in the size of the pupils of the eyes (See Fig.1 b and c for example), vice versa is isochoric, pupils have the same size.
In the case of anisocoria, size dissimilarity (between left and right eye pupils) is in the range of 0.5 mm to 1mm (Friedman & Kaiser, 2009). When this size divergence is more significant than 1mm, it may be an indication of different diseases of eye, brain and nervous system; also, it may refer to various pathological conditions such as Horner syndrome. This paper tends to suggest an algorithm for human pupil detection from a face shown in a digital image and detect the possible presence of anisocoria by calculating the size difference between the left and right pupil. The proposed algorithm can serve as part of another medical diagnostic program for disease detection. The simplicity and reliability of the program can enable not only ophthalmologists but also non-professionals and laypeople to control their health using telemedicine.

Face and Eye Region Detection
The detection of the face and eye in an image is a well-known research subject often studied in the field of image processing, computer vision, and pattern analysis and classification.
The algorithm that is based on Viola-Jones approach (Viola & Jones, 2004) has been used to detect face and eye region from an input image, which has previously been converted to a grayscale image.
The main reason why grayscale images are used to extract identifiers instead of colour images is that grayscale simplifies the algorithm and reduces computational requirements. Indeed, colour can provide a limited benefit in many applications, and presenting unnecessary information can increase the amount of training data needed to achieve excellent performance. The "rgb2gray" command is used to convert the RGB image to a grayscale image.
A realisation of Viola-Jones algorithm is created with the help of Computer Vision Toolbox build-in classes and functions from the Matlab computing environment.
The Matlab system type object vision.CascadeObjectDetector is used for creating the detector that detects the face and eye-pair region from an input image. By default, this detector is set to detect faces in an image, but it can also detect other parts of the face. The decision if the part of the image in the region of face or eye-pair or not is made by use of Haar-like features (rectangular areas) that are used for the core origin for Haar classifier. After the detector was created, the bounding box is defined by the step method bbox=step(detector, image).  • occlusion (facial hair, glasses with dark lenses, usage of makeup), • media quality parameters (non-uniform illumination, noise, low resolution) can affect the performance of the detection algorithm. So, considering this situation, an input image used in work is a profile image that has been fetched from Siblings Image Database. Images (Fig. 3) from this database are in a resolution of 425x2832 pixels, with the uniformed background. Images have been taken under controlled lighting. Also, those images have been used for cases without anisocoria.

Figure 3: Input data (Samples from the database for the case without anisocoria presence)
Because no database has profile pictures of people for cases where anisocoria is present, a database has been created with images downloaded from the Internet. That is the reason why the algorithm is tested by applying different quality and size images. Some samples of the input image for this case are given in Fig. 4.

Figure 4:
Input data (Samples from the Internet for the case with anisocoria presence)

Pupil Detection and Measurement
In literature, different techniques have been proposed to detect the pupil of the human eye. Review of the literature demonstrates that the method which uses high contrast between the dark intensity of the pupil region and the bright sclera region is commonly used way for pupil detection.
Many algorithms localize pupil region or iris region in some studies with combinations of various image processing methods such as thresholding, morphological operations, linked component analysis, and others with different additional steps. Some algorithms are given as an example in Figure 5.

Algorithms
Thresholding   Histogram generation/ Threshold determination Input Eye Image Figure 6 shows the steps of the proposed method for pupil detection and measurement. Pupil detection is implemented using these image processing techniques: Histogram generation, Image binarization, Connected components labelling, and Centroid-radius calculation. This method is used for the automatic detection of the pupil.

Histogram Generation and Image Binarization
The pupil localization involves the image thresholding and binarization. Converting a grayscale image of an eye to the binary image is based on a threshold. In the detection of the pupil, the purpose of binarization and image thresholding is to divide the eye image into two parts, the pupil and the background. Finding the appropriate threshold value as a general rule has a significant impact on the final result. The darkness of the pupil colour is more or less the same for every human eye, and that is the reason why the same threshold value can be used in this case. The Matlab code used for histogram generation and threshold value determination is shown in Figure 7.  (Figure 8). In case that input image is a binary image, n is two columns. T (threshold value) is selected to remove the object (pupil) from the background. I is a grayscale image. If the value of the point I (x, y) is smaller than the threshold value T, that point is an object point (pupil). Otherwise, the point is the background point: An example of the Grayscale eye image and its histogram is shown in Figure 8.

Labeling Connected Component of Pupil and Pupil Size Measurement
To eliminate noisy pixels and accurately identify the pupil feature from the threshold eye image, the connected component labelling algorithm is used. A region in an image is a set of pixels with similar intensity values adjacent to each other. Areas are tagged with different colours after subtraction. Some results of this step are shown in Figure 8c. Matlab code used for connected component labeling and pupil size measurement is shown in Figure 10.
In Matlab, the bwlabel function is used for labeling a binary image . EI is the input eye image. Pixel connectivity is 8. Pixels are connected when they touch the edges or corners. Two adjacent pixels are part of the same object, if both are connected in horizontal, portrait, or diagonal direction.
rgb is a new lebeled image.The label2rgb function converts the label matrix (rgb image) to RGB image. RGB = label2rgb (L, cmap, zerocolor) indicates the RGB color of the background elements (the labeled pixels are 0). L (labeled) -The label matrix of adjacent regions specified as the m-by-n matrix of nonnegative integers. Background pixels are labeled with 0. Pixels labeled with 1 create an object; pixels labeled with 2 form a second object; and such. cmap (spring) -adjusts the background pixels to cyan color and randomizes how the color is assigned to the label.
This algorithm also determines pupil characteristics. Regionprops returns measurements (Area, Eccentricity, Centroid (Mass center), BoundingBox for the set of properties specified by the properties of each 8-linked component in the binary image (labeled).

Figure 12: Size of the left and right pupil area (the case without anisocoria presence)
Size of left and right eye pupil are measured at this step of pupil detection. The results are shown in Figure 11 and Figure 12. These data were used for anisocoria detection. In the case with anisocoria, it was concluded that one pupil size was at least two times larger than the other.

Figure 13: Matlab code used to determine the presence of anisocoria in the given image
Matlab code used to determine the presence of anisocoria in the given image is shown in Figure  13. Pupil_size_re is the size of the right pupil. Pupil_size_le is the size of the left pupil.

Centroid -Radius Calculation and Visualizing Pupil Contour
Matlab code used for centroid -radius calculation and visualizing pupil contour is shown in Figure 14.
The main idea is to draw a circle with R radius centered in coordinates (Cx, Cy). The circle was created in polar coordinates and then turned into Cartesian coordinates using the pol2cart function. (0,2*pi,nPoints); This line and the next define a circle in polar coordinates. This line of code creates a theta array with nPoints (pupil contour points) ranging from 0 to 2 *π.

rho = ones(1,nPoints) * Pupil.R;
The rho array stores the radius for each defined theta value.
The ones(1,nPoints) command creates a 1xnPoints line matrix filled with ones.

EXPERIMENTAL RESULTS
The performances of the proposed algorithm were analyzed and measured using 75 images (60 images having been randomly selected from the database and 15 downloaded images from the Internet). Detection rates for face area, eyes and pupil (when anisocoria case is not present) are shown in Figure 18 for the random images taken from the Siblings Image Database. Detection rates for images downloaded from the Internet (when anisocoria case is present) are shown in Figure 19.  Figure 19:

Detection rates for face area, eyes and pupil (when anisocoria case is present)
The values of the possible results for the proposed algorithm are given in Figure 20. There are four possible outcomes: • TP (True Positive) anisocoria is present and the test result is positive, • TN (true negative) anisocoria is not present and the test result is negative • FN (False Negative) anisocoria is present and the test result is negative, • FP (False Positive) anisocoria is not present and the test result is positive. Positive  TP=11  FP=22  33  Negative  FN=2  TN=25  27  Total  13 47 60

Figure 20: Probability table and performance measurements
The probability of the proposed algorithm to accurately determine the presence of anisocoria is 85% (Sensitivity). The likelihood of accurately determining the absence of anisocoria is 53% (Specificity).
The Positive Predictive Value (PPV) test result shows how many of the positive ones have anisocoria. PPV value for the proposed algorithm is 33%. Similarly, the Negative Predictive Value (NPV) shows how many of the negative ones do not have anisocoria. The NPV value for the proposed algorithm is 92%.
The False Positive Rate (FPR) is the number of cases tested for the absence of anisocoria but is detected as the present. The FPR value for the proposed algorithm is 46%. The False Negative Rate (FNR) is the number of cases tested in the absence of anisocoria and is determined as absent. The FNR value for the proposed algorithm is 46%.
The performance metric with their calculation equations and result values are given in Figure  21. Image processing techniques can be used to improve the performance of the proposed algorithm. Figure 22 and Figure 23 show the results of right and left pupil detection by use of different methods. When the pupil area detection and measurement is correct, the anisocoria detection performance rate is 100%. From the results that are given in Figure 24, it was concluded that the proposed algorithm gives the best results when it is used in conjunction with the median filter and morphological opening. The detection rate for the right eye increased by 20% and for the left eye, it increased by 18%. Detection performances of different methods were analyzed for 50 images.

CONCLUSION
This paper provides information about the proposed automatic algorithm for the detection of anisocoria from a digital image using image processing techniques. This algorithm combines face detection, eye detection, and pupil detection and measurement from a digital image of a person that may have anisocoria.
The proposed algorithm determines the anisocoria state using the size information from the adult human pupil. The main factors that have an effect on anisocoria determination are the accuracy of the detection and visualization of the pupil. When the pupil area detection and measurement is correct, the anisocoria detection performance rate is 100%. For future studies, it will be useful to focus on pupil detection.
One of the factors that also affect the result is that not all images have the same quality. The proposed algorithm tests were carried out on 75 images with different features. The test result showed that the proposed algorithm had an accuracy rate of 60%. Image processing techniques could be used to improve the performance of the proposed algorithm. The proposed algorithm was used in conjunction with a median filter and basic morphology operations to improve pupil detection. After testing, it was concluded that the proposed algorithm gives the best results in combination with the median filter and morphological opening.
In the future database that will contain images of person with and without anisocoria should be created. Images will be taken under controlled conditions that will for sure, affect testing result accuracy and improve this algorithm performance.
All algorithms steps, described in this paper, are done in MATLAB R2016 computing environment. Graphical user interface (GUI) for proposed algorithm in this paper was developed to make its use easier for the user because pupil detection and size measurement is the crucial step of many applications in different fields such as ophthalmology, computer vision, psychology, etc.