Duplicate

Lecture 15 | Image Alignment

수강 일자
2022/10/25
두 이미지간의 매칭되는 점들을 찾아서 두 이미지 간의 변환에 필요한 parameter 를 찾는 과정
큰 두 개의 접근방법
Pixel-based Alignment: 특정 이미지의 한 픽셀과 다른 이미지의 어떤 픽셀이 대응되는지 찾는 방법 → 두 이미지가 거의 비슷할 때 활용
Feature-based Alignment: interest points 를 뽑고, 그 주변에 feature descriptor 를 정한 뒤, 그 descriptor 사이의 유사성으로 correspondence point 를 찾을 수 있음. → 더 일반적인 방법!

Motivation

Recognition
실제 사진에서는 template 와 다른 viewpoint 에서 찍히거나, occlusion 이 발생할 수 밖에 없는데 이러한 상황에서도 안정적으로 recognition 을 할 수 있는 알고리즘이 필요함.
Medical Image Registration
모든 사람의 뇌 영상을 찍으면 각기 다르다는 것을 알 수 있음. 어떤 뇌의 특정 부위에 문제가 생겼다고 할 때 그 부위를 알 필요가 있어 reference 가 있는 뇌 영상과 align 할 필요가 있음.
Mosaics
여러 장의 사진을 찍고, 각 사진이 overlap 되는 부분이 있을 때 한 이미지와 다른 이미지가 어떻게 mosaicing 이 되는지 찾을 필요가 있음.

Main Questions

Alignment: 두 장의 이미지 사이의 transformation 은 무엇인가?
Warping: 한 장의 이미지와 Transformation 이 주어졌을 때 output image 는 어떻게 되는가?
Translation: 픽셀을 동일한 위치 변화로 이동
Rotation: 원본 이미지를 원점을 기준으로 특정 각도로 돌림.
Aspect: Aspect Ratio (가로세로비) 를 변경함.

Parametric (Global) Warping

Parametric: Tranformation T 가 parameter 로 정의됨. → Coordinate-Changing Machine
p=T(p)p'=T(p)
Global: 모든 점들에 대해서 똑같은 Transformation 을 적용함.
Transformation T 를 많은 경우 matrix M 으로 나타내서 표현할 수도 있음.
p=Mp[xy]=M[xy]p'=Mp \rarr \begin{bmatrix} x' \\ y' \end{bmatrix} = M \begin{bmatrix} x \\ y \end{bmatrix}

Scaling

각각의 coordinate 에 scalar 를 곱해 새로운 이미지를 얻어냄.
Uniform Scaling 은 각 coordinate 의 components (ex. xx, yy 축) 에 동일한 scalar 를 사용한 scaling
Nonuniform Scaling 은 components 별로 다른 scalar 를 사용한 scaling
xx 방향으로 aa 만큼 scaling, yy 방향으로 bb 만큼 scaling 하면 다음과 같음.
[xy]=[a00b][xy]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} a & 0 \\ 0 & b \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}

Transformations with a 2×22 \times 2 Matrix

2D Scaling
[xy]=[Sx00Sy][xy]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} S_x & 0 \\ 0 & S_y \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}
2D Rotate around (0,0)(0,0)
[xy]=[cosθsinθsinθcosθ][xy]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}
2D Shear
평행사변형처럼 변형
[xy]=[1hxhy1][xy]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} 1 & h_x \\ h_y & 1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}
2D Mirror about Y axis
[xy]=[1001][xy]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} -1 & 0 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}
2D Mirror over (0,0)(0,0)
[xy]=[1001][xy]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} -1 & 0 \\ 0 & -1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}
2D Translation 은 2D Matrix 의 곱으로 표현하는 것이 불가능함!
Scaling, Rotation, Shear, Mirror 의 조합은 2D Linear Transformations 라고 부름.

Homogenous Coordinates

2D Translation 을 나타나기 위해 Homogeneous Coordinate 를 사용할 수 있음.
Translation=[10tx01ty001]{\rm Translation}= \begin{bmatrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{bmatrix}
Basic 2D Transformations 도 Homogenous Coordinate 에서 사용할 수 있음.
Scale:[xy1]=[Sx000Sy0001][xy1]Rotate:[xy1]=[cosθsinθ0sinθcosθ0001][xy1]Shear:[xy1]=[1hx0hy10001][xy1]\begin{align*} &{\rm Scale:}\begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} = \begin{bmatrix} S_x & 0 & 0 \\ 0 & S_y & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \\ &{\rm Rotate:}\begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} = \begin{bmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \\ &{\rm Shear:}\begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} = \begin{bmatrix} 1 & h_x & 0 \\ h_y & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \\ \end{align*}

