[CV] Computer Vision(1-1): Image_formation - point operator
๐Computer Vision ์ ๋ฆฌ
Image
Digital Camera vs Human eye
- Similarities between human eye and digital camera
- Lens, iris(aperture), โฆ
- Retina corresponds to image sensors (i.e. CCD, CMOS)
- Digital Image sensor
CCD(Charge-coupled device)
- ๊ด์๊ฐ ๋ค์ด์์ ์ผ์๋ฅผ ๋๋ฆฌ๋ฉด charge๊ฐ ๋จ -> pixel to pixel๋ก ์ ๋ฌ๋๋ฉฐ output์ด ๋์ดCOMS(Complementary metal oxide on silicon)
- ๊ฐ ํฝ์ ์์ ์ง์ ์ ์ ์ ํธ๋ก ๋ณํํ๋ ๋ฐฉ์
Digital image
- Sampling - 2์ฐจ์ ์ด๋ฏธ์ง๋ M x N(ex 12์ ๊ฒฉ์) ์ผ๋ก ์ํ๋๋ฉฐ ๊ทธ ์ด๋ฏธ์ง๊ฐ
- Quantuzation - ๋ฐ๊ธฐ level๋ quantizedํด์ ๋ํ๋(์ค์ ํ ์์ํ level์ ๋ฐ๋ผ์, 2์ ์ ๊ณฑ์๋ก ํ๋ฉฐ ํธํจ 0~255๊ฐ์)
Image Coordinate system
- ์ด๋ฏธ์ง๋ ๊ธฐ๋ณธ์ ์ผ๋ก 2์ฐจ์๋ฐฐ์ด, ๊ฐ๊ฐ์ pixel
- ๊ฐ๊ฐ์ pixel์ ์ฃผ์๋ฅผ ๋ถ์ฌํด์ผํจ f(j,i) / f(y,x) (y=์ธ๋ก์ถ, x=๊ฐ๋ก์ถ) ์ด๊ฑด ํ๋ฐฑ์ ๊ฒฝ์ฐ
- ๊ฐ๊ฐ์ pixel์ ์ํ๋ง ๋ ์ ์ด๋ค. ๊ทธ๋์ ์ ์์ ์ขํ๋ฅผ ๊ฐ์ง๊ฒ ๋จ
- Color image: ๊ฐ๊ฐ pixel์ 2์ฐจ์ ๊ฐ์ 3๊ฐ ๊ฐ์ง๋ค.
fr(x)
,fg(x)
,fb(x)
- ์ ์๊ฐ ์๋ ์ค์๋ฅผ ์จ์ผํ ๊ฒฝ์ฐ๊ฐ ์์(์ด๋ฏธ์ง ๋ณด์ ๋ฑ์ ์ฌ์ฉ)
Color models
- ์ฐ๋ฆฌ ๋์ 380-750nm ์์ ์๋ ๋น(๊ฐ์๊ด์ )๋ง ๋ณผ ์ ์๋ค
- ์์์ ์ธ์ฐ์ง ๋ง๊ณ ๋ชจ๋ธ์ด ๋ญ๊ฐ ์๋์ง ์๊ณ ์์๊ฒ
Tri-stimulus theory
- Tri-stimulus theory: ์ฐ๋ฆฌ ๋์๋ RGB๋ฅผ ๋ฐ์ ๋ค์ผ ์ ์๋ 3๊ฐ์ ์ธํฌ(์์ถ์ธํฌ(cone cell))๊ฐ ์๋ค.
- ๋ค๋ฅธ ์์์ RGBํ์ฅ์ ์กฐํ๋ฅผ ํตํด ๋ํ๋ด์๋ ์ด๋ก
XYZ Color model
- Tri-stimulus: ์์๊ฐ์ด ์์ง๋ง ์ด๊ฑธ ์์ ๊ธฐ ์ํด ๊ฐ์ค์น๋ฅผ ๋ํด ์์๋ฅผ ๋ง๋ค์๋ ๋ชจ๋ธ
X=red
์ ๊ฐ์ค์น,Y=green
์ ๊ฐ์ค์น,Z=blue
์ ๊ฐ์ค์นY-axis
๋ ํ๋๋ผ๊ณ ๋ถ๋ฆฐ๋ค.- x,y,z์ sum์ ๋ฌด์กฐ๊ฑด 1
RGB color Model
- Red(1,0,0), Green(0,1,0), Blue(0,0,1)
- ๋ชจ๋ ์์ ์ ์ก๋ฉด์ฒด ์์์ ๋ํ๋ผ ์ ์๋ค.
Color filter arrays
์ค๋ฅธ์ชฝ์ Bayer pattern
- ๊ฐ๊ฐ์ ์์ ๊ตฌ๋ณํ๊ธฐ ์ํด fliter๋ฅผ ์์ด๋ค.
- red๋ง senseํ๊ธฐ ์ํด์ color filter๋ฅผ ์์ฐ๋ฉด red๋ง ์ธ์ํจ
- ๋ง์ด ์ฐ๋ ํจํด์ Bayer pattern(green์ ํ๋์ ๋ง์ ์ํฅ์ ๋ผ์น๊ธฐ ๋๋ฌธ์ 1/2์ ์ฌ์ฉํจ)
Represent RGB color model
YCrCb/YUV/YIQ Color Model
- ๊ฐ์ ์ธ์ธ ํ์ X
HSV Color model
- ์ฌ๋์ ์์ ์์กฐ(Hue),์ฑ๋(Saturation),๋ช
๋(Value) ์ด 3๊ฐ์ง๋ก ์ธ์์ ํ๊ฒ ๋๋ค.
Image processing operators
ํ ์ด๋ฏธ์ง์ ํฝ์ ๋ค์ ๊ฐ์ ๋ณ๊ฒฝํด์ ์ด๋ฏธ์ง์ ์ ์ฉํ๋ ์ฐ์ฐ์๋ค์ด ์๋ค.
- Point operator: ๊ฐ๊ฐ์ pixel์ ๋ ๋ฆฝ์ ์ผ๋ก ์ฐ์ฐํด์ ์ฒ๋ฆฌ(ํ๋์ ์ด๋ฏธ์ง์์ ๊ฐ๋ฅ)
- Neighborhood operator: ํ๋์ pixel๊ฐ์ ๋ณ๊ฒฝํ๊ธฐ ์ํด ์ฃผ๋ณ์ pixel๊น์ง ๊ณ ๋ คํด์ ์ฒ๋ฆฌ(์ด๋ฏธ์ง๋ฅผ ๋๊ฐ๋ก ๋ง๋ค์ด์ ํ๋๋ ์ ์ฅ์ฉ, ํ๋๋ ๊ณ์ฐ์ฉ)
- Geometric transformation: global operation ์ฆ ์ ์ฒด์ ๊ฐ์ ํ๋ฒ์ ๋ณ๊ฒฝํจ(ํ์ , ์ด๋, ํ๋/์ถ์, ์๊ณก ๋ฑ)
Point operator
๐point operator: ๊ฐ ํฝ์ ์ ๊ฐ๋ง์ ์ด์ฉํด์ ๋ ๋ฆฝ์ ์ผ๋ก ๊ทธ ํฝ์ ์ ๊ฐ๋ง์ ๋ณํํ๋ ์ฐ์ฐ์
ex: ๋ฐ๊ธฐ ์กฐ์ , ๋๋น ์กฐ์ , ๊ฐ๋ง ๋ณด์ ๋ฑ
- ์ผ๋ฐ์ ์ธ pointer operator์ ํํ: \(f_outโ(x,y)=t(f_inโ(x,y))\)
- $๐_in(๐ฅ,๐ฆ)$: ์ ๋ ฅ ํฝ์ ๊ฐ
- $๐_out(๐ฅ,๐ฆ)$: ์ถ๋ ฅ ํฝ์ ๊ฐ
- $t$: ํฝ์ ๊ฐ์ ๋ณํํ๋ ํจ์
Linear Point Operators
linear operators: ๋ ์ด๋ฏธ์ง $f_0$. %f_1%์ ๊ฐ๊ฐ ์ฐ์ฐํ ํ ๋ํ ๊ฒฐ๊ณผ = ๋ ์ด๋ฏธ์ง๋ฅผ ๋ํ ํ ์ฐ์ฐํ ๊ฒฐ๊ณผ
\[t(f_0+f_1) = t(f_0)+t(f_1)\]โ ๋ฐ๊ธฐ ์กฐ์ ์ฐ์ฐ
- ๋ฐ๊ฒ ๋ง๋๋ ์ฐ์ฐ: \(f_out(j,i) = min(f_in(j,i)+a,L-1)\)
- ์ด๋ก๊ฒ ๋ง๋๋ ์ฐ์ฐ: \(f_out(j,i) = max(f_in(j,i)+a,0)\)
๋ฐ์ ์ฐ์ฐ: \(f_out(j,i) = (L-1)-f_in(j,i)\)
- $a$: ๋ฐ๊ธฐ ์กฐ์ ๊ฐ
- $L$: ํฝ์ ๊ฐ์ด ๊ฐ์ง ์ ์๋ ์ต๋๊ฐ(๋ณดํต 256)
linear point operator ์์
๋ฐ๊ธฐ ์กฐ์ ๋ฐ ๋ฐ์
โ
Linear Blend ์ฐ์ฐ
๋ ์ด๋ฏธ์ง๋ฅผ ํผํฉํ์ฌ ์ค๊ฐ ๋จ๊ณ์ ์ด๋ฏธ์ง๋ฅผ ์์ฑํ๋ค
- ํผํฉ ์ฐ์ฐ: \(f_out(j,i)=\alphaf_1(j,i)+(1-\alpha)f_2(j,i)\)
- alpha๊ฐ 0์์ 1๋ก ๋ณํ ๋ ์ด๋ฏธ์ง๊ฐ ์ ์ง์ ์ผ๋ก ๋ณํ
๊ฐ๊ฐ 1๋ฒ, 6๋ฒ์ด 2๊ฐ์ ์ฌ์ง์ด๋ค. ๊ทธ ์ฌ์ด์๋ ์ค๊ฐ ์ฌ์ง
Non-linear point operator-Gamma correction
๐Gamma Correction: ์ด๋ฏธ์ง์ ๋ฐ๊ธฐ ์์ค์ ๋น์ ํ์ ์ผ๋ก ์กฐ์ ๋ชจ๋ํฐ(CRT)์ ์ถ๋ ฅ ๋ฐ๊ธฐ๊ฐ ์ ๋ ฅ ์ ํธ์ ๋น์ ํ ๊ด๊ณ์ ์๊ธฐ ๋๋ฌธ์ ๋ณด์ ์ด ํ์
$\gamma$๊ฐ์ ๋ฐ๋ผ ์ด๋ฏธ์ง์ ๋ฐ๊ธฐ๊ฐ ๋น์ ํ์ ์ผ๋ก ๋ฐ๋
$\gamma<1$: ์ด๋ฏธ์ง๊ฐ ์ ์ฒด์ ์ผ๋ก ๋ฐ์์ง(์ด๋์ด ๋ถ๋ถ ๊ฐ์กฐ) $\gamma>1$: ์ด๋ฏธ์ง๊ฐ ์ ์ฒด์ ์ผ๋ก ์ด๋์์ง(๋ฐ์ ๋ถ๋ถ ๊ฐ์กฐ)
- ์ ๋ฅ(V)์ gamma(r)์ ์ ๊ณฑํ์ฌ ๋ช ๋๋ฅผ ์กฐ์ ํจ
- ๊ฐ๋ง๊ฐ์ ๋๋ฐฐ๋ก ํด๋ ๋ฐ๊ธฐ๊ฐ ๋น๋ก๋ก ๊ฐ์ง ์๋๋ค
Compositing and matting
- Matting: ์ฌ์ง์ foreground ๋ฌผ์ฒด๋ง ์ธ์ํด์ ์ถ์ถ(์: ํฌ๋ก๋งํค)
- Compositing: ๋ฝ์๋ธ ๋ฌผ์ฒด๋ฅผ background ์์ ๋์(์: ๋ฐฐ๊ฒฝ ํฉ์ฑ)
- ๊ฐ๊ฐ์ pixel์ RGB์ 4๋ฒ์งธ ์ฑ๋ A(alpha)๊ฐ(ํฌ๋ช
๋)์ ์ด์ฉํด์ ๋ํ๋ค
- $\alpha=1$: ์์ ๋ถํฌ๋ช
- $\alpha=0$: ์์ ํฌ๋ช
C: ์ต์ข ํฉ์ฑ์ด๋ฏธ์ง
B: Background
F: Foreground
$\alpha$: ๊ฐ ํฝ์ ์ ํฌ๋ช ๋
Histogram Equalization
what is histogram?
์ด๋ฏธ์ง์์ ๋ฐ๊ธฐ ๊ฐ์ ๋ถํฌ๋ฅผ ๋ํ๋ธ ๊ทธ๋ํ โ Count the total number of pixels for each brightness value in [0, L-1]
- Normalized histogram: ์ด๋ฏธ์ง์ ๋ฐ๊ธฐ ๋ถํฌ๋ฅผ ๋๊ฒ ํด์, ๋๋น๋ฅผ ๋์ด๋ ์ฐ์ฐ
$\hat{h}(l)$: Normalized histogram ๊ฐ $c(l_in)$: ๋์ ๋ถํฌ ํจ์ $T$: ๋ณํ ํจ์
- ์ฆ, ๋ฐ๊ธฐ ๊ฐ์ด $l_in$์ด์๋ ํฝ์ ์ $T(l_in)$์ด๋ผ๋ ์ ๋ฐ๊ธฐ ๊ฐ์ผ๋ก ๋ฐ๋
- Find a mapping function f(I) to make histogram flat
- Improve the visual appearance of image by increasing the dynamic range of colors
์ฌ์ง์ ๋ณด๋ฉด ๋์กฐ๊ฐ ์๋ณด์ด๊ฒ ๋ณ๊ฒฝ๋์ด ์ผ๋ฃฉ๋ง์ ๋ ์ข์์ก์ง๋ง ์ ์ฌ์ง์ ๋ ธ์ด์ฆ์ฒ๋ผ ๋ณด์ด๊ฒ ๋จ
๊ทธ๋ผ ์ด๋ป๊ฒ ํ๋๊ฐ?
$\hat{h}(l)=h(l)โ/M*N=h(l)/64โโ{0,0,0.203,0.281,0.297,0.156,0.063,0}$
$c(l)=\displaystyle\sum_{k=0}^l \hat{โh}(k)โ{0.0,0.0,0.203,0.484,0.781,0.937,1.0,1.0}$
$l_out$ ๊ณ์ฐ(์์์ ๋ฐ์ฌ๋ฆผ) -> (A) ๋ํ๋ฅผ ์ด๋ฏธ์ง์ ์ ์ฉ
ํ์คํ ๊ทธ๋จ์ด ๊ณจ๊ณ ๋ฃจ ๋ถํฌ(์๋ ๋ฐ๊ธฐ ๊ฐ์ด (2,6)์ฌ์ด ์๋๋ฐ (1,7)๋ก ๋์ด์ง)
ํ์ง๋ง ์ด๋ฏธ์ง์ ๋ฐ์ ์์ญ๊ณผ ์ด๋์ด ์์ญ์ด ๋์์ ์กด์ฌํ๋ฉด?? โ ํ์ชฝ์ ์ข์์ง์ง๋ง, ๋ค๋ฅธ ์ชฝ์ ๋ง๊ฐ์ง!
- ํด๊ฒฐ๋ฐฉ๋ฒ:
- ์ด๋ฏธ์ง๋ฅผ ์ฌ๋ฌ ๊ฐ์ ์์ MxM ๋ธ๋ก์ผ๋ก ๋๋ ์ ๊ฐ ๋ธ๋ก๋ง๋ค
Histogram Equalization
์ํ
- ์ด๋ฏธ์ง๋ฅผ ์ฌ๋ฌ ๊ฐ์ ์์ MxM ๋ธ๋ก์ผ๋ก ๋๋ ์ ๊ฐ ๋ธ๋ก๋ง๋ค
โ ์ด ๋ฐฉ์์ ํฝ์ ์ฃผ๋ณ์ ๊ณ ๋ คํ๊ธฐ ๋๋ฌธ์ ๋ ์ด์ Point Operator๊ฐ ์๋๋ค! (์ด๊ฑด ์ง์ญ ์ฐ์ฐ์ด๋๊น)