jezv 11 мес. назад
Родитель
Сommit
ef628d107f
2 измененных файлов с 31 добавлено и 0 удалено
  1. 3 0
      pictures/.gitignore
  2. 28 0
      pictures/main.py

+ 3 - 0
pictures/.gitignore

@@ -0,0 +1,3 @@
+picts
+*.avi
+*.mp4

+ 28 - 0
pictures/main.py

@@ -0,0 +1,28 @@
+import cv2
+import numpy as np
+
+video = cv2.VideoCapture(r'pictures/pictures.mp4')
+
+counter = 0
+if video.isOpened():
+    while True:
+        ret, frame = video.read()
+        if not ret:
+            print("Video doesn't open")
+            break
+
+        x, y = np.where(np.all(frame==np.array([0,0,0]), axis=2))
+        if len(x) + len(y) > 100000 and len(x) + len(y) < 110000:
+            counter+=1
+            print('mine')
+        
+        # cv2.namedWindow('videoFrame', cv2.WINDOW_NORMAL)
+        # cv2.imshow('videoFrame', frame)
+        # key = cv2.waitKey(0)
+        # while key != ord('q'):
+        #     cv2.destroyAllWindows()
+    
+video.release()
+cv2.destroyAllWindows()
+# 86
+print(counter)