Enhancement Of Medical Images Using Image Processing In Matlab

DOI : 10.17577/IJERTV2IS4652

Download Full-Text PDF Cite this Publication

Text Only Version

Enhancement Of Medical Images Using Image Processing In Matlab

UdayKumbhar1, Vishal Patil2, Shekhar Rudrakshi3

1,2,3Department of of Electronics Engg. (UG students), T.K.I.E.T. Warananagar ,Maharashtra ,India

Abstract:This paper gives the simple guideline to enhance the Medical images using MATLAB. Medical images are one of the fundamental images, because they are used in more sensitive field which is a medical field. The main goal of this study is to improve features and gain better characteristics of medical images for a right diagnosis. The proposed techniques start by the median filter for removing noise on images followed by unsharp mask filter which is type of sharpening. Medical images were usually poor quality especially in contrast. For solving this problem , we proposed Contrast Limited Adaptive Histogram Equalization (CLAHE) which is one of the techniques in a computer image processing domain , then for smoothing image data we used hereAverage (mean) filter thus eliminating noise.

Key words:Medical images, median filter,unsharp mask,contrast limited adaptive histogram equalization, average filter


Image enhancement:

In image enhancement, the goal is to accentuate certainimage features for subsequent analysis or for image display.Examples include contrast and edge enhancement, pseudocoloring, noise filtering, sharpening and magnifying. Imageenhancement is useful in feature extraction, image analysisand visual information display. The enhancement processitself does not increase the inherent information display in thedata. It simply emphasizes certain specified imagecharacteristics. Enhancement algorithms are generallyinteractive and application dependent.Image enhancement techniques such as contrast stretchingmap each, grey level into another grey level by a pre- determined transformation. An example is thehistogram-equalization method, where the input