Affine Transformations

2D Linear Transformations (Scale, Rotation, Shear, Mirror) 와 Translation 이 조합된 변환
각 transformation 마다 3×33\times 3 matrix 가 곱해지는데, 그럴 때마다 마지막 row 는 [0,0,1][0, 0, 1] 로 고정임.
구해야 하는 parameter 의 수는 6 개!
Transformation 전에 parallel 이었던 선들은 Transformation 후에도 parallel 임.

Projective Transformation (or Homography)

Affine Transformations 와 Projective Warps (ex. Perspective Transformation) 가 조합된 변환
이 경우에는 Affine Transformations 와 달리 DOF 이 8 임!
Transformation 전에 parallel 이었던 선들이 Transformation 후에 parallel 하게 유지되지 않음.

Motion Models

Translation: 2 Unknowns
Affine: 6 Unknowns
Perspective: 8 Unknowns
3D Rotation: 3 Unkowns → xx, yy, zz 축으로 rotation 할 수 있으므로 3 Unkown
Similarity Transformation: Translation + Rotation + Scale

Why Mosaic?

일반적인 디지털 카메라는 Field of View 가 50°×35°50\degree \times 35\degree 로 알려져 있음.
사람의 Field of View 는 200°×135°200\degree \times 135\degree 로 알려져 있음.
Panoramic Mosaic 는 360°×180°360\degree \times 180\degree로 알려져있고 연구도 많이 진행되고 있음.
Field of View 에 제한이 없는 사진을 얻고 싶으면 Mosaic 라는 방법론을 알아야 함.

Basic Procedure of Mosaic

1.
같은 위치에서 여러 장의 sequence 이미지들을 찍음. (e.g. rotate the camera about its optical center)
2.
촬영한 이미지들간의 Transformation 을 찾음.
a.
SIFT 같은 방법론으로 Interesting Points 및 Matching 되는 점들 (Correspondence) 를 찾고 Transformation Matrix 를 최종적으로 구해냄.
→ Matching 되는 점들을 찾기 위한 RANSAC 알고리즘을 다음시간에 배울 것임. (Matching 이 안되는 부분을 피해가면서 Matching 을 잘 찾는 방법)
→ Correspondence 를 찾고 나서 Transformation 을 구하는 방법인 Image Reprojection - Homography 또한 다음시간에 배울 것임.
3.
Transformation 을 구해냈기 때문에 해당 Transformation 에 따라서 한 이미지를 다른 이미지와 겹쳐지도록 변환할 수 있음.
4.
Blending 테크닉을 거쳐서 최종적으로 Mosaic 를 구해냄. (e.g. Laplacian Filter)
Image Warping 관련 이슈도 다음 시간에 배움.
5.
1 ~ 4 를 모든 이미지에 대해서 반복하여 최종적으로 합쳐진 Mosiac 이미지를 얻어냄.

Image Reprojection

여러 각도에서 본 이미지를 하나의 common plane (Mosaic Projection Plane) 으로 reprojection 하여 Mosaic 를 생성함.
Mosaic 는 Synthetic 한 Wide-Angle Camera 로 취급할 수 있음.
한 사진에서만 보이는 영역과 다른 사진에서만 보이는 영역이 겹쳐지는 영역을 매개로 하여 이어붙여짐.
Mosaic 를 만들 때는 3D Reprojection 을 생각하는 것이 아니라, 이미지간의 Image Warp 만을 생각함.
두 이미지간의 correspondence 를 찾고 correspondence 간의 homography 를 찾는 것이 중요함.

Homography

각각의 대응되는 N 개의 point set 을 찾았다고 가정함.
N 개의 point set 으로부터 8 개의 DOF 로 구성된 Homography 를 구성할 수 있음.
Solving for Homographies
[wxwyw]=[abcdefgh1][xy1]\begin{bmatrix} wx' \\ wy' \\ w \end{bmatrix} = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix}
마지막 element 를 1 로 두고 8 개의 parameter 를 찾는 문제로 바뀜.
Ah=bAh=b 라는 matrix form 으로 변경해서 hh 를 구할 수 있음.
h=[a b c d e f g h]Th = [a\ b\ c\ d\ e\ f\ g\ h]^T
적어도 8 개의 equation 이 필요하지만 overconstraint 를 달성한 후 least-square 문제를 푸는 것이 일반적임. (Matlab 의 lmdivide 로 한 번에 풀 수 있음!)
minAhb2\min \|Ah-b \|^2