Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Wrap prespective openCv #301

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Image-Processing/Wrap_prespective/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Image Processing

Image Processing is most commonly termed as 'Digital Image Processing' and the domain in which it is frequently used is 'Computer Vision'.
Don't be confused - we are going to talk about both of these terms and how they connect.
Both Image Processing algorithms and Computer Vision (CV) algorithms take an image as input; however, in image processing,
the output is also an image, whereas in computer vision the output can be some features/information about the image.

## OpenCV

![](https://logodix.com/logo/1989939.png)

## Installation

### Windows

$ pip install opencv-python
### MacOS
$ brew install opencv3 --with-contrib --with-python3
### Linux
$ sudo apt-get install libopencv-dev python-opencv
15 changes: 15 additions & 0 deletions Image-Processing/Wrap_prespective/Wrap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import cv2
import numpy as np
img = cv2.imread('cards.jpg')
width, height = 250 , 350
pts1 = np.float32([[111 , 219 ],[ 287 ,188 ],[ 154 , 482 ],[ 352 ,440 ]])
pts2 = np.float32([[ 0, 0],[ width , 0 ],[ 0 , height ],[ width , height ]])
matrix = cv2.getPerspectiveTransform( pts1 , pts2 )
imgOutput = cv2.warpPerspective(img,matrix,( width , height ))

for x in range ( 0, 4 ):
cv2.circle(img,(pts1[x][0],pts1[x][1]) , 15 ,( 0 , 255 , 0 ),cv2.FILLED)

cv2.imshow("Original Image ", img)
cv2.imshow("Output Image ", imgOutput)
cv2.waitKey(0)