Initial commit

This commit is contained in:
2026-03-31 13:28:59 +02:00
commit 7ec43ca17d
314 changed files with 189852 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import cv2
import numpy as np
import random
import os
import common
video="videos/France_Motorway.mp4"
if not os.path.isdir(common.dir_images_sans_panneaux):
os.mkdir(common.dir_images_sans_panneaux)
if not os.path.exists(video):
print("Vidéo non présente:", video)
quit()
cap=cv2.VideoCapture(video)
id=0
nbr_image=100000
nbr_image_par_frame=int(100000/cap.get(cv2.CAP_PROP_FRAME_COUNT))+1
while True:
ret, frame=cap.read()
if ret is False:
quit()
h, w, c=frame.shape
for cpt in range(nbr_image_par_frame):
x=random.randint(0, w-common.size)
y=random.randint(0, h-common.size)
img=frame[y:y+common.size, x:x+common.size]
cv2.imwrite(common.dir_images_sans_panneaux+"/{:d}.png".format(id), img)
id+=1
if id==nbr_image:
quit()