levels arematched so that the output grey level distribution is uniform.This has been found to be powerful method of enhancementof low contrast images. Other enhancement techniquesperform local neighborhood operations as in convolution;transform operations as the discrete Fourier transforms[3].It is an indispensable tool for researchers in a wide variety of fields including (but not limited to) medical imaging, art studies, forensics and atmospheric sciences.Thereare several techniques for enhancing digitalimages without spoiling it. The enhancementtechniques can generally be classified in to thefollowing two classes:

  • Spatial domain methods

  • Frequency domain methods

    In spatial domain methods, we directly deal withthe pixels of image. The pixel values are manipulated toachieve coveted enhancement. In frequency domaintechniques, the image is first transferred in to frequencydomain. It means that, the Fourier Transform of theimage is computed first. All operations ofimageenhancement are executed on the Fourier transform ofthe image and then the Inverse Fourier transform isexecuted to obtain the resultant images. Theseenhancement operations are performed in order tomodify the image brightness, contrast or the distributionof the grey levels. As a consequence the pixel value(intensities) of the output image will be modifiedaccording to the transformation function used in severaldomains where images should be analyzed andunderstood[1].



    There are a lot of techniques used in imageenhancement or restoration including low pass filtering,high pass filtering, sobel edge filtering, medianfiltering, histogram equalization

    and its various.Proposed method consists of three steps as following:

  • Median filter for noise reduction

  • UnSharp Mask filter (USM) for edges sharpening

  • Contrast Limited Adaptive Histogram Equalization(CLAHE) for contrast enhancement[1,8]

  • Average (mean) filter for smooth data[2,8]

    Median filter for noise reduction:

    Filtering is a partof image enhancement which is used to enhance certaindetails such as edges in the image that are relevant tothe application. In addition to that, filtering can also beused to eliminate unwantedelements of noise. Medicalimages usually contain salt and pepper noise. This noiseappears due to the presence of minute gray scalevariations in the image.Median filtering is a populartechnique of the image enhancement for removingimpulsenoisewithout effectively reducing the imagesharpness [1].The median filter is a non-linear digital filtering technique,frequently used to remove noise from images. It is mostlyuseful to reduce speckle noise and salt and pepper noise. Itsedge-preserving nature makes it practical in cases where edgeblurring is undesirable.The median filter is defined as follows: To compute theoutput of a median filter, an odd number of sample values areranked, and the median value is used as the filter output. It isreasonable to assume that the signal is of finite length,consisting of samples from X(0) to X(L-1). If the filterswindow length is N=2k+1, the filtering procedure is given by:

    Y(n)= med[X(n – k),…, X(n),…, X(n + k)]

    Where X(n) and Y(n)are the input and the outputsequences, respectively. This is the non recursive Medianfilter. It has been first shown that any sequence of length L isconverted under repeated median filtering to the root signalafter at most (L – 2)/2passes [2, 8].

    Unship mask filter for edges sharpening:

    Unship filtering is an uncomplicated sharpeningprocess that gains its name from the study which itimproves edges and other high frequency componentsin images through a process that deducts a smoothed or unsharp version of

    images from the input images. In ourstudy, the use of the classical unship masking filterafter median filter to reduce of the remained noise andsharpen the edges. Firstly it is obtained a blurred formof the original image. This is carried out by applyingthe low-passfilter, in our case Gaussian blur algorithmusing a small radius. We used a two pixel radius andapplied Gaussian blur filter only two times. The blurredform of the image is then pixel deducted from theoriginal image and so it is obtained thehigh passcomponent. The output image is obtained by adding thehigh-pass component to the original image. Because theoutput image could contain also pixels with negativevalues, it is then normalized. No threshold cutoff wasused. The two steps for the unship mask filter are mentioned below:

  • Unsharp mask filter creates edge images g(x,y)from input images f(x, y) in this Eq. 1.

    g(x,y) = f(x,y) fsmooth(x, y) (1)

    Where, fsmooth(x,y)is a smoothed form of f(x,y) (Gaussian blur algorithm ) as shown in Fig. 1.

  • The edge images from the result of subtractinginput images from low pass signal could be utilizedfor images sharpening by adding it backward intothe input signal, as illustrated in Fig. 2.This function is represented as follows: fsharp(x,y)=f(x,y) + k*g(x, y) (2)

    Where, k is a scaling constant, values for k (k0),forgenerally.When k>1,the process is referred to as Highboost filtering. In our process,we have applied k=1.

    Fig. 1: Spatial sharpening

    Fig. 2: The complete unsharp filtering operator

    The basic advantage of the unsharpfiltering overother sharpening filters is the control flexibleness, because a vast majority of other sharpening filters donot supply any user-adjustable parameters. Unship filtering as other filters enhances fine detail and edgesin digital images[1].

    Contrast Limited Adaptive Histogram Equalization(CLAHE):

    Contrast limited adaptive histogram is atechnique utilized for improving the local contrast ofimages. It is a generalization of ordinary histogramequalization and adaptive histogram equalization.CLAHE does not operate on the whole imageworks like ordinary Histogram Equalization (HE), but itworks on small areas in images, named tiles..Problems associated with HE and AHE can

    Ng = Gray levels number in the contextual region Ncr-x = Pixels number in the x dimension of the contextual region

    Ncr-y = pixels number in the y dimension of the contextual region

    Base on the Eq. 3, the Naccan be calculated by theeq. 4:


    Where, Nacis actual clip-limit; Ncis the maximummultiple of average pixels in each gray level of the contextual region.The original and clipped histograms are shown inFig. 3. In Fig. 3(a) if the number of pixels is greaterthanNc, the pixels will be clipped. The total number ofclippedpixels is defined as Nc, and then the number of pixels distributed averagely into each gray level isgiven by Eq. 5:

    belimited by reducing contrast enhancement particularlyin homogeneous areas. The algorithm

    (Contrast LimitedAdaptive Histogram Equalization



    (CLAHE)) limits theslope associated with the gray level assignment schemeto prevent saturation. This process is accomplished byallowing only a maximum number of pixels in each ofthe bins

    After the above distribution, the remaining numberof clipped pixels is expressed as LP N and then the step of distributed pixels is given by

    associated with the local histograms. Afterclipping the histogram, the clipped pixels are equallyredistributed over the whole histogram to keep the totalhistogram count identical.

    The CLAHE method can be divided into steps to achieve as following:

  • The Medical image is divided into contextual regions which are continuous and non-overlapping.Each contextual region size is M×N (the contextualregions size was set here to 8×8)

  • The histograms of each contextual regions arecalculated

  • The histograms of each contextual regions areclipped (A clip limit was set here to 0.01)The pixels number in the contextual



