Skip to content
Snippets Groups Projects
Commit c2bf1a40 authored by Ouhouuhu's avatar Ouhouuhu
Browse files

rotate image

parent 11ca2d9a
No related branches found
No related tags found
No related merge requests found
......@@ -20,9 +20,9 @@ image_path = "./Calibration_cam/2m.jpg"
video_path = "./IMAGES/test.mp4"
yolo = Load_Yolo_model()
_, boxes = detect_image(yolo, image_path, "./Calibration_cam/0.5_detect.jpg", input_size=YOLO_INPUT_SIZE, show=True, CLASSES=TRAIN_CLASSES, rectangle_colors=(255,0,0))
#_, boxes = detect_image(yolo, image_path, "./Calibration_cam/0.5_detect.jpg", input_size=YOLO_INPUT_SIZE, show=True, CLASSES=TRAIN_CLASSES, rectangle_colors=(255,0,0))
#detect_video(yolo, video_path, './IMAGES/detected.mp4', input_size=YOLO_INPUT_SIZE, show=False, CLASSES=TRAIN_CLASSES, rectangle_colors=(255,0,0))
#detect_realtime(yolo, '', input_size=YOLO_INPUT_SIZE, show=True, CLASSES=TRAIN_CLASSES, rectangle_colors=(255, 0, 0))
detect_realtime(yolo, '', input_size=YOLO_INPUT_SIZE, show=True, CLASSES=TRAIN_CLASSES, rectangle_colors=(255, 0, 0))
#detect_video_realtime_mp(video_path, "Output.mp4", input_size=YOLO_INPUT_SIZE, show=True, CLASSES=TRAIN_CLASSES, rectangle_colors=(255,0,0), realtime=False)
......
......@@ -210,7 +210,7 @@ def draw_bbox(image, bboxes,liste_pos_car=liste_pos((0,0,0),1), CLASSES=YOLO_COC
"""x_car, y_car"""
x_car, y_car = pos_car[0], pos_car[1]
print(f"x: {x_car}, y: {y_car}")
x_car, y_car = (x_car-1.23855)/2.4+1, (y_car-0.889)/2.4+0.5
x_car, y_car = (x_car-278/225)/2.4+1, (y_car-200/225)/2.4+0.5
print(f"recalé x: {x_car}, y: {y_car}")
"""loading trajectory"""#TODO: load it only once
......@@ -219,7 +219,7 @@ def draw_bbox(image, bboxes,liste_pos_car=liste_pos((0,0,0),1), CLASSES=YOLO_COC
plt.plot(x_car, y_car,'+')
for x,y in zip(cone_x, cone_y):
x, y= (x-1.23855)/2.4+1, (y-0.889)/2.4+0.5
x, y= (x--278/225)/2.4+1, (y-200/225)/2.4+0.5
plt.plot(x,y,'*')
plt.plot([i for i,j in track_points], [j for i,j in track_points])
plt.show()
......@@ -589,7 +589,7 @@ def detect_realtime(Yolo, output_path, input_size=416, show=False, CLASSES=YOLO_
codec = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter(output_path, codec, fps, (width, height)) # output_path must be .mp4
liste_pos_car = liste_pos((1, 0.5,3.1415/2), 50)
liste_pos_car = liste_pos((278/225, 200/225,3.1415/2), 50)
ser = get_ser()
start_ser(ser)
......@@ -598,6 +598,7 @@ def detect_realtime(Yolo, output_path, input_size=416, show=False, CLASSES=YOLO_
while True:
ret, frame = vid.read()
frame = np.rot90(frame, k=3, axes=(0, 1))
try:
original_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment