forked from harshilpatel312/KITTI-distance-estimation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualizer.py
26 lines (21 loc) · 823 Bytes
/
visualizer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'''
Purpose: visualize data from the dataframe
'''
import os
import cv2
import pandas as pd
df = pd.read_csv("distance-estimator/data/train.csv")
for idx, row in df.iterrows():
if os.path.exists(os.path.join("original_data/train_images/", row['filename'])):
fp = os.path.join("original_data/train_images/", row['filename'].replace('.txt', '.png'))
im = cv2.imread(fp)
x1 = int(row['xmin'])
y1 = int(row['ymin'])
x2 = int(row['xmax'])
y2 = int(row['ymax'])
cv2.line(im, (int(1224/2), 0), (int(1224/2), 370), (255,255,255), 2)
cv2.rectangle(im, (x1, y1), (x2, y2), (0, 255, 0), 3)
string = "({}, {})".format(row['angle'], row['zloc'])
cv2.putText(im, string, (int((x1+x2)/2), int((y1+y2)/2)), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2, cv2.LINE_AA)
cv2.imshow("detections", im)
cv2.waitKey(0)