Perspective transformation is an important aspect of programming self-driving cars. Perspective transformation is more complicated than affine transformation. In perspective transformation, we use a 3 x 3 transformation matrix to transform images from the 3D world into 2D images.
An example of perspective transformation is shown in Fig 4.61. In the following screenshot, we can see the tilted chessboard, and once the perspective transform is applied, the board is transformed into a normal chessboard with a top-down view. This has numerous applications in the field of self-driving cars, as roads have many objects that require perspective transformation to be processed:
Now we will implement perspective transformation to a traffic signboard using the OpenCV library:
- We will first import the matplotlib (mpimg and pyplot), numpy, and openCV libraries:
In[1]: import cv2
In[2]: import numpy as...