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
  Best way to feed python script of a file absolut 6 1,319 Jan-11-2025, 07:03 AM
Last Post: Gribouillis
  help seeking for prediction of fixed effect model gotodockforevildragon 0 1,029 Jun-18-2024, 04:10 AM
Last Post: gotodockforevildragon
Bug Copying methods to effect the new owner instead of the old instance Daniel285 2 1,095 Jun-03-2024, 07:58 AM
Last Post: Gribouillis
  [SOLVED] [listbox] Feed it with dict passed to class? Winfried 3 1,384 May-13-2024, 05:57 AM
Last Post: Larz60+
Exclamation Multi-Threaded Camera Feed issue Khajababa69 0 1,575 May-05-2024, 09:44 PM
Last Post: Khajababa69
  Python logging RotatingFileHandler writes to random file after the first log rotation rawatg 0 1,559 Feb-15-2024, 11:15 AM
Last Post: rawatg
  Draw bounding boxes on live feed Jerome 0 1,333 Jan-20-2024, 10:50 PM
Last Post: Jerome
  Printing effect sizes for variables in an anova eyavuz21 2 1,806 Feb-01-2023, 02:12 PM
Last Post: eyavuz21
  Help with TypeWriter Effect in Python Rich Extra 0 1,988 May-23-2022, 09:44 PM
Last Post: Extra
  Array Rotation Solution hannah 3 2,383 Mar-31-2022, 09:28 AM
Last Post: paul18fr

Forum Jump:

User Panel Messages

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