Proceedings of 1st International Conference on Computing Technologies, Tools and Applications
________________________________________________________________________
Analysis of Pre-Processing Techniques for Ophthalmic Images
Maria Ali*, Abdullah Khan, Muhammad Nouman Atta, Arbab Waseem Abbas, Arshad Khan and
Muhammad Asim
Institute of Computer Sciences and Information Technology (ICS/IT), The University of Agriculture Peshawar, Pakistan.
*Corresspond Author: mariaalikhan515@[Link]
Abstract: Image processing is manipulating digital images to enhance them, reduce their size, or extract useful information
from them. This can involve a variety of techniques, such as filtering, segmentation, edge detection, feature extraction, image
transformation, and image recognition. Images can often be too large or too small that make difficulties for the image
processing algorithms to extract useful information from them. This can lead to poor results, as the algorithm may not be able
to effectively process the image. Poor image quality can also lead to poor results, as image recognition algorithms may not be
able to extract useful information from a low-quality image. Different image processing algorithms may require different color
spaces, and it is important to ensure that the image is in the correct color space for the algorithm to be effective. Therefore,
this paper used a data augmentation program that creates multiple variations of a given image. This paper applies different
image processing techniques such as color space extracting, rotation, adaptive thresholding, morphological operations, image
gradients, canny edge detection, contours, histogram equalization, template matching and color manipulation. This paper
manipulates the given image in order to create multiple variations of the same image, which can be used to improve the
performance of machine learning algorithms.
Keywords: Adaptive Threshold; Edge Detection; Template Matching; Rotation; Brightness; Color Manipulation
overview of the various preprocessing techniques used in this
I. INTRODUCTION research.
Medical diagnostic imaging is a vital component of Noisy, inconsistency, and incomplete data make
medical treatment, as well as in various medical applications. preprocessing crucial for achieving high-accuracy results. CT
X-ray, CT, MRI, SPECT, PET, and ultrasound are the most and MRI images contain patient-specific, equipment-based,
common techniques employed for medical imaging [1]. ring, staircase, and volume effect artifacts. Pre-processing
Medical image processing has been extremely beneficial to procedures are needed to remove all these before analysis.
medical applications, such as image registration and This paper proposes different de-noising approaches [5].
segmentation. X-ray imaging, which has been utilized by
physicians for over a century, is the oldest application of this A. Color-Space
technology [2]. X-ray imaging uses electromagnetic radiation
The four most widely used methods of more than 150
with short wavelengths and high energy. CT (computed
available color-spaces are explored in this research, which are
tomography) is another method that employs X-rays to view
red, green, blue, and gray.
internal body organs and structures. Passing X-ray pulses
through the body creates several parallel slices [3]. MRI 𝑅𝑒𝑑 = 𝐼𝑚𝑎𝑔𝑒[: , : ,0]
(magnetic resonance imaging) is another approach that uses 𝐺𝑟𝑒𝑒𝑛 = 𝐼𝑚𝑎𝑔𝑒[: , : ,1]
magnetic properties to provide detailed information about 𝐵𝑙𝑢𝑒 = 𝐼𝑚𝑎𝑔𝑒[: , : ,2] (1)
inner organs. In MRI, producing several parallel slices of 𝐺𝑟𝑎𝑦 = α ∗ 𝑅 + β ∗ 𝐺 + γ ∗ 𝐵
organs in three dimensions has the significant downside of
requiring high volumes of data to be manually analyzed, Where α, β and γ are the coefficient values for grayscale.
which is tedious and time-consuming. Furthermore, this B. Rotation
imaging technique is prone to noise, low intensity and low
contrast. X-ray and CT (computed tomography) imaging are This technique corrects image skewness when the object
often utilized as the basis for radiation treatments. Most is not perpendicular to the camera.
physicians prefer CT imaging for assessing the parameters of α β (1 − α). o − β. o. y
the heart and the presence of stenosis in blood vessels. Image 𝐼=[ ] (2)
−β α β. o. x + (1 − α). o. y
segmentation, registration, visualization, and simulation are
four fundamental problems of medical imaging and its Where α is the dot product of the scaled image and cosθ,
processing. Image segmentation is currently the most 𝛽 is the dot product of the scaled image and sinθ, and o
challenging problem in image processing. Various represents the center.
segmentation methods have been employed to feature the
body and tissues [4]. This paper is about an overview of
C. Adaptive Threshold
multifarious pre-processing and segmentation methods used An image processing technique to automatically
for Ophthalmic Images. The next section will give an determine the threshold value for each pixel based on the local
May 9–11, 2023 Institute of Computer Sciences and Information Technology (ICS/IT), The University of Agriculture Peshawar, Pakistan
269
neighborhood of that pixel. It is helpful for images with 2. These techniques will be used to enhance the quality of
uneven illumination or variations in contrast. the image for better performance of machine learning
algorithms.
𝑇(𝑥, 𝑦) = 𝑚𝑒𝑎𝑛(𝑥, 𝑦) − 𝐶 (3)
3. This technique will overcome the low performance of
Where T(x,y) is the threshold value for a pixel location
different techniques for the medical images diagnosing.
(x,y) and C is a constant value.
4. These techniques will also help for efficiently diagnosing
D. Morphological Operations the diseases in ophthalmic images.
These transformations are performed on binary images The subsequent sections of the paper are structured as
based on the image shape. It has two inputs, one is the original follows: Section 2 presents a review of relevant literature.
image, and the second is the structuring element or kernel, Section 3 outlines the methodology employed, along with the
which decides the nature of the operation. Erosion and dilation flowchart and pseudo-code. Section 4 describes the
are two basic morphological operations, variants of these experiments conducted, including a simulation discussion of
forms opening, closing, gradient, etc. Their results are shown the proposed algorithm. Finally, Section 5 summarizes the
one by one in section IV with the help of following: research findings, provides recommendations, and suggests
Dilation: future directions for the proposed scheme.
𝐷(𝑥, 𝑦) = max(𝑓(𝑥 − 𝑖, 𝑦 − 𝑗) + 𝐵(𝑖, 𝑗))
Erorion: II. LITERATURE REVIEW
𝐷(𝑥, 𝑦) = min(𝑓(𝑥 + 𝑖, 𝑦 + 𝑗) − 𝐵(𝑖, 𝑗))
(4) In [6] the author used measures proposed by John F.
Opening:
Canny to investigate the performance of a Gabor filter-based
𝑂(𝑥, 𝑦) = D(E(𝑓(𝑥, 𝑦)), B) edge detector. The authors derive a design criterion for a 1D
Closing:
Gabor filter-based edge detector that also holds good for a 2D
𝐶(𝑥, 𝑦) = E(D(𝑓(𝑥, 𝑦)), B) Gabor filter-based edge detector. The conducted experiments
E. Image Gradients exhibit the significance of the Gabor filter-based edge
detector. Another paper in [7] presents an adaptive median
It is a Gaussian smoothing and differentiation operation filter to eliminate salt-and-pepper noise from medical images.
that is resistant to noise. Its effectiveness is assessed by PSNR, MSE, UQI, and SSIM
noise to the actual image, and performance is tested in a virtual
𝐺 = √𝐺𝑥 2 + 𝐺𝑦 2 (5)
endoscope system. Simulation results show that the method is
where Gx and Gy are the horizontal and vertical gradients, effective in removing the noise while preserving the edges and
respectively. detailed information about the objects. It also analyzed the
impact of filter window size and noise density on the de-
F. Canny Edge Detection noising quality. Where in [8] this paper presents an enhanced
It is a multi-stage edge detection algorithm developed by image segmentation approach based on morphological
and named after John F. Canny. The steps include noise reconstruction. The approach utilizes erosion and dilation
reduction, intensity gradient, NMS, and hysteresis operations to morphologically mark and reshape catchment
thresholding. basins for objects of all sizes to ensure accurate watershed
transformation in the final step of segmentation. Experiment
𝐺 = |𝐺𝑥| + |𝐺𝑦| (6) results revealed that the proposed method is more accurate in
G. Contours complex image segmentation than traditional methods.
Similarly, [9] present a reviews on medical image morphology
It detects and identifies the boundaries of objects in an and its applications in the development of computer-aided
image with a black background. It is practical for shape diagnostic systems. The study discusses the images of various
analysis, object detection, and recognition. human organs and the associated diseases, as well as the
processing techniques used to detect anatomical problems.
H. Histogram Equalization
In [4] this paper discusses various preprocessing and
It redistributes the pixel intensities to improve the contrast
segmentation methods with their benefits and weaknesses.
of an image.
Pixel and region-based thresholding are the most superficial
I. Template Matching but have limited applications. Other methods such as Gabor,
Histogram Equalization, Fuzzy C-Means, Neural Network-
It is a searching technique to find the location of a template based, and Genetic Algorithm-based segmentation are also
image in the original one. discussed. These algorithms require systematic supervision
J. Color Manipulation and training, and the performance is dependent on the used
training data. The paper concludes that medical image
It is adjusting of the brightness and contrast of an image. segmentation algorithms should be accurate, reliable, robust,
The main contribution of this paper is given as: and least dependent on the operator. The paper in [10]
1. This paper used different image preprocessing techniques proposes an iterative 3D multi-scale Otsu thresholding
for ophthalmic image. algorithm for medical image segmentation. The algorithm
eliminates the effects of noise and weak edges by representing
images at multiple levels.
Proceedings of 1st International Conference on Computing Technologies, Tools and Applications (ICTAPP-23)
270
III. METHODOLOGY histogram equalization, template matching, and color
manipulation. At the end of for loop (line no. 5), all the
This section describe the methodology process of this preprocessed images saved at the mentioned output directory
paper. The process consist of different steps which are given (line no. 2 & 6).
in Figure 1. The images are acquired from kaggle:
[Link]
IV. RESULTS & DISCUSSION
dataset and stored at custom directory. Then images are loaded
from the directory to jupyter notebook for the various image A. Preliminaries
preprocessing techniques. All these techniques are evaluated
and its simulation results are discussed in section-IV in detail. This Research focuses on the use of various preprocessing
techniques for ophthalmic images.
The Eye Disease Dataset taken from kaggle:
[Link]
dataset. To carry out the simulation result the CPU used
equipped with a 2.50-GHz processor, 12-GB of RAM while
the operating system used is Microsoft Windows 10. For
simulations purposes, Jupyter software is used to run the
techniques.
B. Result Performance
In this paper various preprocessing techniques are
proposed to analyze ophthalmic images. The evaluation of the
used preprocessing techniques are given as under.
i. Color-Space
The color spaces as an image preprocessing technique
which is used to transform different color channels. The
performance evaluation of color space techniques are
mentioned in Figure 2.
Figure 1: Research Methodology
Pseudo Code
1. Start Original Red Green Blue Gray
2. Initialize: I/O paths and preprocessing methods Figure 2: Color Space Images
3. Input: Ophthalmic Images ii. Rotation
4. For Loop: for file in files:
The rotation technique is used to change the angle of an
i. colorspaces(arguments) image to show the image in different angles. Figure 3 give the
ii. rotation(arguments) experimental result of image rotation using this technique.
iii. adaptive_threshold(arguments)
iv. morphological_operations(arguments)
v. image_gradients(arguments)
vi. canny_edge_detection(arguments)
vii. contours(arguments) Original Rotated
viii. histogram_equalization(arguments) Figure 3: Image Rotation
ix. template matching(arguments) iii. Adaptive Threshold
x. color manipulation(arguments) The evaluation performance of the adaptive threshold
5. End: For Loop (line no. 4) technique is given in Figure 4. This technique convert the
6. Output: Processed Ophthalmic Images image with uneven illumination or variations in contrast.
7. End
It starts with the initialization of the input and output
directories and the method creation of discussed
preprocessing techniques (line no. 2). Then run a for loop (line
no. 4) on images calling the preprocessing techniques such as Original Adaptive Threshold
color space, rotation, adaptive thresholding, morphological Figure 4: Adaptive Threshold Image
operations, image gradients, canny edge detection, contours,
Proceedings of 1st International Conference on Computing Technologies, Tools and Applications (ICTAPP-23)
271
iv. Morphological Operations
Morphological operation is mostly used technique for
medical image processing. In this technique the original image
are shown into different insightful images such as erosion,
dilation, opening and closing. This study evaluates all the used Original Histogram Equalizer
operations on the original image which is given in Figure 5. Figure 9: Histogram Equilized Image
ix. Template Matching
This technique is used compare the features of the
template image with the original one and detect the matching
features and generate the original image with matching result.
Original Erosion Dilation Opening Closing
Figure 10 give the simulation result of the template matching
Figure 5: Image Morphological Operations techniques.
v. Image Gradients
Image gradient operation is used to extract features from
x-axis, y-axis and combine (x,y) axis for magnitude. Figure 6
give the experimental results of image gradient techniques.
Original Template Matching
Figure 10: Template Matching Result
x. Color Manipulation
The color manipulation technique convert the original
Original X-Axis Y-Axis Magnitude
image into different color features. In this technique the
Figure 6: Result of Image Gradient original image can be converted into different colors as given
in Figure 11.
vi. Canny Edge Detection
The canny edge detection preprocessing technique is used
to detect edges by reducing noise, intensifying gradient,
applying suppress operation and hysteresis thresholding.
Figure 7 show the canny edge detection result.
Original Color-1 Color-2 Color-3
Figure 11: Image Color Manipulation
C. Discussion
Original Canny Edge This paper demonstrates the usefulness of preprocessing
techniques in ophthalmic image with results in Figures 2-11.
Figure 7: Canny Edge Detected Image The techniques include color-space conversion, rotation,
vii. Contours adaptive thresholding, morphological operations, image
gradient techniques, canny edge detection, contours,
This technique is used to detect and identify the histogram equalization, template matching, and color
boundaries of objects in an image with black background. It a manipulation. The evaluation results show that these
useful tool for shape analysis, object detection and techniques can significantly impact the visual appearance of
recognition. Figure 8 give the evaluation performance of this an image and enhance its quality for further processing and
technique with the original image. analysis. Color space conversion is effective in converting
color channels, while rotation presents the same image in
different orientations. Adaptive thresholding converts uneven
illumination or contrast variations into a binary image, and
morphological operations transform the original image into
erosion, dilation, opening, and closing insightful images.
Original Contour-1 Contour-2 Contour-3 Image gradient techniques are useful in identifying edges and
Figure 8: Contours Image Result gradients, while canny edge detection accurately detect edges.
Contours are effective in detecting object boundaries, while
viii. Histogram Equalization histogram equalization improves image contrast. Template
This processing technique redistributes the pixel matching accurately detects matching features, and color
intensities to improve the contrast of an image. Figure 9 give manipulation aids in further processing and analysis.
the histogram equalization image result.
Proceedings of 1st International Conference on Computing Technologies, Tools and Applications (ICTAPP-23)
272
V. CONCLUSION & FUTURE WORK color manipulation, that significantly impact the visual
appearance of an image and enhance its quality for further
In conclusion, this paper provides a comprehensive processing and analysis. The results presented in Figures 2-11
evaluation of various preprocessing techniques. These indicate that these techniques can be useful in converting color
techniques have significant potential for improving the channels, presenting the same image in different orientations,
analysis of ophthalmic images and advancing the field of converting uneven illumination or contrast variations into a
ophthalmology. These techniques, including color-space binary image, identifying edges and gradients, detecting
conversion, rotation, adaptive thresholding, morphological object boundaries, improving image contrast, accurately
operations, image gradient techniques, canny edge detection, detecting matching features, and aiding in further processing
contours, histogram equalization, template matching, and and analysis.
REFERENCES
[1] D. Brzakovic, X. M. Luo and P. Brzakovic, "An Approach to Automated Detection of Tumors in Mammograms",
IEEE Transactions on Medical Imaging, vol. 9, no. 3, pp. 233-241, 1990.
[2] K. Le, "A Design of a Computer-Aided Diagnostic Tool for Chest X-Ray Analysis", International Journal of
Computer Science and Information Technology, vol. 3, no. 2, pp. 212-222, 2011.
[3] A. S. Krishna, G. S. Rao and M. Sravya, "Contrast Enhancement Techniques using Histogram Equalization Methods
on Color Images with Poor Lightning", vol. 3, no. 4, pp. 15-24, 2013.
[4] R. B. Jeyavathana, R. Balasubramanian and A. A. Pandian, "A Survey: Analysis on Pre-Processing and Segmentation
Techniques for Medical Images," International Journal of Research and Scientific Innovation, vol. 3, no. 6, pp. 113-
120, 2016.
[5] N. R. Pal and S. K. Pal, "A Review on Image Segmentation Techniques Pattern Recognition", Pattern Recognition,
vol. 26, no. 9, pp. 1277-1294, 1993.
[6] R. Mehrotra, K. R. Namuduri and N. Ranganathan, "Gabor Filter-Based Edge Detection", Pattern Recognition, vol.
25, no. 12, pp. 1479-1494, 1992.
[7] A. Bhatia, "Salt and Pepper Noise Elimination in Medical Image Based on Median Filter Method", International
Journal of Electrical, Electronics and Data Communication, vol. 1, no. 6, pp. 2320-2084, 2013.
[8] Y. Wu, X. Peng, K. Ruan and Z. Hu, "Improved Image Segmentation Method Based on Morphological
Reconstruction", Multimedia Tools and Applications, vol. 76, pp. 19781-19793, 2017.
[9] I. Irum, M. Raza and M. Sharif, "Morphological Techniques for Medical Images: A Review", Research Journal of
Applied Sciences, Engineering and Technology, vol. 4, no. 17, pp. 2948-2962, 2012.
[10] Y. Feng, H. Zhao, X. Li, X. Zhang and H. Li, "A Multi-Scale 3D Otsu Thresholding Algorithm for Medical Image
Segmentation", vol. 60, pp. 186-199, 2017.
Proceedings of 1st International Conference on Computing Technologies, Tools and Applications (ICTAPP-23)