From 1e21d9e501898924ca801680547545b0ae61fbad Mon Sep 17 00:00:00 2001 From: ryuk156 Date: Thu, 1 Oct 2020 14:54:09 +0530 Subject: [PATCH] ADDED FILES --- Image-Processing/screen_capture/README.md | 20 +++++++++++++++++++ .../screen_capture/screen_capture.py | 15 ++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Image-Processing/screen_capture/README.md create mode 100644 Image-Processing/screen_capture/screen_capture.py diff --git a/Image-Processing/screen_capture/README.md b/Image-Processing/screen_capture/README.md new file mode 100644 index 00000000..ad7fa3c1 --- /dev/null +++ b/Image-Processing/screen_capture/README.md @@ -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 \ No newline at end of file diff --git a/Image-Processing/screen_capture/screen_capture.py b/Image-Processing/screen_capture/screen_capture.py new file mode 100644 index 00000000..c6d4fc5c --- /dev/null +++ b/Image-Processing/screen_capture/screen_capture.py @@ -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) \ No newline at end of file