delete main.py, video.py

This commit is contained in:
jimmy 2022-07-18 17:35:11 +12:00
parent 1505801985
commit 7ccb745daf
2 changed files with 0 additions and 56 deletions

View File

View File

@ -1,56 +0,0 @@
from random import randint
import cv2
import numpy as np
import os
class Video:
def __init__(self, x, y):
self.x = x
self.y = y
def setVideo(self, path):
self.path = path
def start(self):
self.run = True
self.cap = cv2.VideoCapture(self.path)
# Check if camera opened successfully
if (self.cap.isOpened()== False):
print("Error opening video file")
totalframecount= int(self.cap.get(cv2.CAP_PROP_FRAME_COUNT))
print("The total number of frames in this video is ", totalframecount)
self.cap.set(cv2.CAP_PROP_POS_FRAMES, randint(0, totalframecount* 0.9))
# Read until video is completed
while(self.cap.isOpened() and self.run):
# Capture frame-by-frame
ret, frame = self.cap.read()
if ret == True:
# Display the resulting frame
cv2.namedWindow("window", cv2.WND_PROP_FULLSCREEN)
cv2.moveWindow("window", self.x, self.y)
cv2.setWindowProperty("window",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
cv2.imshow("window", frame)
# Press Q on keyboard to exit
if cv2.waitKey(25) & 0xFF == ord('q'):
break
# Break the loop
else:
break
def stop(self):
self.run = False
self.cap.release()
# Closes all the frames
cv2.destroyAllWindows()