multimedia programming 08: point processing 4 departments of digital contents sang il park
TRANSCRIPT
Multimedia Programming 08:
Point Processing 4Departments of Digital
ContentsSang Il Park
Image Processing 1-2
Neighborhood Processing (Filtering)
Alexei Efros
k
ku
k
kv
vyuxFk
yxG ],[)12(
1],[
2
Cross-correlation filtering ( 상호 - 상관 필터 )
평균은 모든 점들마다 1/(2k+1)2 의 값을 곱하는 것 . 만약 점들마다 서로 다른 값을 곱한다면 ?
위와 같은 식을 상호상관 연산이라고 하며 다음과 같이 줄여 쓴다 .
H ( 각 점의 가중치 ) 를 “ filter,” “kernel,” 또는 “ mask” 라고 부른다 .
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( 중간값 )
값을 크기순으로올림차순으로 나열
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)
Unsharp Masking ( 언샵 필터링 )
• 블러링 (smoothing) 이 지워버리는 정보는 무엇일까 ?
=+
blurred difference original
200 400 600 800
100
200
300
400
500
- =
original blurred difference
• 블러된 이미지에 사라진 정보를 더하면 원본을 얻을 수 있다 .
Unsharp Masking ( 언샵 필터링 )
• 사라진 정보를 강조하여 표현한다면 ?
=+
blurred difference original
• alpha 값을 조절하면 이미지의 날카로움을 조절할 수 있다
이를 Unsharp 필터라고 한다 .
Unsharp Masking ( 언샵 필터링 )
• Example:
Source image Alpha = 0
Unsharp Masking ( 언샵 필터링 )
• Example:
Source image Alpha = 0.5
Unsharp Masking ( 언샵 필터링 )
• Example:
Source image Alpha = 1
Unsharp Masking ( 언샵 필터링 )
• Example:
Source image Alpha = 2
Unsharp Masking ( 언샵 필터링 )
• Example:
Source image Alpha = 2Alpha = 4
Color VS. Gray
• Gray image 가 지워버리는 정보는 무엇일까 ?
• Gray 이미지에 사라진 정보를 더하면 원본을 얻을 수 있다 .
200 400 600 800
100
200
300
400
500
- =
original Gray difference
=+
Gray difference original
Unsharp Masking ( 언샵 필터링 )
• 사라진 정보를 강조하여 표현한다면 ?
=+
Gray difference New image
• alpha 값을 조절하면 이미지의 채도를 조절할 수 있다
Smart Blurring?
Image Processing 1-3
Histogram Equalization
Alexei Efros
Image Histogram
• Histogram:– Counting the number of pixels with the same
brightness
image histogram
http://www.accusoft.com/resourcecenter/tutorials/dip/VQ/lesson1c.htm
Image Histogram
• Histogram:– Counting the number of pixels with the same
brightness
http://www.cambridgeincolour.com/tutorials/histograms1.htm
Image Histogram
• Example
http://www.cambridgeincolour.com/tutorials/histograms1.htm
Image Histogram
• Two images
http://www.cambridgeincolour.com/tutorials/histograms1.htm
• Modify the image to have a well-distributed histogram
Histogram Equalization
Cumulative Histogram
• Number of the pixels below the brightness
image histogram Cumulative histogram
http://www.accusoft.com/resourcecenter/tutorials/dip/VQ/lesson1c.htm
Cumulative histogram
Cumulative Histograms
Why is it so important?
Why is it so important?
Let’s focus on the first image.
255
192
128
64
0
input
output
Why is it so important?
Using Cumulative histogram as a function.
255
192
128
64
0
input
output
input
outp
ut
Histogram Equalization
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
Recoveringthe colorful underwater world!
http://www.dive.snoack.de/