40
Spatial Transformations IT472: Digital Image Processing, Lecture 5

Image Processing 3

Embed Size (px)

Citation preview

Page 1: Image Processing 3

Spatial Transformations

IT472: Digital Image Processing, Lecture 5

Page 2: Image Processing 3

Spatial Transformations

Affine transformations of the support of the image f (x , y)

Scaling: x ′ = cxx and y ′ = cyy → f (x ′, y ′) = f (x , y).

Rotation: x ′ = x cos θ − y sin θ andy ′ = x cos θ + y sin θ → f (x ′, y ′) = f (x , y).

Translation: x ′ = x + tx andy ′ = y + ty → f (x ′, y ′) = f (x , y).

Shear: x ′ = x + syy and y ′ = y → f (x ′, y ′) = f (x , y).

All these collected together can be represented in a matrixform using Homogeneous coordinates, as follows: x ′

y ′

1

=

cos θ/cx/1 sin θ/sy/0 0/tx− sin θ/sx/0 cos θ/cy/1 0/ty

0 0 1

xy1

(1)

IT472: Lecture 5 2/18

Page 3: Image Processing 3

Spatial Transformations

Affine transformations of the support of the image f (x , y)

Scaling: x ′ = cxx and y ′ = cyy → f (x ′, y ′) = f (x , y).

Rotation: x ′ = x cos θ − y sin θ andy ′ = x cos θ + y sin θ → f (x ′, y ′) = f (x , y).

Translation: x ′ = x + tx andy ′ = y + ty → f (x ′, y ′) = f (x , y).

Shear: x ′ = x + syy and y ′ = y → f (x ′, y ′) = f (x , y).

All these collected together can be represented in a matrixform using Homogeneous coordinates, as follows: x ′

y ′

1

=

cos θ/cx/1 sin θ/sy/0 0/tx− sin θ/sx/0 cos θ/cy/1 0/ty

0 0 1

xy1

(1)

IT472: Lecture 5 2/18

Page 4: Image Processing 3

Spatial Transformations

Affine transformations of the support of the image f (x , y)

Scaling: x ′ = cxx and y ′ = cyy → f (x ′, y ′) = f (x , y).

Rotation: x ′ = x cos θ − y sin θ andy ′ = x cos θ + y sin θ → f (x ′, y ′) = f (x , y).

Translation: x ′ = x + tx andy ′ = y + ty → f (x ′, y ′) = f (x , y).

Shear: x ′ = x + syy and y ′ = y → f (x ′, y ′) = f (x , y).

All these collected together can be represented in a matrixform using Homogeneous coordinates, as follows: x ′

y ′

1

=

cos θ/cx/1 sin θ/sy/0 0/tx− sin θ/sx/0 cos θ/cy/1 0/ty

0 0 1

xy1

(1)

IT472: Lecture 5 2/18

Page 5: Image Processing 3

Spatial Transformations

Affine transformations of the support of the image f (x , y)

Scaling: x ′ = cxx and y ′ = cyy → f (x ′, y ′) = f (x , y).

Rotation: x ′ = x cos θ − y sin θ andy ′ = x cos θ + y sin θ → f (x ′, y ′) = f (x , y).

Translation: x ′ = x + tx andy ′ = y + ty → f (x ′, y ′) = f (x , y).

Shear: x ′ = x + syy and y ′ = y → f (x ′, y ′) = f (x , y).

All these collected together can be represented in a matrixform using Homogeneous coordinates, as follows: x ′

y ′

1

=

cos θ/cx/1 sin θ/sy/0 0/tx− sin θ/sx/0 cos θ/cy/1 0/ty

0 0 1

xy1

(1)

IT472: Lecture 5 2/18

Page 6: Image Processing 3

Spatial Transformations

Affine transformations of the support of the image f (x , y)

Scaling: x ′ = cxx and y ′ = cyy → f (x ′, y ′) = f (x , y).

Rotation: x ′ = x cos θ − y sin θ andy ′ = x cos θ + y sin θ → f (x ′, y ′) = f (x , y).

Translation: x ′ = x + tx andy ′ = y + ty → f (x ′, y ′) = f (x , y).

Shear: x ′ = x + syy and y ′ = y → f (x ′, y ′) = f (x , y).

All these collected together can be represented in a matrixform using Homogeneous coordinates, as follows: x ′

y ′

1

=

cos θ/cx/1 sin θ/sy/0 0/tx− sin θ/sx/0 cos θ/cy/1 0/ty

0 0 1

xy1

(1)

IT472: Lecture 5 2/18

Page 7: Image Processing 3

Implementation issues

For a given affine transformation matrix A, A · (x , y)t is notalways an integer.

Is it possible that due to rounding offA · (x1, y1)t = A · (x2, y2)t

Solution:

� Instead of using a forward mapping, let’s work with the inversemapping.

A−1 : (x ′, y ′)t → (x , y)t

� We can scan the output image coordinates and see where theycome from, and accordingly assign them grey values.

