correcting image defects - mahidol university · 2020. 10. 30. · the real coordinates of these 4...

27
Chaiwoot Boonyasiriwat October 30, 2020 Correcting Image Defects

Upload: others

Post on 11-Mar-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

Chaiwoot BoonyasiriwatOctober 30, 2020

Correcting Image Defects

Page 2: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

2

▪ “Most digital cameras detect color in RGB channels.”

▪ “An RGB color space is an additive color space based

on the RGB color model.” (Wikipedia)

▪ “The RGB color model is simple because the axes are

orthogonal.”

RGB Color Space

Russ and Neal (2016; p.164)

Page 3: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

3

▪ “CIE chromaticity diagram is a 2D plot defining color.”

▪ The third axis (pointing out of plane) is brightness.

▪ “Mixing any 2 colors

corresponds to selecting

a new point along a straight

line between the 2 colors.”

▪ CRT monitor can produce

colors shown in the triangle.

▪ The range of possible

colors for any display is

called gamut

CIE Chromaticity Diagram

Russ and Neal (2016; p.164)

Page 4: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

4

RGB can be transformed to CIEL*a*b* by

where

Xn, Yn, Zn are calculated using R = G = B = 100.

CIELab Color Space

Lightness from black (0) to white (100)

From green to red

From blue to yellow

Page 5: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

5

▪ “The CIE diagram provides a means for color definition

but does not correspond directly to human vision.”

▪ To address this issue, HSV (hue, saturation, value), HSI

(hue, saturation, intensity), and HLS (hue, lightness,

saturation) coordinate systems were defined.

▪ “Hue is what people mean by color.”

▪ “Saturation is the amount of color that is present.”

▪ “The third axis (lightness, brightness, intensity, or

value) is the amount of light.”

HSI Color Space

Russ and Neal (2016; p.166)

Page 6: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

6

HSI Color Space

Russ and Neal (2016; p.167)

Page 7: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

7

▪ Projecting a tilted RGB cube onto a

plane yields a hexagon with red,

yellow, green, cyan, blue, and

magenta at its corner.

▪ “Hue is roughly the angle of the

vector to a point in the projection.”

▪ Red at 0. Chroma C is the distance

of the point from the origin.

HSI Color Space

Wikipedia

Page 8: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

8

▪ Hue can be computed by

▪ Lightness can be computed by

HSI Color Space

https://en.wikipedia.org/wiki/HSL_and_HSV

Page 9: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

9

▪ Smoothing can reduce random noise in an image.

▪ Smoothing can be performed by multiplying a portion

of an image by an averaging kernel.

▪ Example: boldface number represents the center pixel

▪ This filter is applied at one location and is shifted to

another location until all pixels in the image are

processes so the filter is called a moving average filter.

Smoothing Filter

Russ and Neal (2016; p.180)

Page 10: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

10

▪ A Gaussian smoothing filter has a kernel that

approximate the Gaussian function

Gaussian Smoothing

Russ and Neal (2016; p.181)

Page 11: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

11

▪ A 7x7 Gaussian smoothing kernel

▪ Instead of applying a 2D filter, we can apply two 1D

filters in horizontal and vertical directions.

Gaussian Smoothing

Russ and Neal (2016; p.182)

Page 12: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

12

▪ Applying a filter is to convolve an image with the filter.

Gaussian Smoothing

Russ and Neal (2016; p.183)

Page 13: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

13

▪ A median filter can reduce noise with extreme values

from an image by applying a median operation as a

kernel.

Median Filter

Russ and Neal (2016; p.186)

5x5 median filter

Examples of kernel shapes

Page 14: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

14

▪ Nonuniform illumination in an image can be removed

by image subtraction.

▪ Images A and B were recorded under the same lighting

conditions.

Nonuniform Illumination

Russ and Neal (2016; p.216)

A - B = C

Page 15: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

15

▪ To enhance a fingerprint on a bank note, the complex

background is removed by an image subtraction using

an image of another note.

▪ Alignment between the two image was performed using

cross-correlation.

Forensic Application

Russ and Neal (2016; p.216)

A - B = C

Page 16: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

16

▪ When the background image is not recorded, we may

use interpolation to generate a background image.

Nonuniform Illumination

Russ and Neal (2016; p.218)

The red part was masked

out.

A third-order polynomial

was used to fit the

background points:

Page 17: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

17

▪ When the background is darker than foreground, we can

subdivide the image into many regions.

▪ Within each region, we find the darkest pixel.

Nonuniform Illumination

Russ and Neal (2016; p.219)

These values and their locations are

used to fit the polynomial

and then subtract it from the original

image.

Page 18: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

18

▪ If the features of interest are smaller than the

background which is darker or lighter than the features,

we can use rank operations such as median.

▪ In (b), each pixel is replaced by the darkest pixel in a

5x5 kernel.

▪ (c) is the result after 4 repetitions of this operation.

▪ a – c = d

Rank Leveling

Russ and Neal (2016; p.223)

Page 19: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

19

Rank Leveling

Russ and Neal (2016; p.225)

Page 20: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

20

Rank Leveling

Russ and Neal (2016; p.225)

Page 21: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

21

Rank Leveling on Color Image

Russ and Neal (2016; p.227)

▪ The background image is obtained by using a

morphological opening operation.

Page 22: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

22

Geometric Distortion

Russ and Neal (2016; p.230)

▪ Geometric distortion in an image can be rectified by

identifying 4 points on the image

▪ The real coordinates of these 4 points must be

known.

▪ Substituting the coordinates of the 4 points and

into the equations

will lead to a linear system whose solution contains the

values of ai and bi.

▪ The equations are then used to form all the pixels in the

image.

Page 23: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

23

Geometric Distortion

Russ and Neal (2016; p.232)

Page 24: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

24

Geometric Distortion

Russ and Neal (2016; p.232)

▪ Combining 4 images after correcting the distortion

enhances the license plate.

Page 25: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

25

Image Alignment

Russ and Neal (2016; p.234)

▪ Multiple images might need some alignment so that

they can be patched together, e.g., as shown below.

▪ “Points to be aligned may be located manually by the

user or automatically using cross-correlation.”

▪ Alignment equations are of the form

Page 26: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

26

Image Alignment

Russ and Neal (2016; p.230)

▪ Registration of PET (small), MRI (medium), and CT

(large) images. 3 points are used for alignment.

Page 27: correcting image defects - Mahidol University · 2020. 10. 30. · The real coordinates of these 4 points must be known. Substituting the coordinates of the 4 points and into the

▪ J. C. Russ and F. B. Neal, 2016, The Image Processing

Handbook, 7th edition, CRC Press.

References