2-Point Operations Mar31 April2

Embed Size (px)

Citation preview

  • 8/8/2019 2-Point Operations Mar31 April2

    1/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 1

    What is an image?

    Ideally, we think of an image as a 2-dimensional light

    intensity function,f(x,y), wherex andy are spatial

    coordinates, andfat (x,y) is related to the brightness orcolor of the image at that point.

    In practice, most images are defined over a rectangle.

    Continous in amplitude (continous-tone)

    Continous in space: no pixels!

  • 8/8/2019 2-Point Operations Mar31 April2

    2/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 2

    Digital Images and Pixels

    A digital image is the representation of a continuous image

    f(x,y)by a 2-d array of discrete samples. The amplitude ofeach sample is quantized to be represented by a finite

    number of bits.

    Each element of the 2-d array of samples is called a pixelor pel (from picture element)

    Think of pixels as point samples, without extent.

  • 8/8/2019 2-Point Operations Mar31 April2

    3/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 3

    Image Resolution

    200x200 100x100 50x50 25x25

    These images were produced by simply picking every n-th sample

    horizontally and vertically and replicating that value nxn times.

    We can do better

    prefiltering before subsampling to avoid aliasing

    Smooth interpolation

  • 8/8/2019 2-Point Operations Mar31 April2

    4/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 4

    Color Components

    RedR(x,y) Green G(x,y) BlueB(x,y)

    Monochrome image

    R(x,y) = G(x,y) = B(x,y)

  • 8/8/2019 2-Point Operations Mar31 April2

    5/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 5

    Different numbers of gray levels

    256 32 16

    8 4 2

    Contouring

  • 8/8/2019 2-Point Operations Mar31 April2

    6/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 6

    How many gray levels are required?

    Contouring is most visible for a ramp

    Digital images typically are quantized to 256 gray levels.

    32 levels

    64 levels

    128 levels

    256 levels

  • 8/8/2019 2-Point Operations Mar31 April2

    7/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 7

    130129128127126125

    Brightness discrimination experiment

    Can you see the circle?

    Visibility threshold

    I

    I+ I

    I I KWeber

    12%Weber fractionWebers Law

    Note: I is luminance,

    measured in cd m2

  • 8/8/2019 2-Point Operations Mar31 April2

    8/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 8

    Contrast with 8 Bits According to Webers Law

    Assume that the luminance difference between two

    successive representative levels is just at visibility threshold

    For

    Typical display contrast

    Cathode ray tube 100:1

    Print on paper 10:1

    Suggests uniform perception in the log(I) domain(Fechners Law)

    Imax

    Imin

    = 1+ KWeber( )

    255

    KWeber = 0.010.02Imax

    Imin

    =13156

  • 8/8/2019 2-Point Operations Mar31 April2

    9/37

  • 8/8/2019 2-Point Operations Mar31 April2

    10/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 10

    log vs. -predistortion

    Similar enough for most practical applications

    U

    I

    U~ I1

    U ~ log(I)

    Imax

    Imin

    =100

  • 8/8/2019 2-Point Operations Mar31 April2

    11/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 11

    Photographic film

    measures film contrast General purpose films: = -0.7 . . . -1.0

    High-contrast films: = -1.5 . . . -10

    Lower speed films tend to have higher absolute

    slope -

    logEEis exposure

    densityd

    shoulder

    toe

    linear region

    I = I0 10d

    = I0 10 logE+d0( )

    = I0 10d0

    E

    Luminance

    Hurter & Driffield curve (H&D curve)for photographic negative

    d00

    2.0

    1.0

  • 8/8/2019 2-Point Operations Mar31 April2

    12/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 12

    Intensity Scaling

    Original image Scaled image

    f x,y( ) a f x,y( )

    Scaling in the -domain is equivalent to scaling in the linear luminancedomain

    . . . same effect as adjusting camera exposure time.

    I~ a f x,y( )( )

    = a

    f x,y( )( )

  • 8/8/2019 2-Point Operations Mar31 April2

    13/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 13

    Adjusting

    Original image increased by 50%

    f x,y( ) a f x,y( )( )

    with =1.5

    . . . same effect as using a different photographic film . . .

  • 8/8/2019 2-Point Operations Mar31 April2

    14/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 14

    Changing gradation by -adjustment

    Original ramp 0

    Scaled ramp 20

    Scaled ramp 0.50

    Scaling chosen to

    approximately preservebrightness of mid-gray

  • 8/8/2019 2-Point Operations Mar31 April2

    15/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 15

    Histograms

    Distribution of gray-levels can be judged by measuring a

    histogram:

    For B-bit image, initialize 2B

    counters with 0

    Loop over all pixelsx,y

    When encountering gray levelf(x,y)=i, increment counter #

    Histogram can be interpreted as an estimate of theprobability density function (pdf) of an underlying random

    process.

    You can also use fewer, larger bins to trade off amplitude

    resolution against sample size.

  • 8/8/2019 2-Point Operations Mar31 April2

    16/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 16

    Example histogram

    gray level

    #pixels

    Cameramanimage

  • 8/8/2019 2-Point Operations Mar31 April2

    17/37

  • 8/8/2019 2-Point Operations Mar31 April2

    18/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 18

    Histogram equalization

    Idea: find a non-linear transformation

    to be applied to each pixel of the input imagef(x,y), suchthat a uniform distribution of gray levels in the entire range

    results for the output image g(x,y). Analyse ideal, continuous case first, assuming

    T(f)is strictly monotonically increasing, hence, there

    exists

    Goal: pdfpg(g)= const. over the range

    0 f 1

    f = T1

    g( )

    g = T f( )

    0 g 1

    0 g 1

  • 8/8/2019 2-Point Operations Mar31 April2

    19/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 19

    Histogram equalization for continuous case

    From basic probability theory

    Consider the transformation function

    Then . . .

    pg g( ) = pf f( )df

    dg

    f=T1 g( )

    g = T f( ) = pf ( )0

    f

    d 0 f 1

    dg

    df= pf f( )

    pg g( ) = pf f( )df

    dg

    f=T

    1g( )

    = pf f( )1

    pf f( )

    f=T

    1 g( )

    = 1 0 g 1

  • 8/8/2019 2-Point Operations Mar31 April2

    20/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 20

    Histogram equalization for discrete case

    Now,fonly assumes discrete amplitude values

    with probabilities

    Discrete approximation of

    The resulting values gkare in the range [0,1] and need tobe scaled and rounded appropriately.

    f0 , f1,, fL1

    P0 =n

    0

    n P

    1=

    n1

    n P

    L1=

    nL1

    n

    g = T f( ) = pf ( )0

    f

    d

    gk =

    T fk( ) = Pi

    i=0

    k

  • 8/8/2019 2-Point Operations Mar31 April2

    21/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 21

    Histogram equalization example

    Original image Pout Poutafter histogram equalization

  • 8/8/2019 2-Point Operations Mar31 April2

    22/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 22

    Histogram equalization example

    Original image Pout . . . after histogram equalization

    gray level

    #pixels

    gray level

    #pixels

  • 8/8/2019 2-Point Operations Mar31 April2

    23/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 23

    Histogram equalization example

    Original imageCameraman

    Cameraman

    after histogram equalization

  • 8/8/2019 2-Point Operations Mar31 April2

    24/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 24

    Histogram equalization example

    Original image Cameraman . . . after histogram equalization

    gray level

    #

    pixels

    gray level

    #pixels

  • 8/8/2019 2-Point Operations Mar31 April2

    25/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 25

    Histogram equalization example

    Original image Moon Moonafter histogram equalization

  • 8/8/2019 2-Point Operations Mar31 April2

    26/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 26

    Histogram equalization example

    Original image Moon . . . after histogram equalization

    gray level

    #

    pixels

    gray level

    #

    pixels

  • 8/8/2019 2-Point Operations Mar31 April2

    27/37

  • 8/8/2019 2-Point Operations Mar31 April2

    28/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 28

    Adaptive Histogram Equalization

    Original Global histogram Tiling

    8x8 histograms

    Tiling

    32x32 histograms

  • 8/8/2019 2-Point Operations Mar31 April2

    29/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 29

    Adaptive histogram equalization

    Original image Tire Tireafter

    equalization ofglobal histogram

    Tireafter

    adaptive histogram equalization8x8 tiles

  • 8/8/2019 2-Point Operations Mar31 April2

    30/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 30

    Point Operations Combining Images

    Image averaging for noise reduction

    Combination of different exposure for high-dynamic rangeimaging

    Image subtraction for change detection

    Accurate alignment is always a requirement

  • 8/8/2019 2-Point Operations Mar31 April2

    31/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 31

    Image averaging for noise reduction

    http://www.cambridgeincolour.com/tutorials/noise-reduction.htm

    1 image 2 images 4 images

  • 8/8/2019 2-Point Operations Mar31 April2

    32/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 32

    Image averaging for noise reduction

    Take N aligned images

    Average image:

    Mean squared error vs. noise-free imageg

    f1x,y( ),f2 x,y( ),,fN x,y( )

    f x,y( ) =1

    Nf

    ix,y( )

    i=1

    N

    E f g( )2

    = E

    1

    Nf

    ii

    g

    2

    = E

    1

    Ng+ n

    i( )i

    g

    2

    = E 1N

    ni

    i

    2

    = 1

    N2E n

    i2

    { }i= 1

    NE n2{ }

    E ni

    { } =E n{ }iprovidedE n

    inj{ } = 0i,j

  • 8/8/2019 2-Point Operations Mar31 April2

    33/37

  • 8/8/2019 2-Point Operations Mar31 April2

    34/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 34

    Image subtraction

    Find differences/changes between 2 mostly identical images

    Example from IC manufacturing:defect detection in photomasks

    by die-to-die comparison

  • 8/8/2019 2-Point Operations Mar31 April2

    35/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 35

    Where is the Defect?

    Image A (no defect) Image B (w/ defect)

  • 8/8/2019 2-Point Operations Mar31 April2

    36/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 36

    Absolute Difference Between Two Images

    w/o alignment w/ alignment

  • 8/8/2019 2-Point Operations Mar31 April2

    37/37

    Bernd Girod: EE368 Digital Image Processing Point Operations no. 37

    Digital Subtraction Angiography

    - +

    Contrast

    enhancement

    http://www.isi.uu.nl/Research/Gallery/DSA/