chapter 3: intensity transformations and spatial filtering (3.3...

48
Digital Image Processing Chapter 3: Intensity Transformations and Spatial Filtering (3.3.3 – 3.6.2)

Upload: others

Post on 01-Nov-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

Digital Image ProcessingChapter 3: Intensity Transformations and

Spatial Filtering

(3.3.3 – 3.6.2)

Page 2: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.3.3 Local Histogram Processing

• Enhance details over small areas- in the neighborhood of every pixel in the image.

• Local histogram equalization.

Original image Global histogramequalization

Local histogramequalization usingneighborhood of 3 x 3

Page 3: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

• The nth statistical moment is

• Mean: measure of average gray level

• Variance: measure of average contrast

히스토그램을 이용하여 영상을 향상 시킬 때, 히스토그램의 통계적인 변수를 이용하는 방법

r을 [0, L-1]의 범위에서 이산의 명암도를 나타내는 랜덤 변수, p(ri)는 i번째의 r값에 대응하는 정규화된 히스토그램의 성분

평균에 대한 n차 moment는 다음과 같이 정의한다.

여기서 m은 r의 평균값(즉, 평균 명암도)

3.3.4. Use of Histogram Statistics for Image Enhancement

Page 4: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.3.4. Use of Histogram Statistics for Image Enhancement

2차 moment:

이 표현은 r의 분산(variance) 2(r)이다.

영상 향상에 평균 명암도의 측도인 평균과 평균 대비의 측도인 분산 (또는 표준편차)의 특성을 사용한다. 국부적인 영상 향상에 효과적이다.

For image intensities, a sample mean:

sample variance:

평균에서 얼마나 떨어져 있는가

Page 5: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

Before proceeding, it will be useful to work through a simple numerical example to fix ideas. Consider the following 2-bit image of size 5 x 5:

0 0 1 1 21 2 3 0 13 3 2 2 02 3 1 0 01 1 3 2 2

The pixels are represented by 2 bits; therefore, L=4 and the intensity levels are in the range [0,3]. The total number of pixels is 25, so the histogram has the components

𝑝 𝑟0 =6

25= 0.24; 𝑝 𝑟1 =

7

25= 0.28;

𝑝 𝑟2 =7

25= 0.28; 𝑝 𝑟3 =

5

25= 0.20;

Page 6: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

Where the numerator in 𝑝 𝑟𝑖 is the number of pixels in the image with intensity level 𝑟𝑖. We can compute the average value of the intensities in the image using Eq.(3.3-18):

𝑚 =

𝑖=0

3

𝑟𝑖𝑝 𝑟𝑖

= 0 0.24 + 1 0.28 + 2 0.28 + 3 0.20= 1.44

Letting 𝑓(𝑥, 𝑦) denote the preceding 5 x 5 array and using Eq.(3.3-20), we obtain

𝑚 =1

25

𝑥=0

4

𝑦=0

4

𝑓(𝑥, 𝑦)

= 1.44

Page 7: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

• As previously, we may specify global mean and variance (for the entire image) and local mean and variance for a specified sub-image (subset of pixels).

Tungsten

filamentTungsten

filament

Page 8: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

G(x,y) = Ef(x,y) if mSxy < k0mG AND k1G < Sxy < k2G

= f(x,y) otherwise

E=4.0K0=0.4K1=0.02K2=0.4Sxy: 3 x 3

Page 9: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.4.1 Mechanics of spatial filtering

• Assuming a 3 x 3 neighborhood, at any point (x,y) in the image, the response of the spatial filter is

• In general:

Page 10: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

• Linear spatial filtering

• Here a mask size is m x n.

• m= 2a+1

• n= 2b+1

• Where a and b are some integers.

Subimage: Filter, Mask, Kernel,

Template, or Window

For a 3 x 3 mask

공간적 필터처리(Spatial Filtering): 이웃점 내의 영상 화소 값으로 영상의 화소에 직접 수행하는 필터처리 연산.

Page 11: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.4.2 Spatial correlation and convolution

Page 12: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.4.2 Spatial correlation and convolution

Page 13: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.4.2 Spatial correlation and convolution

• Correlation of a filter w(x,y) of size m x n with an image f(x,y) is

• Convolution of a filter w(x,y) of size m x n with an image f(x,y) is

convolution은 두 함수중 어느 것을 이동시키는가에 상관이 없이 같은 결과를 만든다. 그러나 correlation 달라진다.

Page 14: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.4.3 Vector representation of linear filtering

• 임의의 점 (x,y)에서 mxn 마스크의 응답 R은

• For example, for a 3 x 3 filter

Filter coefficient

Image intensities

Page 15: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.4.4 Generating spatial filter masks

Smoothing Filter (Averaging Filter or Lowpass Filter):출력(응답)은 단순하게 필터 마스크의 이웃점 내에 포함된 화소들의 평균.

-필터 마스크에 의하여 정의된 이웃점들의 명암도 평균으로영상 내의 모든 화소값을 교체- 가장자리를 흐리게 하는 원하지 않는 부작용이 발생.

3x3 Smoothing Filter Intensity level

Page 16: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.5 Smoothing spatial filters

a

as

b

bt

a

as

b

bt

tsw

tysxftsw

yxg

),(

),(),(

),(

Weighted Average Filter:- 위치에 따라서 다른 계수를 곱한다.- 중심 화소에서 가장 큰 값의 계수를 갖는다.- 대각선 화소에서 가장 작은 값을 갖는다.

Zi

Average of Intensity

smoothing (averaging or lowpass)

Page 17: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

The effect of filter size.The original 500x500

image

And the results of smoothing

with a square averaging filter ofsizes m = 3, 5, 9,

15, 25, and35 pixels.

3.5 Smoothing spatial filters

(1 X 1) (3 X 3)

(9 X 9)

(35 X 35)

(5 X 5)

(15 X 15)

Page 18: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.5 Smoothing spatial filters

25% Threshold value

Page 19: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.5.2 Order-statistic (nonlinear) filters

Non-linear filters: Order (rank) pixels, e.g. median filter•Noise reduction: Salt-and-pepper noise

Page 20: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.6.1 Sharpening Spatial Filters:foundations

Sharpening Spatial Filter

: 미세한 묘사 강조, 흐린 영상 개선.

1단계1) Must be zero in flat segments

