# Warp Perspective

## We'll get a specific card which will be 10 in this case

![CARDS](https://2797135393-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M99TkJnCKaTvw9u9gQJ%2F-M9j2myMLdpC5wOiLb3U%2F-M9jAgcCS_HplFk8zz64%2Fcards.jpg?alt=media\&token=d6cffb00-a51b-426c-880e-39160aced4a3)

```
import cv2
import numpy as np

img = cv2.imread("Resources/cards.jpg")

width, height = 300, 450
pts1 = np.float32([[338,32], [502,139], [180, 266], [351, 377]])
pts2 = np.float32([[0,0], [width, 0], [0, height], [width, height]])
matrix = cv2.getPerspectiveTransform(pts1, pts2)
imgOutput = cv2.warpPerspective(img, matrix, (width, height))

cv2.imshow("Image",img)

cv2.imshow("OutputImage", imgOutput)
cv2.imwrite("Resources/card10.jpg", imgOutput)


cv2.waitKey(0)
```

![](https://2797135393-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M99TkJnCKaTvw9u9gQJ%2F-M9j2myMLdpC5wOiLb3U%2F-M9jAnEak4Ye0p-n7XHp%2Fcard10.jpg?alt=media\&token=23bc759f-330a-442f-ad11-c06e87ec1378)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://capellac.gitbook.io/opencv/week1/opencv-basics/warp-prespective.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
