Geometrical Transformations Flashcards
How do you scale an image?
Take each point[X,Y]
and multiply it by
[sx,0]
[0,sy]
to give you the point
[sx(X), sy(Y)].
How do you translate an image?
For each point [X,Y]
and translation [Tx,Ty]
[X,Y]+[Tx,Ty] =
[X+Tx,Y+Ty]
How would we perform both a scaling and transformation at the same time?
Use an augmented matrix,
append a 1 to the point vector:
[X,Y,1]
and to the scaling matrix add a column with the translation vector:
[Sx, 0 , Tx]
[0, Sy, Ty]
Multiply the two to get:
[Sx(X) + Tx]
[Sy(Y) + Ty]
However, we now are unable to multiply multiple transformation matrices, to fix this we add an extra row to our transformation matrix.
[Sx, 0 , Tx]
[0, Sy, Ty]
[0, 0, 1]
This gives us a homogeneous co-ordinate at the end, when we multiply the matrix with the point vector:
[Sx(X) + Tx]
(Sy(Y)+Ty]
[1]
How would you reflect/flip an image?
Typically translate the image centre to the origin, and then scale along the relevant axis by -1. This can be encoded in a single transformation.
This is how we transform an image
[X,Y,1]
*
[a, b, c]
[d, e, f]
[g, h, i]
=
[X’,Y’,1]
What are the different components of the transformation matrix (a-i) responsible for?
a,e = scaling
b,d = shearing
a,b,d,e = rotation
c,f = translation
What are some distortions caused by the camera lens?
Barrel distortion
Pin Cushion distortion
What is the distortion matrix in OpenCV?
A single row matrix, used to store the distortion parameters for radial and tangential distortion.
What does Barrel Distortion do?
Barrel distortion makes the lines bend outwards?
What does Pin Cushion distortion do?
Makes the lines bend inwards, like pulling the corners of the image.
What types of interpolation are there?
1D Interpolation:
- nearest neighbour
- Linear
- Cubic
2D Interpolation:
- nearest neighbour
- Bi-linear
- Bi-cubic
When rotating an image, some pixels in the source image may not be mapped to an integer index in the output image, how might we remedy this?
We can go through pixels in the output image and see which point would be mapped to it in the input image.
We can then perform some interpolation by looking at the neighbouring pixels to that point.