2) Must be nonzero at the onset of a gray-level step or

ramp

3) Must be nonzero along ramps

2단계1) Must be zero in flat areas

2) Must be nonzero at the onset and end of a gray-level

step or ramp

3) Must be zero along ramps of constant slope

Page 21: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

Sharpening spatial filters:foundations

Page 22: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 23: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.6.2 Using the second derivative for image sharpening – the Laplacian

• (Isotropic Filter: 영상 내에서 불연속점의 방향에 독립적인 응답, 즉, 영상을 회전시키고 난 후, 필터를 적용한 결과와 먼저 필터를 적용하고 그 후 결과를 회전시키는 것과 동일한 결과를 나타낸다. Rotation Invariant

• The simplest isotropic derivative operator is the Laplacian:

• Discrete form: x-direction

• Discrete form: 2-D Laplacian - sum of the two components

Isotropic Derivative Operator두 변수 함수(영상) f(x, y)에 대하여

Page 24: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

• (a) and (c): Isotropic results for increments of 90o

• (b) and (d): Isotropic results for increments of 45o

y) 4f(x,- 1)]-y f(x, 1)y f(x, y) 1,-f(x y) 1,[f(x 2 f

3.6.2 Using the second derivative for image sharpening – the Laplacian

Page 25: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

Outputintensity

Inputintensity

-1 : if the center is negative; +1 : otherwise

3.6.2 Using the second derivative for image sharpening – the Laplacian

Page 26: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 27: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 28: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.6.3 Unsharp Masking and Highboost Filtering

1. Blur the original2. Subtract the blurred

image from the original(The resulting difference is called the mask)

3. Add the mask to the orignal

The mask: Gmask(x,y) = f(x,y) - f(xy) (3.6-8)

G(x,y) = F(x,y)+k*Gmask(x,y)(3.6-9)

k>1: highboostk<1: de-emphasize the contribution of the unsharpmask

Page 29: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 30: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 31: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 32: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 33: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영

3.8 Using Fuzzy Techniques for Intensity Transformations and Spatial Filtering (!!SKIP!!)

Page 34: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 35: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 36: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 37: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 38: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 39: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 40: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 41: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 42: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 43: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 44: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 45: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 46: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 47: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영
Page 48: Chapter 3: Intensity Transformations and Spatial Filtering (3.3 ...contents.kocw.net/KOCW/document/2014/korea/ohchanghun/3.pdf공간적필터처리(Spatial Filtering): 이웃점내의영