This commit is contained in:
√(noham)²
2023-07-25 17:15:53 +02:00
parent 253ef6346a
commit fab48f9e08
6687 changed files with 5743 additions and 498 deletions

View File

Before

Width:  |  Height:  |  Size: 324 KiB

After

Width:  |  Height:  |  Size: 324 KiB

View File

Before

Width:  |  Height:  |  Size: 324 KiB

After

Width:  |  Height:  |  Size: 324 KiB

40
detec/deformation.py Normal file
View File

@@ -0,0 +1,40 @@
import cv2
import numpy as np
frame_width = 1280
frame_height = 720
size = (frame_width, frame_height)
result = cv2.VideoWriter('deformed.avi', cv2.VideoWriter_fourcc(*'XVID'), 30, size)
video_path = 'cams/new/cut2.mp4'
cap = cv2.VideoCapture(video_path)
source_points = np.float32([[129, 379], [658, 332], [251, 551], [916, 445]])
destination_points = np.float32([[200, 350], [800, 350], [200, 600], [800, 600]])
M = cv2.getPerspectiveTransform(source_points, destination_points)
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
transformed_frame = cv2.warpPerspective(frame, M, (frame.shape[1], frame.shape[0]))
# cv2.imshow('Vue de destination', cv2.resize(frame, (1280, 720)))
result.write(cv2.resize(transformed_frame, (1280, 720)))
cv2.imshow('Vue de destination', cv2.resize(transformed_frame, (1280, 720)))
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
result.release()
cv2.destroyAllWindows()
print("The video was successfully saved")

View File

@@ -4,7 +4,7 @@ import numpy as np
import cv2
import time
cap = cv2.VideoCapture('cams/10s.mp4')
cap = cv2.VideoCapture('cams/2/10s.mp4')
folder_path = "track/exp2/labels/"
name = '10s'
fps = 141
@@ -41,6 +41,11 @@ while(cap.isOpened()):
bottom_right_y = int(center_y + bbox_height / 2)
cv2.rectangle(frame, (top_left_x, top_left_y), (bottom_right_x, bottom_right_y), (255, 0, 0), 2)
# print('bottom_right_y: ', bottom_right_y)
# print('bottom_right_x: ', bottom_right_x)
# print('top_left_y: ', top_left_y)
# print('top_left_x: ', top_left_x)
label = f'Class: {int(class_id)}, Object ID: {int(object_id)}'
cv2.putText(frame, label, (top_left_x, top_left_y - 5), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 0, 0), 1)

View File

@@ -4,7 +4,7 @@ import numpy as np
import cv2
import time
cap = cv2.VideoCapture('cams/new/cut1.mp4')
cap = cv2.VideoCapture('cams/new/ByED80IKdIU_06.mp4')
folder_path = "cams/new/frames"
frame_nb = 0