multimedia programming 08: point processing 4 departments of digital contents sang il park

28
Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Upload: conrad-terry

Post on 17-Dec-2015

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Multimedia Programming 08:

Point Processing 4Departments of Digital

ContentsSang Il Park

Page 2: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Image Processing 1-2

Neighborhood Processing (Filtering)

Alexei Efros

Page 3: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

k

ku

k

kv

vyuxFk

yxG ],[)12(

1],[

2

Cross-correlation filtering ( 상호 - 상관 필터 )

평균은 모든 점들마다 1/(2k+1)2 의 값을 곱하는 것 . 만약 점들마다 서로 다른 값을 곱한다면 ?

위와 같은 식을 상호상관 연산이라고 하며 다음과 같이 줄여 쓴다 .

H ( 각 점의 가중치 ) 를 “ filter,” “kernel,” 또는 “ mask” 라고 부른다 .

Page 4: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Median filtering ( 중간값 필터 )

• 윈도우 내에서 중간값을 선택하는 것을 중간값 필터라고 한다 .

0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 90 0 90 90 90 0 0

0 0 0 90 90 90 90 90 0 0

0 0 0 0 0 0 0 0 0 0

0 0 90 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0

0 0 0

0 90 0

0 0 0

1 2 3 4 5 6 7 8 90 0 0 0 0 0 0 0 90

Median( 중간값 )

값을 크기순으로올림차순으로 나열

Page 5: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Blurring Function in OpenCV

• Type: – CV_BLUR : Mean Filtering– CV_GAUSSIAN : Gaussian Filtering– CV_MEDIAN : Median Filter

• Size: 3, 5, 7, …, 2k+1

cvSmooth(IplImage * src, IplImage * dst, int type, int size)

cvSmooth(IplImage * src, IplImage * dst, int type, int size)

Page 6: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Unsharp Masking ( 언샵 필터링 )

• 블러링 (smoothing) 이 지워버리는 정보는 무엇일까 ?

=+

blurred difference original

200 400 600 800

100

200

300

400

500

- =

original blurred difference

• 블러된 이미지에 사라진 정보를 더하면 원본을 얻을 수 있다 .

Page 7: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Unsharp Masking ( 언샵 필터링 )

• 사라진 정보를 강조하여 표현한다면 ?

=+

blurred difference original

• alpha 값을 조절하면 이미지의 날카로움을 조절할 수 있다

이를 Unsharp 필터라고 한다 .

Page 8: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Unsharp Masking ( 언샵 필터링 )

• Example:

Source image Alpha = 0

Page 9: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Unsharp Masking ( 언샵 필터링 )

• Example:

Source image Alpha = 0.5

Page 10: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Unsharp Masking ( 언샵 필터링 )

• Example:

Source image Alpha = 1

Page 11: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Unsharp Masking ( 언샵 필터링 )

• Example:

Source image Alpha = 2

Page 12: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Unsharp Masking ( 언샵 필터링 )

• Example:

Source image Alpha = 2Alpha = 4

Page 13: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Color VS. Gray

• Gray image 가 지워버리는 정보는 무엇일까 ?

• Gray 이미지에 사라진 정보를 더하면 원본을 얻을 수 있다 .

200 400 600 800

100

200

300

400

500

- =

original Gray difference

=+

Gray difference original

Page 14: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Unsharp Masking ( 언샵 필터링 )

• 사라진 정보를 강조하여 표현한다면 ?

=+

Gray difference New image

• alpha 값을 조절하면 이미지의 채도를 조절할 수 있다

Page 15: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Smart Blurring?

Page 16: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Image Processing 1-3

Histogram Equalization

Alexei Efros

Page 17: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Image Histogram

• Histogram:– Counting the number of pixels with the same

brightness

image histogram

http://www.accusoft.com/resourcecenter/tutorials/dip/VQ/lesson1c.htm

Page 18: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Image Histogram

• Histogram:– Counting the number of pixels with the same

brightness

http://www.cambridgeincolour.com/tutorials/histograms1.htm

Page 19: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Image Histogram

• Example

http://www.cambridgeincolour.com/tutorials/histograms1.htm

Page 20: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Image Histogram

• Two images

http://www.cambridgeincolour.com/tutorials/histograms1.htm

Page 21: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

• Modify the image to have a well-distributed histogram

Histogram Equalization

Page 22: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Cumulative Histogram

• Number of the pixels below the brightness

image histogram Cumulative histogram

http://www.accusoft.com/resourcecenter/tutorials/dip/VQ/lesson1c.htm

Page 23: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Cumulative histogram

Cumulative Histograms

Why is it so important?

Page 24: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Why is it so important?

Let’s focus on the first image.

255

192

128

64

0

input

output

Page 25: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Why is it so important?

Using Cumulative histogram as a function.

255

192

128

64

0

input

output

input

outp

ut

Page 26: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Histogram Equalization

Page 27: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Coding Practice

• Make your own code for histogram equalization• For each color channel (R, G, B)

– 1. Compute the histogram

– 2. Compute the cumulative histogram

– 3. Set the maximum value as 255

– 4. Using the cumulative histogram as a mapping function

255

192

128

64

0

Page 28: Multimedia Programming 08: Point Processing 4 Departments of Digital Contents Sang Il Park

Recoveringthe colorful underwater world!

http://www.dive.snoack.de/