Image Transformation
We can complete image transformations using matrix operations.
Arithmetic Operations
These are pixel by pixel operations:
- Addition/Subtraction
- Multiplication/Division
- Logical Operations
We should scale the final output so that we don’t overflow/underflow. In MatLab we can use imadd
, imsubtract
etc.
Affine Transformations
These are combinations of:
-
Translation
\[\begin{bmatrix}x'\\y'\end{bmatrix}=\begin{bmatrix}x\\y\end{bmatrix}+\begin{bmatrix}x_i\\y_i\end{bmatrix}\] -
Scaling
\[\begin{bmatrix}x'\\y'\end{bmatrix} = \begin{bmatrix}S_x& 0\\0 &S_y\end{bmatrix}\cdot\begin{bmatrix}x\\y\end{bmatrix}\] -
Roation
\[\begin{bmatrix}x'\\y'\end{bmatrix} = \begin{bmatrix}\cos\theta&-\sin\theta\\\sin\theta&\cos\theta\end{bmatrix}\cdot\begin{bmatrix}x\\y\end{bmatrix}\]
Combined Transforms
We can put all transforms in the same format so we can combine them, to be used in one operation:
-
Translation
\[\begin{bmatrix}x'\\y'\\1\end{bmatrix}=\begin{bmatrix}1&0&x_i\\0&1&y_i\\0&0&1\end{bmatrix}+\begin{bmatrix}x_i\\y_i\\1\end{bmatrix}\] -
Scaling
\[\begin{bmatrix}x'\\y'\\1\end{bmatrix} =\begin{bmatrix}S_x& 0&0 \\0&S_y&0\\0&0&1\end{bmatrix}\cdot\begin{bmatrix}x\\y\\1\end{bmatrix}\] -
Roation
\[\begin{bmatrix}x'\\y'\\1\end{bmatrix} = \begin{bmatrix}\cos\theta&-\sin\theta&0\\\sin\theta&\cos\theta&0\\0&0&1\end{bmatrix}\cdot\begin{bmatrix}x\\y\\1\end{bmatrix}\]
3D Transformations
Refer to slide 20 for 3D transformation matrices for:
- Translation
- Scaling
- Roll
- Pitch
- Yaw
3D transformations use 4 by 4 matrices.