This commit is contained in:
√(noham)² 2023-07-21 11:00:02 +02:00
parent 5ae8a9d870
commit 4f241e4b60
23 changed files with 30 additions and 11 deletions

BIN
cams/10s.mp4 Normal file

Binary file not shown.

BIN
cams/2sec.mp4 Normal file

Binary file not shown.

BIN
cams/5s.mp4 Normal file

Binary file not shown.

BIN
cams/output.mp4 Normal file

Binary file not shown.

0
detec/open.py Normal file
View File

15
detec/test.py Normal file
View File

@ -0,0 +1,15 @@
import numpy as np
import cv2 as cv
cap = cv.VideoCapture('cams/10s.mp4')
while cap.isOpened():
ret, frame = cap.read()
# if frame is read correctly ret is True
if not ret:
print("Can't receive frame (stream end?). Exiting ...")
break
gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
cv.imshow('frame', gray)
if cv.waitKey(1) == ord('q'):
break
cap.release()
cv.destroyAllWindows()

View File

@ -3,6 +3,9 @@ import matplotlib.pyplot as plt
import time
from colour import Color
import imagesV1 as images
import imagesV2 as images2
fps = 4
# ===========
t0 = 0
@ -43,7 +46,7 @@ def rainbow_gradient(num_colors):
colors = rainbow_gradient(nbv)
def px(tt): # Avance au cours du temps
tt += 1
tt += 1/fps
return tt
def vitesseatt(vtold): # Vitesse qu'il peut réellement atteindre d'un point de vue dynamique
@ -59,7 +62,7 @@ def vitesseadop(vtold, xxpold): # Vitesse qu'il est possible d'adopter en c
return newvalue
def vitessereelle(t, vtold, xxpold): # Vitesse du véhicule
t+=t
# t+=t
if t==0:
vtold[-1] = 0.1
elif (t> 0) and (t<=10): # Accélération du leader
@ -70,7 +73,7 @@ def vitessereelle(t, vtold, xxpold): # Vitesse du véhicule
a = - (Vd - Vmin) / 10
vtleader = Vd + 2 * a * (t - 16)
vtold[-1] = vtleader
elif (t>= 20) and (t<=30): # Accélération du leader
elif (t> 20) and (t<=30): # Accélération du leader
a = (Vd - Vmin) / 10
vtleader = Vmin + a * (t-20)
vtold[-1] = vtleader
@ -116,11 +119,12 @@ while(t<tf):
plt.ylabel('vitesse en m.s-¹')
plt.title('Vitesse maximale désirée\nvitesse du leader : ' + str(Vd) + 'm.s-¹\ndistance entre deux voitures : ' + str(np.diff(xxpold)) + 'm\n\nTemps : ' + str(t))
plt.draw()
plt.savefig('gipps/result/' + str(t)+'.png', transparent=True)
plt.pause(0.1)
t += dt/4
plt.savefig('gipps/result/' + str(int(t * fps)) + '.png', transparent=True)
# plt.pause(0.1)
t += dt/fps
xxold = xx.copy()
xxpold = xxp.copy()
vtold = vt.copy()
images.merge()
# images.merge()
images2.merge(fps)

View File

@ -4,7 +4,7 @@ import time
from colour import Color
import imagesV2 as images
fps = 4
fps = 1
# ===========
t0 = 0
@ -120,8 +120,8 @@ while(t<tf):
plt.ylabel('vitesse en m.s-¹')
plt.title('Vitesse maximale désirée\nvitesse du leader : ' + str(Vd) + 'm.s-¹\ndistance entre deux voitures : ' + str(np.diff(xxpold)) + 'm\n\nTemps : ' + str(t))
plt.draw()
plt.savefig('gipps/result/' + str(int(t * fps))+'.png', transparent=True)
# plt.pause(0.1)
plt.savefig('gipps/result/' + str(int(t * fps)) +'.png', transparent=True)
plt.pause(0.1)
t += dt/fps
xxold = xx.copy()
xxpold = xxp.copy()

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

BIN
gipps/graph/gippsV1-4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
gipps/graph/gippsV2-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
gipps/graph/gippsV2-4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -34,7 +34,7 @@ def detrf(folder_path):
except OSError as e:
print(f"Error deleting folder: {e}")
def merge(fps):
def merge():
overlay_folder = "gipps/result"
output_path = "gipps/merged.png"
merge_images(overlay_folder, output_path)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 39 KiB