IT472: Lecture 5 3/18

Page 8: Image Processing 3

Implementation issues

For a given affine transformation matrix A, A · (x , y)t is notalways an integer.

Is it possible that due to rounding offA · (x1, y1)t = A · (x2, y2)t

Solution:

� Instead of using a forward mapping, let’s work with the inversemapping.

A−1 : (x ′, y ′)t → (x , y)t

� We can scan the output image coordinates and see where theycome from, and accordingly assign them grey values.

IT472: Lecture 5 3/18

Page 9: Image Processing 3

Implementation issues

For a given affine transformation matrix A, A · (x , y)t is notalways an integer.

Is it possible that due to rounding offA · (x1, y1)t = A · (x2, y2)t

Solution:

� Instead of using a forward mapping, let’s work with the inversemapping.

A−1 : (x ′, y ′)t → (x , y)t

� We can scan the output image coordinates and see where theycome from, and accordingly assign them grey values.

IT472: Lecture 5 3/18

Page 10: Image Processing 3

Implementation issues

For a given affine transformation matrix A, A · (x , y)t is notalways an integer.

Is it possible that due to rounding offA · (x1, y1)t = A · (x2, y2)t

Solution:

� Instead of using a forward mapping, let’s work with the inversemapping.

A−1 : (x ′, y ′)t → (x , y)t

� We can scan the output image coordinates and see where theycome from, and accordingly assign them grey values.

IT472: Lecture 5 3/18

Page 11: Image Processing 3

Implementation issues

For a given affine transformation matrix A, A · (x , y)t is notalways an integer.

Is it possible that due to rounding offA · (x1, y1)t = A · (x2, y2)t

Solution:

� Instead of using a forward mapping, let’s work with the inversemapping.

A−1 : (x ′, y ′)t → (x , y)t

� We can scan the output image coordinates and see where theycome from, and accordingly assign them grey values.

IT472: Lecture 5 3/18

Page 12: Image Processing 3

Implementation issues

For a given affine transformation matrix A, A · (x , y)t is notalways an integer.

Is it possible that due to rounding offA · (x1, y1)t = A · (x2, y2)t

Solution:

� Instead of using a forward mapping, let’s work with the inversemapping.

A−1 : (x ′, y ′)t → (x , y)t

� We can scan the output image coordinates and see where theycome from, and accordingly assign them grey values.

IT472: Lecture 5 3/18

Page 13: Image Processing 3

Examples

Figure: (top-left) Image of Lena (top-right) Image rotated by 23◦

(bottom-left) Shear sx = 1.2, (bottom-right) Shear sx = −1.2

IT472: Lecture 5 4/18

Page 14: Image Processing 3

End of Chapter 2

Chapter 3: Intensity transformations and Spatial filtering(Image enhancement in the spatial domain)

IT472: Lecture 5 5/18

Page 15: Image Processing 3

End of Chapter 2

Chapter 3: Intensity transformations and Spatial filtering(Image enhancement in the spatial domain)

IT472: Lecture 5 5/18

Page 16: Image Processing 3

Image enhancement

Image enhancement is a pre-processing step that makes theinput image better suited for further processing. For example,for segmentation, recognition, or simply better for somebodyto view the image.

Intensity transformations: Depends only on the intensity valueat a point: g(x , y) = T [f (x , y)], can be also written ass = T [r ], where r and s are the input and output grey valuesrespectively.

IT472: Lecture 5 6/18

Page 17: Image Processing 3

Image enhancement

Image enhancement is a pre-processing step that makes theinput image better suited for further processing. For example,for segmentation, recognition, or simply better for somebodyto view the image.

Intensity transformations: Depends only on the intensity valueat a point: g(x , y) = T [f (x , y)], can be also written ass = T [r ], where r and s are the input and output grey valuesrespectively.

IT472: Lecture 5 6/18

Page 18: Image Processing 3

Intensity transformations

Image negative: s = L− 1− r

Powers, nth roots, Log transformations etc..

IT472: Lecture 5 7/18

Page 19: Image Processing 3

Intensity transformations

Image negative: s = L− 1− r

Powers, nth roots, Log transformations etc..

IT472: Lecture 5 7/18

Page 20: Image Processing 3

Intensity transformations

Image negative: s = L− 1− r

Powers, nth roots, Log transformations etc..

IT472: Lecture 5 7/18

Page 21: Image Processing 3

Applications of Intensity transformations

Intensity transformations are used frequently for Contrastenhancement.

Contrast measures how much the object color/grey valuediffers from its surroundings.

Objective definitions:

� Weber contrast: I−IbIb

� Michelson contrast: Imax−Imin

Imax+Imin

� RMS contrast:√∑M

i=1

∑Nj=1(Iij − I )2

Appropriate transformation must be chosen depending onwhat grey values you want to enhance and what is thecontent of the input image.

IT472: Lecture 5 8/18

Page 22: Image Processing 3

Applications of Intensity transformations

Intensity transformations are used frequently for Contrastenhancement.

