|
@@ -6,19 +6,32 @@ class Vopen():
|
|
def __init__(self):
|
|
def __init__(self):
|
|
cap = cv2.VideoCapture('/home/user/Downloads/video.mp4')
|
|
cap = cv2.VideoCapture('/home/user/Downloads/video.mp4')
|
|
|
|
|
|
|
|
+ cap = cv2.VideoCapture('/home/user/Downloads/bbb_sunflower_480x320.mp4')
|
|
self.cap = cap
|
|
self.cap = cap
|
|
def init(self):
|
|
def init(self):
|
|
success, img = self.cap.read()
|
|
success, img = self.cap.read()
|
|
|
|
+ try:
|
|
|
|
+ img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
|
|
|
+ except:pass
|
|
self.shape = img.shape[1::-1]
|
|
self.shape = img.shape[1::-1]
|
|
|
|
+
|
|
return success,self.shape
|
|
return success,self.shape
|
|
def read(self):
|
|
def read(self):
|
|
success, img = self.cap.read()
|
|
success, img = self.cap.read()
|
|
|
|
+ try:
|
|
|
|
+ img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
|
|
|
+ except:
|
|
|
|
+ pass
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
return success,img
|
|
return success,img
|
|
|
|
|
|
v = Vopen()
|
|
v = Vopen()
|
|
success,shape = v.init()
|
|
success,shape = v.init()
|
|
|
|
|
|
-wn = pygame.display.set_mode(shape)
|
|
+wn = pygame.display.set_mode(shape,pygame.RESIZABLE)
|
|
|
|
+
|
|
window = wn
|
|
window = wn
|
|
clock = pygame.time.Clock()
|
|
clock = pygame.time.Clock()
|
|
|
|
|
|
@@ -40,8 +53,9 @@ while success:
|
|
if event.type == pygame.QUIT:
|
|
if event.type == pygame.QUIT:
|
|
success = False
|
|
success = False
|
|
try:
|
|
try:
|
|
- wn.blit(pygame.image.frombuffer(img.tobytes(), shape, "RGB"), (0, 0))
|
|
+ im = pygame.image.frombuffer(img.tobytes(), shape, "RGB")
|
|
-
|
|
+
|
|
|
|
+ wn.blit(im, (0, 0))
|
|
except AttributeError as e:
|
|
except AttributeError as e:
|
|
print("except",e)
|
|
print("except",e)
|
|
time.sleep(1)
|
|
time.sleep(1)
|