region isequally, distributed to each gray level. Then the averagenumber of pixels in each gray level is defined as follows:

Fig. 3: Original and clipped histograms (a):

originalhistogram (b): clipped histogram[1]

Nav = Ncr x × Ncr y



Nav= Average number of pixels


Average Filter:

The Average (mean) filter smooth image data, thus eliminating noise. This filter performs spatial filtering on each individual pixel in an image using

the grey level values in a square or rectangular window surrounding each pixel[2].

For Example:

1 2 3

4 5 6 3x3filter window

7 8 9

The Average filter computes the sum of all pixels in the filter window and then divides the sum by the number of pixels in the filter window:

= 1 + 2 + 3

+ 4+. . . +9 /9

Average filter method is also called neighborhood average method. The essential idea of this method is to replacegray scale value of the center pixel by average value of neighborhood pixel gray scale. Its filter features are analyzed as follows: Suppose the noise model is

g(i, j) = f (i, j) + n(i, j) (7)

The image after neighborhood smoothing is


, = 1


(. )

= 1 , (. ) + 1 , (. )


Flowchart describes the image enhancement process using filtering techniques, histogram equalization. Median, Average and Unsharp mask filtering techniques are used to enhance the image in terms of improving the visual aspect of images. In the first step, the original medical image is taken which is in the form of RGB image which is 3D image. In the second step, we are converting RGB image to Gray scale image which is 2D image. In the third step, it can be filtered using median filtering which is used for noise reduction. In the fourth step, it can be improved using unsharp

mask filtering it is used for edge sharpening of the image.

Fig.6: X-RAY image

In the fifth step, it can be improved using contrast enhancement technique specially we are used contrast limited adaptive histogram equalization (CLAHE) . Thereafter, the Average filtering technique is applied for smoothing image data, then the output image is generated. The enhanced images improvement from the original images depends on medical images modalities.


The proposed methods have applied on different partsof the body. Some results are illustrated below[8]:

Fig.4: CT image

(a) (b)

Fig.5: CT image

(a) (b)

(a) (b)

Fig.7:MRI image

  1. (b)


    1. (b)

Fig.9:CT image

(a) (b)

Fig.10: X-RAY image



where ,(a) Original images (b) resultant images after applying proposed method


In the proposed method, we have enhanced medicalimages by effective enhancement algorithms which are median filter, unsharp mask filter,contrast limitedadaptive histogram

equalization and average filter. The proposed methodshave been implemented by MATLAB .


  1. HananSaleh S. Ahmed and Md Jan Nordin

    ,Improving Diagnostic Viewing of Medical Images using Enhancement Algorithms Journal of Computer Science 7 (12): 1831-1838,2011 ISSN


  2. Muhammad LuqmanMuhdZain, I.E., MumtajBegum, Enhancement of Bone FractureImageUsing FilteringTechniques. The International Journal ofVideo and Image Processing and Network Security.Vol.9(10)49-5

  3. Gajanand Gupta,Algorithm for Image Processing Using Improved Median Filter and Comparison of Mean, Median and Improved Median Filter International Journal of Soft Computing and Engineering (IJSCE) ISSN: 2231- 2307, Volume-1, Issue-5, November 2011

  4. Achmad, B., M.M. Mustafa and A. Hussain, 2011.Warped optical-flow inter-frame reconstruction forultrasound image enhancement.,jcssp.2011.1532.1540DOI:10.3844

  5. Chan, R.H., C.W. Ho and M. Nikolova, 2005.Salt-andpeppernoise removal by median- type noisedetectors and detail-preserving regularization. IEEETrans. Image Proc., 14: 1479-

    1485. DOI:10.1109/TIP.2005.852196

  6. Sen, A., L. Lan and K.R. Hoffmann, 2002. Improvedcoronary vessel tracking using non-linear filterenhanced X-ray angiograms. Proceedings of the19th Annual International Conference onEngineering Medicine Biology Society, Oct. 30- Nov. 2, IEEE XPlore Press, Chicago, IL , USA.,pp: 573-576. DOI: 10.1109/IEMBS.1997.757674

  7. Gonzalez, R.C. and R.E. Woods, 2008.Digital ImageProcessing.

  8. MATLAB version 7.10.0. Natick, Massachusetts: The MathWorks Inc., 2010.

Leave a Reply