Top Banner

Click here to load reader

Digital Image Processing · PDF file Digital Image Processing Vahid Meghdadi Reference: Digital Image processing by Rafael Gonzalz. ... imwrite (im,’c:\image_dir\lenna.bmp’); ...

Jul 04, 2020

ReportDownload

Documents

others

  • Digital Image

    Processing Vahid Meghdadi

    Reference: Digital Image processing by Rafael

    Gonzalz

  • Course chart

    • 4 classes of 1h20 each

    • 2 lab on Matlab

    • One written examination

  • Fundamentals

  • Image model

    • An image is a two-dimensional function � �, � • �(�, �) is a positive scalar quantity • �(��, ��) is the intensity of a monochromatic image at the coordinate (��, ��), that we call the gray level. • We scale the interval of the gray level in [0, � − 1] • 0 is the gray level of black, � − 1 is white.

  • Image sampling and

    quantification

    � �

    • The result of sampling in the space (� and �) is the pixelation. • The result of sampling in the gray level is the quantification.

  • Image representing

    • The image is then represented by a two- dimensional matrix

  • Image representing

    • Normally � is taken as 2�. Therefore, each sample (gray level) can be represented by � bits.

    • The total number of bits to represent an � × � image is� = � × � × � • For � = � = 512 and � = 256, � = 2����

  • 100 200 300 400 500

    100

    200

    300

    400

    100 200 300 400 500

    100

    200

    300

    400

    100 200 300 400 500

    100

    200

    300

    400

    100 200 300 400 500

    100

    200

    300

    400

    Quantification

    8 bits

    3 bits 1 bit

    5 bits

  • 50 100 150 200 250 300 350 400 450 500

    50

    100

    150

    200

    250

    300

    350

    400

    450

    Quantification error

    Quantification error for � = 2 (� = 1 bit)

  • Pixelation

    1024 × 1024 512 × 512 256 × 256128 × 128 64 × 64 32 × 32

  • Matlab commands

    • Reading an image file im = imread(‘c:\image_dir\lenna.jpg’);

    • To display an image imshow(im);

    • To change the format imwrite (im,’c:\image_dir\lenna.bmp’);

  • Shifting

    �� = � + �; �� = � + � #$ ��, �� = #% �, � = #%(�� − �, �� − �)

  • Example : Shift

    1 0 0 2 0 0 3 0 0 4 0 0 5 0 0

    5 0

    1 0 0

    1 5 0

    2 0 0

    2 5 0

    3 0 0

    3 5 0

    4 0 0

    4 5 0

    1 0 0 2 0 0 3 0 0 4 0 0 5 0 0

    5 0

    1 0 0

    1 5 0

    2 0 0

    2 5 0

    3 0 0

    3 5 0

    4 0 0

    4 5 0

    I2(x,y)=I1((x-240) mod 480 , (y-270) mod 540)

  • Zooming

    • Zooming requires two steps: creation of new pixel

    locations, and assigning values to those new locations

    • An image of size (10 × 10) becomes an image of size (20 × 20)

    • Results checkerboard effect

    Integer factor Non-integer factor

  • zoming • #%(�, �) is the initial image• #$(�′, �′) is the zoomed image

    #$ ��, �� = #% �, ��� = (� − ��)', �� = � − �� (#$ �, � = #% ��' + ��, ��( + ��

  • Example

    (200,230)

    x=200+round(x’/alpha); y=230+round(y’/beta);

    b(x',y')=a(x,y); % alpha=beta=4

  • Shrinking

    • Shrinking is a reduction in the size

    • The process is the column-row deletion of the

    image matrix.

  • Rotation

    #$ ��, �� = #% �, � = #%(�� cos , + �� sin , , −�� sin , + �� cos ,)

  • Example: Rotation

    Teta=90° Teta=20°

  • Exercice :"Shear" suivant x

    x=x'-round(cos(teta)*y'); y=y'; %teta = 30°

    �� = � + �. tan , ; �� = �

  • Neighbors of a pixel

    • A pixel at (�, �) has for direct neighbors :� + 1, � , � − 1, � , �, � + 1 , �(� − 1)

    • We can extend this notion to the neighborhood

    Rectangular neighborhood Circular

    neighborhood

  • Intensity

    transformation in the

    spatial domain

  • Image enhancement

    • The objective is to improve the visual quality of

    the image

    • The space domain refers to direct manipulation

    of the intensity (gray level) of pixels.

    • The performance evaluation is “subjective”.

  • Background

    • Spatial domain transformation is denoted by < �, � = =[�(�, �)] where �(�, �) is the input image,

  • Intensity mapping

    • The simplest neighborhood is of size 1 × 1 • In this case < �, � = = � �, �> = =(?) • The simplest one is

    constant multiplier: > = @. ? • This transformation is to

    increase the intensity of the

    picture.

  • Constant multiplication

    5 0 1 0 0 1 5 0 2 0 0 2 5 0

    5 0

    1 0 0

    1 5 0

    2 0 0

    2 5 0

    5 0 1 0 0 1 5 0 2 0 0 2 5 0

    5 0

    1 0 0

    1 5 0

    2 0 0

    2 5 0

    Constante = 5

    0, 51 → (0, 255) and 52, 255 → 255

  • Negative image

    In general > = = ? = � − 1 − ? For the special case of � = 255,

    > = 255 − ?

    This transformation gives a negative image.

  • Négation

    1 0 0 2 0 0 3 0 0 4 0 0

    5 0

    1 0 0

    1 5 0

    2 0 0

    2 5 0

    3 0 0

    3 5 0

    4 0 0

    4 5 0

    5 0 0

    5 5 0

    1 0 0 2 0 0 3 0 0 4 0 0

    5 0

    1 0 0

    1 5 0

    2 0 0

    2 5 0

    3 0 0

    3 5 0

    4 0 0

    4 5 0

    5 0 0

    5 5 0

  • Matlab code

  • Binary transformation

    Threshold = 70

  • Seuillage

    Seuil = 50

  • Saturation

    Cmax=70, Cmin=50

    > = [email protected] ? < KGLM? @GLM ≤ ? ≤ @[email protected] ? > @GHI

  • Adjusting

    Re-scale to obtain 8 bits after "saturating".

    The preceding picture can

    be re-scaled to cover the

    range [0 − � − 1]

  • Visual enhancement 1/2

    • Improving dark pictures

    • This kind of transformation is used to make dark images lighter.

    Source: wikipedia

  • Visual enhancement 2/2 • Improving dark pictures

    • This kind of transformation is used to make dark images lighter.

  • Logarithmic Transformation

    • The general form of log transformation:> = K log(1 + ?) where K is a constant. • To transform 0, � − 1 to 0, � − 1 , K = � − 1log � • This transformation enhances the dark zone of the

    image but saturates the light zones.

  • Example

    50 100 150 200 250

    50

    100

    150

    200

    250

    50 100 150 200 250

    50

    100

    150

    200

    250

    After a Fourier transform, the dynamic of the picture is too important. The

    log transform helps to see the details in the dark zones. The same

    process has been seen in the dB representation of the transfer functions.

    > = K log(1 + ?)

  • Power-law (gamma) transform

    • Power-law

    transformations

    have the basic form > = K?P . where K and Q are the constants.

  • Power-law (gamma)

    Original image too dark

    Power-law correction with gamma = 0.6

    100 200 300

    50

    100

    150

    200

    250

    300

    350

    400

    450

    100 200 300

    50

    100

    150

    200

    250

    300

    350

    400

    450

  • Power-law

    Original image too dark

    Power-law correction with gamma = 0.3

    100 200 300

    50

    100

    150

    200

    250

    300

    350

    400

    450

    100 200 300

    50

    100

    150

    200

    250

    300

    350

    400

    450

  • 200 400 600

    100

    200

    300

    400

    500

    600

    700

    200 400 600

    100

    200

    300

    400

    500

    600

    700

    Original image too light

    Power-law correction with gamma = 2

    Power-law

  • Power-law

    200 400 600

    100

    200

    300

    400

    500

    600

    700

    200 400 600

    100

    200

    300

    400

    500

    600

    700

    Original image too light

    Power-law correction with gamma = 4

  • Histogram processing

    • The histogram of a digital image with gray levels in the

    range [0, � − 1] is a discrete function ℎS � = T�, where ?� is the �th gray level and T�is the number of pixels in the image having gray level ?� .

    • The normalized histogram U ?� = T�T • We have therefore

    V U(?�)WX%�Y� = 1

  • Histogram example

    1 0 0 2 0 0 3 0 0 4 0 0 5 0 0

    5 0

    1 0 0

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.