Python Forum
Rotation Effect on live Webcam Feed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rotation Effect on live Webcam Feed
#1
Halo, i´m studient to highschool. Big Grin

I need to do a code that make rotation Effect on live Webcam Feed for and against the hands of the clock but just does only to for the hand of the clock, can u help me? this is the code that i have.

import cv2
import time


def main():
    windowName = "Live Video Feed"
    cv2.namedWindow(windowName)
    cap = cv2.VideoCapture(0)

    if cap.isOpened():
        ret, frame = cap.read()

    rows, columns, channels = frame.shape
    angle = 0
    scale = 0.5
#   scale = 1

    while True:

        ret, frame = cap.read()

        if angle == 180:
            angle = 0

        print(scale)

        R = cv2.getRotationMatrix2D((columns / 2, rows / 2), angle, scale)

        print(R)

        output = cv2.warpAffine(frame, R, (columns, rows))

        cv2.imshow(windowName, output)
        angle = angle - 1
        time.sleep(0.01)
        if cv2.waitKey(1) == 27:
            break


    cv2.destroyWindow(windowName)

    cv2.destroyAllWindows()

    cap.release()


if __name__ == "__main__":
    main()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python logging RotatingFileHandler writes to random file after the first log rotation rawatg 0 398 Feb-15-2024, 11:15 AM
Last Post: rawatg
  Draw bounding boxes on live feed Jerome 0 280 Jan-20-2024, 10:50 PM
Last Post: Jerome
  Printing effect sizes for variables in an anova eyavuz21 2 977 Feb-01-2023, 02:12 PM
Last Post: eyavuz21
  Help with TypeWriter Effect in Python Rich Extra 0 1,171 May-23-2022, 09:44 PM
Last Post: Extra
  Array Rotation Solution hannah 3 1,495 Mar-31-2022, 09:28 AM
Last Post: paul18fr
  How to parse a live feed in Python? Daring_T 2 4,094 Jan-20-2022, 04:17 AM
Last Post: Daring_T
  How to receive webcam capture on spout? buzzdarkyear 2 2,645 Jan-12-2022, 02:26 PM
Last Post: buzzdarkyear
  Feed List items with Integer euras 9 3,943 May-19-2021, 07:45 PM
Last Post: snippsat
  Calculate transformation and Rotation Sandra2312 1 1,803 Jan-31-2021, 12:53 PM
Last Post: jefsummers
  Level curves don't match after rotation schniefen 1 1,531 Dec-14-2020, 09:56 PM
Last Post: schniefen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020