Contrast measures how much the object color/grey valuediffers from its surroundings.

Objective definitions:

� Weber contrast: I−IbIb

� Michelson contrast: Imax−Imin

Imax+Imin

� RMS contrast:√∑M

i=1

∑Nj=1(Iij − I )2

Appropriate transformation must be chosen depending onwhat grey values you want to enhance and what is thecontent of the input image.

IT472: Lecture 5 8/18

Page 23: Image Processing 3

Applications of Intensity transformations

Intensity transformations are used frequently for Contrastenhancement.

Contrast measures how much the object color/grey valuediffers from its surroundings.

Objective definitions:

� Weber contrast: I−IbIb

� Michelson contrast: Imax−Imin

Imax+Imin

� RMS contrast:√∑M

i=1

∑Nj=1(Iij − I )2

Appropriate transformation must be chosen depending onwhat grey values you want to enhance and what is thecontent of the input image.

IT472: Lecture 5 8/18

Page 24: Image Processing 3

Applications of Intensity transformations

Intensity transformations are used frequently for Contrastenhancement.

Contrast measures how much the object color/grey valuediffers from its surroundings.

Objective definitions:

� Weber contrast: I−IbIb

� Michelson contrast: Imax−Imin

Imax+Imin

� RMS contrast:√∑M

i=1

∑Nj=1(Iij − I )2

Appropriate transformation must be chosen depending onwhat grey values you want to enhance and what is thecontent of the input image.

IT472: Lecture 5 8/18

Page 25: Image Processing 3

Applications of Intensity transformations

Intensity transformations are used frequently for Contrastenhancement.

Contrast measures how much the object color/grey valuediffers from its surroundings.

Objective definitions:

� Weber contrast: I−IbIb

� Michelson contrast: Imax−Imin

Imax+Imin

� RMS contrast:√∑M

i=1

∑Nj=1(Iij − I )2

Appropriate transformation must be chosen depending onwhat grey values you want to enhance and what is thecontent of the input image.

IT472: Lecture 5 8/18

Page 26: Image Processing 3

Applications of Intensity transformations

Intensity transformations are used frequently for Contrastenhancement.

Contrast measures how much the object color/grey valuediffers from its surroundings.

Objective definitions:

� Weber contrast: I−IbIb

� Michelson contrast: Imax−Imin

Imax+Imin

� RMS contrast:√∑M

i=1

∑Nj=1(Iij − I )2

Appropriate transformation must be chosen depending onwhat grey values you want to enhance and what is thecontent of the input image.

IT472: Lecture 5 8/18

Page 27: Image Processing 3

Applications of Intensity transformations

Intensity transformations are used frequently for Contrastenhancement.

Contrast measures how much the object color/grey valuediffers from its surroundings.

Objective definitions:

� Weber contrast: I−IbIb

� Michelson contrast: Imax−Imin

Imax+Imin

� RMS contrast:√∑M

i=1

∑Nj=1(Iij − I )2

Appropriate transformation must be chosen depending onwhat grey values you want to enhance and what is thecontent of the input image.

IT472: Lecture 5 8/18

Page 28: Image Processing 3

Contrast enhancement

We will frequently use the log-transformation to view theFourier spectrum of an image.

IT472: Lecture 5 9/18

Page 29: Image Processing 3

Contrast enhancement

We will frequently use the log-transformation to view theFourier spectrum of an image.

IT472: Lecture 5 9/18

Page 30: Image Processing 3

Gamma transformations

s = crγ

IT472: Lecture 5 10/18

Page 31: Image Processing 3

Gamma transformations

Gamma correction in CRTs

IT472: Lecture 5 11/18

Page 32: Image Processing 3

Gamma transformations

Enhance dark grey-values in the image.

IT472: Lecture 5 12/18

Page 33: Image Processing 3

Gamma transformations

Enhance brighter grey-values in the image.

IT472: Lecture 5 13/18

Page 34: Image Processing 3

Contrast stretching

IT472: Lecture 5 14/18

Page 35: Image Processing 3

Intensity slicing

IT472: Lecture 5 15/18

Page 36: Image Processing 3

Bit-plane slicing

Every pixel needs 8 bits (assuming gray values from 0 - 255).

Every bit plane can be thought of as a binary image.

IT472: Lecture 5 16/18

Page 37: Image Processing 3

Bit-plane slicing

Every pixel needs 8 bits (assuming gray values from 0 - 255).

Every bit plane can be thought of as a binary image.

IT472: Lecture 5 16/18

Page 38: Image Processing 3

Bit-plane slicing

Every pixel needs 8 bits (assuming gray values from 0 - 255).

Every bit plane can be thought of as a binary image.

IT472: Lecture 5 16/18

Page 39: Image Processing 3

Bit-plane slicing

IT472: Lecture 5 17/18

Page 40: Image Processing 3

Bit-plane slicing

Can be used for image compression.

Figure: (top row) Reconstructions from bit planes (bottom) Originalimage

IT472: Lecture 5 18/18