mask in DIP _ms

download mask in DIP _ms

of 34

Transcript of mask in DIP _ms

  • 7/30/2019 mask in DIP _ms

    1/34

    Linear Operations Using Masks

    Masks are patterns used to define theweights used in averaging the

    neighbors of a pixel to compute someresult at that pixel

    LN 907

  • 7/30/2019 mask in DIP _ms

    2/34

    Expressing linear operations

    on neighborhoods

    LN 907

  • 7/30/2019 mask in DIP _ms

    3/34

    LN 907

    Images as functions

  • 7/30/2019 mask in DIP _ms

    4/34

    LN 907

    Neighborhood operations Average neighborhood to remove noiseor high frequency patternsDetect boundaries at points of contrastusing gradient computationCan use median filtering to smoothwhile keeping boundaries sharp

  • 7/30/2019 mask in DIP _ms

    5/34

  • 7/30/2019 mask in DIP _ms

    6/34

    Histogram equalization

    Left image does not use all available gray levels. Image is recoded so thatall gray levels are used and such that each gray level occurs in roughly thesame number of pixels of the recoded image.

    LN 907

  • 7/30/2019 mask in DIP _ms

    7/34

    Histogram equalization can darken a

    bright image, perhaps improving contrast

    LN 907

  • 7/30/2019 mask in DIP _ms

    8/34

    Can define mapping of input

    gray level to output level (xv)

    Gamma correction:boost all gray levels

    Boost low levelsand reduce high

    LN 907

  • 7/30/2019 mask in DIP _ms

    9/34

    LN 907

    Smoothing an image byaveraging neighbors (boxcar)

  • 7/30/2019 mask in DIP _ms

    10/34

    LN 907

    Output pixel is the dot product of the input neighborhood and themask

  • 7/30/2019 mask in DIP _ms

    11/34

    LN 907

    Properties of smoothing masks

  • 7/30/2019 mask in DIP _ms

    12/34

    LN 907

    Types of ideal edges (in 1D)

    These types are also present in 2D and 3D images and arecomplicated by orientation variations.

  • 7/30/2019 mask in DIP _ms

    13/34

    LN 907

    Boxcar smoothing filter example

    So, reducing noise will also degrade the signal.

  • 7/30/2019 mask in DIP _ms

    14/34

    LN 907

    Linear smoothing smoothes

    noise and blurs signalBlur: step is now ramp

    Input image Row after 5x5 mean filter

  • 7/30/2019 mask in DIP _ms

    15/34

    LN 907

    Gaussian smoothing

  • 7/30/2019 mask in DIP _ms

    16/34

    LN 907

    Median filter replaces center withneighborhood median, not mean

    Noisy row of checkersimage

    Mean filteringsmoothes signal andramps the boundary

    Median filtersmoothes signal andpreserves sharpboundary

  • 7/30/2019 mask in DIP _ms

    17/34

    LN 907

    Median filter is not linear

    Algorithm requires comparisons and ismore expensive than using mask Can sort all NxN pixel values and pick middleDo not need totally sorted data: O(N)algorithm exists

  • 7/30/2019 mask in DIP _ms

    18/34

    LN 907

    Scratches removed by using amedian filter

    Thin artifactremoved, sharpboundariespreserved.

  • 7/30/2019 mask in DIP _ms

    19/34

    LN 907

    Finding boundary pixels

    Computing derivatives or

    gradients to locate region change.

  • 7/30/2019 mask in DIP _ms

    20/34

    LN 907

    2 rows of intensity vs difference

  • 7/30/2019 mask in DIP _ms

    21/34

    LN 907

    Differencing used to estimate1st and 2 nd derivatives

    First differences2nd differences

    Masks representthe first and 2 nd differences

  • 7/30/2019 mask in DIP _ms

    22/34

    LN 907

    Step edges X mask [-1, 0, +1]

    Step edge is detected well, but edge location imprecise.

  • 7/30/2019 mask in DIP _ms

    23/34

    LN 907

    Ramp and impulse X mask [-1, 0, +1]

    Ramp edge now yields a broad weak response. Impulseresponse is a whip, first up and then down.

  • 7/30/2019 mask in DIP _ms

    24/34

    LN 907

    2nd derivative using mask [-1, 2, -1]

    Response is zero on constant region and a double whip amplifiesand locates the step edge.

  • 7/30/2019 mask in DIP _ms

    25/34

    LN 907

    2nd derivative using mask [-1, 2, -1]

    Weak response brackets the ramp edge. Bright impulseyields a double whip with gain of 3X original contrast.

  • 7/30/2019 mask in DIP _ms

    26/34

    LN 907

    Estimating 2D image gradient

  • 7/30/2019 mask in DIP _ms

    27/34

    LN 907

    Gradient from 3x3 neighborhoodEstimate both magnitude and direction of the edge.

  • 7/30/2019 mask in DIP _ms

    28/34

    LN 907

    Prewitt versus Sobel masks

    Sobel mask uses weights of 1,2,1 and -1,-2,-1 inorder to give more weight to center estimate.The scaling factor is thus 1/8 and not 1/6.

  • 7/30/2019 mask in DIP _ms

    29/34

    LN 907

    Computational short cuts

  • 7/30/2019 mask in DIP _ms

    30/34

    LN 907

    Alternative masks for gradient

  • 7/30/2019 mask in DIP _ms

    31/34

    LN 907

    Computational shortcuts

    Use MAX operation on 1D row andcolumn derivatives.Use OR operation on thresholded rowand column derivatives.

  • 7/30/2019 mask in DIP _ms

    32/34

    LN 907

    2 rows of intensity vs difference

  • 7/30/2019 mask in DIP _ms

    33/34

    LN 907

    Caption for Prewitt image

  • 7/30/2019 mask in DIP _ms

    34/34

    LN 907

    Properties of derivative masks