dip image enhancement

Upload: sachita-nand-mishra

Post on 03-Jun-2018

240 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 DIP Image Enhancement

    1/99

    Image FundamentalsImage Fundamentals

    What is an image?

    An image is a 2D function I(x,y), where x and y

    are spatial coordinates and the value of I at anypair of coordinates (x,y) is called the intensity orgray level.

    When (x,y) and the amplitude values of I all arefinite and discrete then the image is a DigitalImage.

    Digital Image is a 2D array of numbersrepresenting the sampled version of an image

  • 8/12/2019 DIP Image Enhancement

    2/99

    PixelPixel

    - The images are defined over a grid. Eachgrid location is called as picture elements or

    most popularly as Pixel.

    What is Digital Image Processing (DIP)?

    DIP is manipulation of an image to improve orchange some qualities of the image. DIPencompasses all the various operations done

    through a digital processor which can beapplied to image data.

  • 8/12/2019 DIP Image Enhancement

    3/99

    Why image processing?Why image processing?

    Two goals of Image Processing:

    - Improvement of pictorial information for human

    interpretation.

    OR

    - Processing of scene data for automatic machineperception

    Image Processing may be considered as the

    preprocessing for a Pattern Recognition System

  • 8/12/2019 DIP Image Enhancement

    4/99

    Related Areas of Image ProcessingRelated Areas of Image Processing

    Image Processing:

    Input: Image ---- Output: Image

    Image Analysis/Understanding:

    Input: Image ---- Output: Measurements

    Computer Vision:

    Input: Image ---- Output: High-level

    description

  • 8/12/2019 DIP Image Enhancement

    5/99

    Aspects of image processingAspects of image processing

    Processing of image

    Low levelQuality improvement

    Mid levelFeature/attribute extraction

    High levelEmulation of HumanVision

    Image

    Processing

    Image

    Processing

    Computer

    Vision

  • 8/12/2019 DIP Image Enhancement

    6/99

    Black & White and Colour ImagesBlack & White and Colour Images

    Black & white images are depicted by gray levels,they dont have any colour information.

    A (digital) colour image is a digital image thatincludes colour information for each pixel.

    - A colour image is typically represented by BITdepth. With a 24-BIT image, the BITs are oftendivided into three groupings: 8 for Red, 8 for Green,

    and 8 for Blue. Combinations of those bits are usedto represent other composite colours. A 24-BITimage offers 16.7 million different colour values.

  • 8/12/2019 DIP Image Enhancement

    7/99

    Image EnhancementImage Enhancement

    The purpose of image enhancement is toprocess an image so that the result is more

    suitable than the original image for a specificapplication

    Two approaches of image enhancement: Spatial domain methods

    - direct manipulation of pixels Frequency domain methods

    - based on modifying the Fourier transform

  • 8/12/2019 DIP Image Enhancement

    8/99

    Spatial Domain MethodsSpatial Domain Methods

    In spatial domain image enhancement

    methods, manipulations are done directlyon the pixels

    Here,

    f(x,y) is the input imageTis the operator

    g(x,y) is the processed (enhanced) image

    )],([),( yxfTyxg =

  • 8/12/2019 DIP Image Enhancement

    9/99

    Image enhancement in spatialImage enhancement in spatial

    domaindomain Two methods of processing in spatial domain:

    - Point processing

    s=T(r)

    Enhancement at any point depends only onthe gray level of that point

    - Mask processingProcessing is done using gray levels of pixel

    neighbourhood

  • 8/12/2019 DIP Image Enhancement

    10/99

    Image enhancement in spatialImage enhancement in spatial

    domaindomain Point processing

    - When the neighbourhood is of size 1 x 1 (that isa single pixel) then gdepends only on the value

    of fat (x,y) and Tbecomes a gray-level (or

    intensity or mapping) transformation function as:s=T(r)

    r& s are the gray levels of f(x,y) and g(x,y) at (x,y)- Point processing methods are based only on the

    intensity of single pixels

  • 8/12/2019 DIP Image Enhancement

    11/99

    Image enhancement in spatialImage enhancement in spatial

    domaindomain Contrast stretching

    - A simple method of image enhancementusing point processing

  • 8/12/2019 DIP Image Enhancement

    12/99

    A 3x3 Mask

    Image enhancement in spatialImage enhancement in spatial

    domaindomain Mask:

    Mask is small 2-D array of pixels. It is alsocalled as kernel or template or window or

    filter

    Mask processing or filtering:

    - Processing is done using mask co-efficients

    p

  • 8/12/2019 DIP Image Enhancement

    13/99

    Image enhancement in spatialImage enhancement in spatial

    domaindomain

    A neighbourhood about (x,y) is defined by using a square (orrectangular) sub-image area centered at (x,y)

  • 8/12/2019 DIP Image Enhancement

    14/99

    Some Basic Gray LevelSome Basic Gray Level

    TransformationsTransformations Image negatives

    Log Transformations Power Law Transformations

    Piecewise-Linear TransformationFunctions:

    Contrast stretching Gray-level slicing

    Bit-plane slicing

  • 8/12/2019 DIP Image Enhancement

    15/99

    Linear: Negative, Identity

    Logarithmic: Log, Inverse Log

    Power-Law: nth power, nth root

    Some Basic Gray LevelSome Basic Gray Level

    TransformationsTransformations

  • 8/12/2019 DIP Image Enhancement

    16/99

    Image NegativesImage Negatives

    Function reverses the order from black to white

    so that the intensity of the output image

    decreases as the intensity of the input increases.

    The negative of an image with gray levels in the

    range [0,L-1] is obtained by using the negativetransformation given as:

    s=(L-1)-r

    - Image negatives are used mainly in medical

    images and to produce slides of the screen

  • 8/12/2019 DIP Image Enhancement

    17/99

    Image NegativesImage Negatives

    Image negative function:

    s=(L-1)-rOutput gray

    levels

    0 L-1 input gray levels

    L-1

  • 8/12/2019 DIP Image Enhancement

    18/99

    Image enhancement in spatialImage enhancement in spatial

    domaindomain

  • 8/12/2019 DIP Image Enhancement

    19/99

    Log TransformationsLog Transformations

    s = c log(1+r)

    c is a constant& 0 r

    Compresses the dynamic range of images

    with large variations in pixel values

    I h i i l

  • 8/12/2019 DIP Image Enhancement

    20/99

    Image enhancement in spatialImage enhancement in spatial

    domaindomain

  • 8/12/2019 DIP Image Enhancement

    21/99

    PowerPower--Law TransformationsLaw Transformations

    It is has the basic form as

    c & are positive constants

    To account an offset

    is the offset

    Gamma correction:

    - It is a process used to correct power-law

    response phenomena

    ( )s c r

    = +

    crs =

    PP L T f tiL T f ti

  • 8/12/2019 DIP Image Enhancement

    22/99

    =c=1: identity

    PowerPower--Law TransformationsLaw Transformations

  • 8/12/2019 DIP Image Enhancement

    23/99

    Gamma correction in CRTGamma correction in CRT

    Application of PowerApplication of Power LawLaw

  • 8/12/2019 DIP Image Enhancement

    24/99

    Application of PowerApplication of Power--LawLaw

    TransformationsTransformations

    Pi iPi i Li T f tiLi T f ti

  • 8/12/2019 DIP Image Enhancement

    25/99

    PiecewisePiecewise--Linear TransformationLinear Transformation

    Contrast Stretching- To increase the dynamic range of the gray levels

    in the image being processed

    C t t St t hiC t t St t hi

  • 8/12/2019 DIP Image Enhancement

    26/99

    Contrast StretchingContrast Stretching

  • 8/12/2019 DIP Image Enhancement

    27/99

    Contrast StretchingContrast Stretching

    The locations of (r1,s1) and (r2,s2) guides

    the characteristics of the transformation

    function

    If r1= s

    1and r

    2= s

    2the transformation is a

    linear function and produces no changes

    If r1=r2, s1=0 and s2=L-1, the transformationbecomes a thresholding function that results a

    binary image (that has two gray levels)

  • 8/12/2019 DIP Image Enhancement

    28/99

    Contrast StretchingContrast Stretching

    -Intermediate values of (r1,s1) and (r2,s2)

    produce various degrees of spread in the

    gray levels of the output image, thus

    affecting its contrast.

    Generally, it is assumed that

    r1r2

    & s1s2

  • 8/12/2019 DIP Image Enhancement

    29/99

    GrayGray--Level SlicingLevel Slicing

    Used to highlight a specific range of gray

    levels in an image

    One approach is to

    display a high value for all

    gray levels in the range of

    interest and a low valuefor all other gray levels, so

    it produces binary image

  • 8/12/2019 DIP Image Enhancement

    30/99

    GrayGray--Level SlicingLevel Slicing

    The second approach is to brighten the desired

    range of gray levels but to preserve the

    background and gray-level tonalities in the

    image

    Image enhancement in spatialImage enhancement in spatial

  • 8/12/2019 DIP Image Enhancement

    31/99

    g pg p

    domaindomain

    BITBIT Plane SlicingPlane Slicing

  • 8/12/2019 DIP Image Enhancement

    32/99

    BITBIT--Plane SlicingPlane Slicing

    To highlight the contribution made to the total imageappearance by specific BIT in the image

    In a gray level image of 8-BIT, each pixel isrepresented by 8 BITs. So, it can be consideredthat the image is composed of eight 1-BIT plan

    (BIT plan 0 to BIT plan 7)

    BIT plane 0 contains the least significant BIT(LSB) and plane 7 contains the most significantBIT (MSB)

  • 8/12/2019 DIP Image Enhancement

    33/99

    BITBIT--Plane SlicingPlane Slicing

    The higher order BITs (top four) contain the

    majority of visually significant data. The other BIT

    planes contribute the more subtle details in theimage

    Binary image can be obtained from BIT planslicing. Plane 7 corresponds exactly with an image

    thresholded at gray level 128

    That is- Pixel values between 0 to 127 0

    - Pixel values between 128 to 255 1

    BIT Plan Representation of anBIT Plan Representation of an

  • 8/12/2019 DIP Image Enhancement

    34/99

    BIT Plan Representation of anBIT Plan Representation of an

    ImageImage

  • 8/12/2019 DIP Image Enhancement

    35/99

    BIT Plan Slicing of an ImageBIT Plan Slicing of an Image

    BIT Pl Sli i f IBIT Plan Slicing of an Image

  • 8/12/2019 DIP Image Enhancement

    36/99

    BIT Plan Slicing of an ImageBIT Plan Slicing of an Image

    Image enhancement in spatialImage enhancement in spatial

  • 8/12/2019 DIP Image Enhancement

    37/99

    Image enhancement in spatialImage enhancement in spatial

    domaindomainHistogram: The plot of gray level (X-axis) versus number ofpixels with that gray level (Y-axis) is called a histogram

    It is a discrete function h(l)=nlWhere l [0, L-1]is a gray value

    nl= no. of pixels in the image having gray levell

    Normalized Histogram:

    It gives an estimate of the probability of occurrence of gray

    level lNormalized histogramp(l)=nl/n

    Where n=total number of pixels in an image

    Image enhancement in spatialImage enhancement in spatial

  • 8/12/2019 DIP Image Enhancement

    38/99

    Image enhancement in spatialImage enhancement in spatial

    domaindomain Histogram transformation

    Dark image Bright image

    Low-contrast image High contrast image

    Hi t P iHi t P i

  • 8/12/2019 DIP Image Enhancement

    39/99

    Histogram ProcessingHistogram Processing

    The shape of the histogram of an image doesprovide useful information about the possibility

    for contrast enhancement

    Types of processing:- Histogram equalization

    - Histogram matching (specification)

    - Local enhancement- Use of Histogram statistics for image

    enhancement

    Histogram Equalization

  • 8/12/2019 DIP Image Enhancement

    40/99

    Histogram Equalization

    For gray levels that take on discrete values, wedeal with probabilities:p(rk)=nk/n

    The technique used for obtaining a uniformhistogram is known as histogram equalization (or

    histogram linearization)

    Histogram equalization results are similar to

    contrast stretching but offer the advantage of fullautomation

    Histogram equalizationHistogram equalization

  • 8/12/2019 DIP Image Enhancement

    41/99

    Histogram equalizationHistogram equalization

    Expand pixels in peaks over a wider range of

    gray-levels

    Squeeze low plans pixels into a narrower

    range of gray levels

    Flat histogram.

    Histogram equalizationHistogram equalization

  • 8/12/2019 DIP Image Enhancement

    42/99

    Histogram equalizationHistogram equalization

    To equalize the histogram, probabilities of

    occurrences of the gray levels in the image are

    taken into account.- That is the normalized histogram is used to

    spread the histogram throughout the range of

    the gray level of the image.

    The transformation is

    ( )0 0

    ( )k k

    j

    k k r j

    j j

    ns T r P r

    n= == = =

    Hi t li tiHistogram equalization

  • 8/12/2019 DIP Image Enhancement

    43/99

    Histogram equalizationHistogram equalization

    Histogram matching/specificationHistogram matching/specification

  • 8/12/2019 DIP Image Enhancement

    44/99

    g g pg g p

    Histogram equalization does not allow interactiveimage enhancement and generates only one result

    that is an approximation to a uniform histogram

    Sometimes though, particular histogram shapes are

    specified to highlight certain gray-level ranges

    - The method used to generate a processed image

    that has a specified histogram is called

    histogram matching orhistogram specification

    Histogram matching/specificationHistogram matching/specification

  • 8/12/2019 DIP Image Enhancement

    45/99

    Histogram matching/specificationHistogram matching/specification

    The procedure for histogram-specification basedenhancement is:

    1. Obtain the histogram of the given image

    2. Use the following equation to pre-compute a

    mapped levelsk for each level of rk

    ( )0 0( )

    k kj

    k k r j

    j j

    ns T r P r

    n= == = =

    Histogram matching/specificationHistogram matching/specification

  • 8/12/2019 DIP Image Enhancement

    46/99

    Histogram matching/specificationg g p

    3. Obtain the transformation function G from the givenpz(z)using

    4. Pre-compute zkfor each value of skusing iterative process

    5. For each pixel in the original image, if the value of that pixel isrk, map this value to its corresponding level sk, then map levels

    k

    into final level zk

    - In these mappings the pre-computed values from step (2) andstep (4) are used

    ( ) ( )1 1

    z G s z G T r

    = =

    ( ) ( )0 0

    k k

    k k z i k

    i j

    nv G z p z s

    n= == = =

    Histogram matching/specificationHistogram matching/specification

  • 8/12/2019 DIP Image Enhancement

    47/99

    g g pg g p

    The principal difficulty in applying the histogramspecification method to image enhancement lies in

    being able to construct a meaningful histogram

    So,

    - Either a particular probability density function (such

    as a Gaussian density) is specified and then ahistogram is formed by digitizing the given function

    - Or a histogram shape is specified on a graphicdevice and then is fed into the processor executing

    the histogram specification algorithm.

    Histogram matching/specificationHistogram matching/specification

  • 8/12/2019 DIP Image Enhancement

    48/99

    Histogram matching/specificationHistogram matching/specification

    Histogram equalizationHistogram equalization

  • 8/12/2019 DIP Image Enhancement

    49/99

    g qg q

    Histogram equalizationHistogram equalization

  • 8/12/2019 DIP Image Enhancement

    50/99

    Histogram equalizationHistogram equalization

    Histogram equalizationHistogram equalization

  • 8/12/2019 DIP Image Enhancement

    51/99

    Histogram equalizationHistogram equalization

    Local enhancementLocal enhancement

  • 8/12/2019 DIP Image Enhancement

    52/99

    Local enhancement using histogram is done

    basically for two purposes:

    - When it is necessary to enhance details

    over small areas in an image

    - To devise transformation functions based

    on the gray-level distribution in theneighbourhood of every pixel in the image

    Local enhancementLocal enhancement

  • 8/12/2019 DIP Image Enhancement

    53/99

    The procedure is:

    - Define a square (or rectangular)

    neighbourhood and move the center of thisarea from pixel to pixel

    - At each location, the histogram of the pointsin the neighbourhood is computed and

    either a histogram equalization or histogramspecification transformation function isobtained

    Local enhancementLocal enhancement

  • 8/12/2019 DIP Image Enhancement

    54/99

    - This function is finally used to map the

    gray level of the pixel centered in the

    neighbourhood

    - The centre of the neighbourhood region isthen moved to an adjacent pixel location

    and the procedure is repeated

    Local enhancementLocal enhancement

  • 8/12/2019 DIP Image Enhancement

    55/99

    Local enhancementLocal enhancement

    Local enhancementLocal enhancement

  • 8/12/2019 DIP Image Enhancement

    56/99

    Local enhancementLocal enhancement

    Local enhancementLocal enhancement

  • 8/12/2019 DIP Image Enhancement

    57/99

    Local enhancementLocal enhancement

    Image enhancement usingImage enhancement using

    Arithmetic/Logic operationsArithmetic/Logic operations

  • 8/12/2019 DIP Image Enhancement

    58/99

    Arithmetic/Logic operationsArithmetic/Logic operations

    Logical

    - AND, OR, NOT functionally complete

    - In conjunction with morphological operations

    Arithmetic

    - Subtraction/Addition

    - Multiplication / Division (as multiplication of

    reciprocal)- May use multiplication to implement gray-levelmasks

    Logical operationsLogical operations

  • 8/12/2019 DIP Image Enhancement

    59/99

    Logical operationsLogical operations

    Image SubtractionImage Subtraction

  • 8/12/2019 DIP Image Enhancement

    60/99

    Image subtraction of a mask from an image

    is given as:

    Where,f(x,y) is the imageh(x,y) is the image mask

    Image subtraction is used in medical

    imaging, eg. Mask mode radiography

    ),(),(),( yxhyxfyxg =

    Image subtractionImage subtraction

  • 8/12/2019 DIP Image Enhancement

    61/99

    Mask mode radiography-h(x,y) is the mask,f(x,y) is image taken after

    injecting the contrast medium

    Image subtractionImage subtraction

  • 8/12/2019 DIP Image Enhancement

    62/99

    Image subtraction isg(x, y) = f (x, y)

    h(x, y)

    Image averagingImage averaging

  • 8/12/2019 DIP Image Enhancement

    63/99

    g g gg g g

    A noisy image can be modeled as:

    g(x,y)=f(x,y)+(x,y)

    Where,f(x,y) is the original image

    (x,y) is the noise

    Averaging k different noisy images:

    ==M

    i

    i yxgM

    yxg1

    ),(1),(

    Image AveragingImage Averaging

  • 8/12/2019 DIP Image Enhancement

    64/99

    AsKincreases, the variability of the pixel

    values at each location decreases

    - This means thatg(x,y) approachesf(x,y) as

    the number of noisy images used in theaveraging process increases.

    Registering of the images is necessary toavoid blurring in the output image.

    Image AveragingImage Averaging

  • 8/12/2019 DIP Image Enhancement

    65/99

    g g gg g g

    Image AveragingImage Averaging

  • 8/12/2019 DIP Image Enhancement

    66/99

    g g gg g g

    Spatial FilteringSpatial Filtering

  • 8/12/2019 DIP Image Enhancement

    67/99

    Use of spatial masks for image processing

    (spatial filters)

    Linear and nonlinear filters(a 3x3 mask)

    Low-pass filters eliminate or attenuate

    high frequency components in the

    frequency domain (sharp image details),and result in image blurring

    p

    Spatial FilteringSpatial Filtering

  • 8/12/2019 DIP Image Enhancement

    68/99

    High-pass filters attenuate or eliminate

    low-frequency components (resulting insharpening edges and other sharp details)

    Band-pass filters remove selectedfrequency regions between low and high

    frequencies (for image restoration, notenhancement)

    Spatial filteringSpatial filtering

  • 8/12/2019 DIP Image Enhancement

    69/99

    Different filters can be designed to do thefollowing:

    - Blurring / Smoothing

    - Sharpening

    - Edge Detection

    - All these effects can be achieved usingdifferent coefficients in the mask

    Spatial filteringSpatial filtering

  • 8/12/2019 DIP Image Enhancement

    70/99

    Blurring / Smoothing- (Sometimes also referred to as averaging or

    lowpass-filtering)

    ~Average the values of the centre pixel and itsneighbours

    Purposes:

    - Reduction of irrelevant details

    - Noise reduction- Reduction of false contours (e.g. produced by

    zooming)

    Spatial filteringSpatial filtering

  • 8/12/2019 DIP Image Enhancement

    71/99

    Sharpening

    - Used to highlight fine detail in an image

    - Or to enhance detail that has been blurred

    Edge Detection

    Purposes:

    - Pre-processing- Sharpening

    Spatial filteringSpatial filtering

  • 8/12/2019 DIP Image Enhancement

    72/99

    A mask of a fixed size and having constant

    weight in its every location is used to do

    the filtering

    The mask is moved from point to point on

    the image

    At each point (x,y), the response of the

    filter at that point is calculated using apredefined relationship

    Spatial filteringSpatial filtering

  • 8/12/2019 DIP Image Enhancement

    73/99

    For a linear spatial filtering, the response isgiven by a sum of products of the filtercoefficients and the corresponding image

    pixels in the area spanned by the filter mask

    For a 33 mask, the result (response) R, of

    linear filtering with the filter mask at a point(x,y) in the image is

    R=w(-1,-1)f(x-1,y-1)+w(-1,0)f(x-1,y)+ .... +w(0,0)f(x,y)+.. +w(1,0)f(x+1,y)+w(1,1)f(x+1,y+1)

    Spatial filteringSpatial filtering

  • 8/12/2019 DIP Image Enhancement

    74/99

    Spatial FilteringSpatial Filtering

  • 8/12/2019 DIP Image Enhancement

    75/99

    The basic approach is to sum products betweenthe mask coefficients and the intensities of the

    pixels under the mask at a specific location in the

    image

    For a 3 x 3 filter

    992211 ... zwzwzwR +++=

    1

    mn

    i i

    i

    R w z=

    =

    Spatial FilteringSpatial Filtering

  • 8/12/2019 DIP Image Enhancement

    76/99

    Spatial filteringSpatial filtering

  • 8/12/2019 DIP Image Enhancement

    77/99

    z3z2z1

    z6z5z4

    z9z8z7

    Image pixels (N8)

    Spatial filteringSpatial filtering

  • 8/12/2019 DIP Image Enhancement

    78/99

    Linear filtering of an image of size MN withfilter mask of size mn is given as

    a=(m-1)/2 and b=(n-1)/2,

    Forx=0,1,,M-1 andy=0,1,,N-1

    Linear spatial filtering is also called convolvinga mask with an image

    g(x ,y )= w (s, t)f(x+ s,y+ t)t= b

    b

    s= a

    a

    Smoothing FiltersSmoothing Filters

  • 8/12/2019 DIP Image Enhancement

    79/99

    Used for blurring (removal of small details

    prior to large object extraction, bridging

    small gaps in lines) and noise reduction.

    Low-pass (smoothing) spatial filtering Neighborhood averaging

    - Results image blurring

    Smoothing FilteringSmoothing Filtering

  • 8/12/2019 DIP Image Enhancement

    80/99

    (Used in box filter) Weighted average

    (used to reduce blurring)

    Averaging filterAveraging filter

  • 8/12/2019 DIP Image Enhancement

    81/99

    In averaging filter

    ( , ) ( , )( , )

    ( , )

    a b

    s a t b

    a b

    s a s b

    w s t f x s y t g x y

    w s t

    = =

    = =

    + +=

    Smoothing FilteringSmoothing Filtering

  • 8/12/2019 DIP Image Enhancement

    82/99

    Averaging using

    different mask sizes

    - Note the blurring at

    greater mask size

    Smoothing FilteringSmoothing Filtering

  • 8/12/2019 DIP Image Enhancement

    83/99

    Smoothing FilteringSmoothing Filtering

  • 8/12/2019 DIP Image Enhancement

    84/99

    1 1 1

    1 1 1

    1 1 1

    * 1/9

    Apply this scheme

    to every single pixel !

    Some more examples:

    Blurring / Smoothing

    Smoothing FilteringSmoothing Filtering

  • 8/12/2019 DIP Image Enhancement

    85/99

    1 2 1

    2 4 2

    1 2 1

    * 1/16

    Example 2:

    Weighted average

    Spatial FilteringSpatial Filtering

  • 8/12/2019 DIP Image Enhancement

    86/99

    Non-linear filters also use pixel

    neighbourhoods but do not explicitly use

    coefficients

    e.g. noise reduction by median gray-levelvalue computation in the neighbourhood

    of the filter

    OrderOrder--statistics filtersstatistics filters

    M di filt ( li )

  • 8/12/2019 DIP Image Enhancement

    87/99

    Median filter(nonlinear)

    - Used primarily for noise reduction, eliminates

    isolated spikes

    Most important properties of the median:- Less sensible to noise than mean

    - An element of the original set of values- Needs sorting

    Median filterMedian filter

    Th l l f h i l i l d b

  • 8/12/2019 DIP Image Enhancement

    88/99

    - The gray level of each pixel is replaced bythe median of the gray levels in the

    neighborhood of that pixel (instead of by

    the average as before)

    To calculate the median of a set of gray

    values, arrange the values in the set in

    ascending order. Then the middle most

    value in the string is the median (in case of

    odd number of values)

    1 2 3 3 4 4 5 6 6

    4 1 2

    6 5 3

    3 4 6

    4 1 2

    6 4 3

    3 4 6

    Median filterMedian filter

  • 8/12/2019 DIP Image Enhancement

    89/99

    Sharpening filterSharpening filter

    U d t hi hli ht fi d t il i i t h

  • 8/12/2019 DIP Image Enhancement

    90/99

    Used to highlight fine detail in an image or to enhanceimage that has been blurred

    Accomplished by spatial differentiation, as it enhances the

    sharp transition in gray levels First derivative of a 1-D functionf(x) is given as

    And Second derivative

    ( 1) ( )f f x f xx

    = +

    2

    2 ( 1) ( 1) 2 ( )

    ff x f x f x

    x

    = + +

    Sharpening filterSharpening filter

  • 8/12/2019 DIP Image Enhancement

    91/99

    First derivative enhances any sharp

    transition

    Second derivative enhances even a fine

    transition

    - Usually the second derivative is preferredwhen fine details are to be enhanced

    Sharpening filterSharpening filter

  • 8/12/2019 DIP Image Enhancement

    92/99

    Sharpening filterSharpening filter First order derivatives produce thick edges and second

    order derivatives much finer ones

  • 8/12/2019 DIP Image Enhancement

    93/99

    order derivatives much finer ones

    A second order derivative is much more aggressive than

    a first order derivative in enhancing sharp changes

    Sharpening filterSharpening filterThe first and second order derivatives:

  • 8/12/2019 DIP Image Enhancement

    94/99

    1. First order derivative produces thicker edges

    2. Second order derivative has a stronger response tofine detail such as thin lines and isolated points

    3. First order derivative has a stringer response to agray level step

    4. Second order derivative produces a doubleresponse at step changes in gray levels

    Sharpening filterSharpening filter

    Laplacian operator

  • 8/12/2019 DIP Image Enhancement

    95/99

    Laplacian operator- It is a linear operator; used for image

    sharpening

    For an image functionf(x,y), Laplacian isdefined as

    2 2

    22 2

    f ff x y

    = +

    Sharpening filterSharpening filter

    Partial second order derivative in X direction:

  • 8/12/2019 DIP Image Enhancement

    96/99

    Partial second order derivative in X-direction:

    Partial second order derivative in Y-direction:

    So,2 [ ( 1, ) ( 1, ) ( , 1) ( , 1)] 4 ( , )f f x y f x y f x y f x y f x y = + + + + +

    2

    2 ( 1, ) ( 1, ) 2 ( , )

    fx y f x y f x y

    x

    = + +

    2

    2 ( , 1) ( , 1) 2 ( , )f

    f x y f x y f x yy

    = + +

    Sharpening filterSharpening filter

    If the centre coefficient of the Laplacian mask is

  • 8/12/2019 DIP Image Enhancement

    97/99

    If the centre coefficient of the Laplacian mask isnegative

    If the centre coefficient of the Laplacian mask ispositive

    2( , ) ( , ) ( , )g x y f x y f x y=

    2

    ( , ) ( , ) ( , )g x y f x y f x y= +

    Sharpening filterSharpening filter

  • 8/12/2019 DIP Image Enhancement

    98/99

  • 8/12/2019 DIP Image Enhancement

    99/99