Python 3 OpenCV Library Script to Flip or Rotate Live Webcamera Video at ClockWise or AnticlockWise Direction at any Angle Full Project For Beginners

Python 3 OpenCV Library Script to Flip or Rotate Live Webcamera Video at ClockWise or AnticlockWise Direction at any Angle Full Project For Beginners

 

Welcome folks today in this post we will be flipping  or rotating live video from webcam at any angle in any direction in python using opencv library. All the full source code of the application is given below.

 

 

 

Get Started

 

 

 

In order to get started you need to install the following library using the pip command as shown below

 

pip install opencv-python

 

After installing this library make an app.py file and copy paste the following code

See also  Python 3 pdfrw Library Tutorial to Rotate Pages of PDF Document Full Project For Beginners

 

app.py

 

 

import numpy as np
import cv2
# capture video
cap = cv2.VideoCapture(0)
#descripe a loop
#read video frame by frame
while True:
    ret,img = cap.read()
    cv2.imshow('Original Video',img)
    #flip for truning(fliping) frames of video
    img2=cv2.flip(img,-1)
    cv2.imshow('Flipped video',img2)
    k=cv2.waitKey(30) & 0xff
#once you inter Esc capturing will stop
    if k==27:
        break
        cap.release()
        cv2.destroyAllWindows()

 

 

Now if you execute this python script app.py by typing the below command as shown below

 

python app.py

 

 

 

 

Leave a Reply