Medical Image Processing Using Python and Open CV
Medical Image Processing Using Python and Open CV
Abstract. This paper presents the implementation of the Python programming language and the Open CV
library in medical image processing. Medical images play an important role in identifying diseases and
detecting whether organs are functioning properly. Image processing related to medical images is an active
research field where various techniques are used to facilitate diagnosis and various image processing
techniques can be used. In this study, image processing was performed including image preprocessing,
histogram equalization, smoothening, erosion, and dilation. The use of python was chosen because this
programming language is open source with a lot of available resources. The open CV library is also available
free of charge and provides tons of image processing functions. The software can also be installed in a small
Raspberry Pi computer and low electrical power usage making it very suitable as an efficient resource of the
medical image processing system.
1. Introduction
Image processing is image processing that aims to improve the quality of the image so that it is easily interpreted
by humans or machines. Image processing techniques transform images into other images. So, the input is the image
and the output is also an image, but the output image has better quality than the input image. There are two kinds of
images namely continuous images and discrete images. Continuous images are generated from optical systems that
receive analog signals, for example, the human eye and analog cameras. Discrete images are generated through the
process of digitizing continuous images. Some optical systems are equipped with digitization functions so that they
are able to produce discrete images, for example, digital cameras and scanners.
Medical image processing is similar in concept to biomedical signal processing in various dimensions. This
includes analysis, improvement, and appearance [1,2,3]. Images captured through x-ray, ultrasound, MRI, nuclear
medicine, and optical imaging technology. The purpose of this research is to do medical image processing with the
help of the Open CV Python programming language Open CV library [4,5]. Medical imaging concentrates on taking
pictures for diagnostic and therapeutic purposes. Snapshots of physiological and physiological processes in vivo can
be collected through sophisticated sensors and computer technology. Medical imaging technology uses X-rays (CT
scans), sounds (ultrasound), magnetism (MRI), radioactive drugs (nuclear medicine: SPECT, PET) or light
(endoscopy, OCT) to assess the current condition of organs or tissues. and can monitor patients from time to time
for diagnostic evaluations and treatments [6].
Python is a programming language that has an efficient high-level data structure and a simple but effective
approach to object-oriented programming. High-level language means that the python programming language is
close to or similar to everyday language, unlike machine language which is a series of binary codes. Python has
advantages compared to other languages that already exist, including in terms of ease, ability, development,
interaction with users, and the programming paradigm. Another advantage of python is that the python program can
run on Windows and Linux operating systems without making changes. Python is claimed to be a language that
Content from this work may be used under the terms of the Creative Commons Attribution 3.0 licence. Any further distribution
of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.
Published under licence by IOP Publishing Ltd 1
ISNPINSA 2019 IOP Publishing
Journal of Physics: Conference Series 1524 (2020) 012003 doi:10.1088/1742-6596/1524/1/012003
combines capabilities, capabilities, with very clear code syntax, and is equipped with large and comprehensive
standard library functionality [4,5].
The open CV stands for Open Source Computer Vision Library which consists of more than 300 C functions [7].
An open CV can operate on Windows or Linux-based computers. Open CV-Library is a way of applying for the
open-source vision community which is very helpful in the opportunity to update the application of computer vision
in line with the growth of Personal Computer that continues to grow. This software provides a number of image
processing functions, as well as image and pattern analysis functions. Some examples of applications from OpenCV
are Object Identification, Segmentation, and Recognition such as detecting and recognize faces, identify objects,
classify human actions in the video, track camera movements, track moving objects (Irianto, 2010). OpenCV is a
library that is very well known in processing computer vision images. OpenCV is designed for real-time applications
and has good functions for image/video. OpenCV is highly recommended for programmers who will dwell on the
field of computer vision, because this library is able to create applications that are reliable, strong in the field of
digital vision, and have capabilities similar to visual processing in humans.
2. Methods
In this project, we use an open computer vision library, OpenCV. OpenCV (Open Source Computer Vision Library)
is an open-source computer library and machine learning software library. OpenCV was built to provide general
infrastructure for computer vision applications and to accelerate the use of machine perception in commercial
products. Being a BSD licensed product, OpenCV makes it easy for businesses to utilize and modify code. OpenCV
has more than 2500 optimized algorithms, which include a comprehensive set of computer vision and advanced
machine learning and machine algorithms. This algorithm can be used to detect and recognize faces, identify objects,
classify human actions in video, track camera movements, track moving objects, extract 3D object models, generate
3D point clouds from stereo cameras, stitch images together to produce high-resolution images of entire scenes, find
similar images from the image database, delete red eyes from pictures taken using flash, follow eye movements,
recognize scenes and create markers to add them with augmented reality, etc. OpenCV has more than 47 thousand
community users and the estimated number of downloads exceeds 7 million. Libraries are widely used in companies,
research groups, and government agencies. In this project, we utilize OpenCV for medical image processing which
includes operations on pixel intensity, filtering, side detection, and segmentation.
In taking images with the camera, noise always occurs which results in the image becoming not smooth. The
system that we developed can filter so that the image becomes smooth as in Figure 4. A smooth image has a
weakness that is a blur at the edges. So, it is necessary to sharpen the edge boundaries with a high-frequency filter
as in Figure 5.
Edge detection is a medical image processing technique that is widely used for example to find out the contours
of a network and to estimate tissue area. This system can do side detection as well as in Figure 6.
2
ISNPINSA 2019 IOP Publishing
Journal of Physics: Conference Series 1524 (2020) 012003 doi:10.1088/1742-6596/1524/1/012003
Image segmentation is a process aimed at obtaining objects contained in images such as tumors in the brain. With
multiple thresholding, it can be an object that has a certain gray level. Figure 7 is the result of segmentation on
objects that have intensities between 150 to 200. Due to the effect of noise, the segmentation objects have holes and
areas that are not objects have spots. This incident can be overcome by performing a dilation operation to patch
holes and erosion surgery to remove spots as in Figures 8.9 and 10.
4. Conclusion
From the project we are working on it can be concluded that the Python programming language and the OpenCV
library can be used for medical image processing with very good results. Image processing operations such as image
enhancement, noise removal, side detection, contouring, and segmentation can be done well. With its open-source
nature, medical image processing can be done at a cheap price using Python and OpenCV.
Acknowledgment
Financial assistance provided by the Government of the Republic of Indonesia through the Diponegoro University,
Semarang.
References
[1] Igbinosa I E 2013 IJITEE 2 (3)
[2] Liu C, Szeliski R, Kang S B, Zitnick C L and Freeman W T 2008 IEEE Transaction on Pattern Analysis and
Machine Intelligence 30 (2)
3] Jayasree M, Narayanan N K, Kabeer V and Arun C R 2018 SIPIJ 9 (2)
[4] Solem J E 2012 Programming Computer Vision with Python Creative Commons https:// creativecommon.org
[5] Kapur S 2012 Computer Vision with Python 3 Packt Publishing Birmingham UK
3
ISNPINSA 2019 IOP Publishing
Journal of Physics: Conference Series 1524 (2020) 012003 doi:10.1088/1742-6596/1524/1/012003
[6] Rantanen V 2015 Integration Platform for Biomedical Image Analysis Dissertation Faculty of Medicine
University of Helsinki Helsinki Finland
[7] Kaehler A and Bradski G 2016 Learning OpenCV 3 O’ Reilly Media Sebastopol California
[8] Hambal A M, Pei Z and Ishabailu 2017 IJSR 6 (3)
[9] Hamza A, Escamilla P L L, Aroza J M and Roldan R R 1999 JMIV 11 161-177
[10] Dougherty G 2009 Digital Image Processing for Medical Applications Cambridge University Press, Cambridge
UK.
[11] Gupta S and Mazumdar S G 2013 IJCSMR 2 (2)
[12] Walanj V A and Jadhav V K 2015 IJERECE 2 (11)