In Perspective Transformation, , we can change the perspective of a given image or video for getting better insights about the required information. In Perspective Transformation, we need provide the points on the image from which want to gather information by changing the perspective. We also need to provide the points inside which we want to display our image. Then, we get the perspective transform from the two given set of points and wrap it with the original image.
We use cv2.getPerspectiveTransform and then cv2.warpPerspective .
cv2.getPerspectiveTransform method -
Syntax: cv2.getPerspectiveTransform(src, dst)
->src: Coordinates of quadrangle vertices in the source image.
->dst: Coordinates of the corresponding quadrangle vertices in the destination image.
cv2.wrapPerspective method -
Syntax: cv2.warpPerspective(src, dst, dsize)
->src: Source Image
->dst: output image that has the size dsize and the same type as src.
->dsize: size of output image
Below is the Python code explaining Perspective Transformation –
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Negative transformation of an image using Python and OpenCV
- Log transformation of an image using Python and OpenCV
- Python OpenCV - Affine Transformation
- Wand perspective destortion method in Python
- CSS perspective-origin Property
- HTML | DOM Style perspective Property
- OpenCV - Facial Landmarks and Face Detection using dlib and OpenCV
- Transition from OpenCV 2 to OpenCV 3.x
- Python | Number Theoretic Transformation
- Python | Fast Fourier Transformation
- Python | Intensity Transformation Operations on Images
- Python | Inverse Fast Walsh Hadamard Transformation
- Python | Inverse Number Theoretic Transformation
- Python | Inverse Fast Fourier Transformation
- Box-Cox Transformation using Python
- NLP | Chunk Tree to Text and Chaining Chunk Transformation
- Kotlin | Collection Transformation
- Piece-wise Linear Transformation
- OpenCV Python Program to blur an image
- OpenCV Python program for Vehicle detection in a Video frame
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.