Skip to content

Commit bb5df0f

Browse files
Update detect.py
1 parent f2ea019 commit bb5df0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

detect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# Distance (object_width / detected_pixel_width * focal_length)
3434
frame_width = 0.106 # meters (measured relay pixel correspondence / literal width of frame)
3535
frame_height = 0.151 # meters (measured relay pixel correspondence / literal height of frame)
36-
focal_length = 0.5 # meters (calibrated camera specific value)
36+
focal_length = 0.5 # 0.125 # meters (calibrated camera specific value)
3737

3838
# Object dimensions (for distance measurement)
3939
cube_diagonal_width = 0.34 # meters (object diagonal width, measured for cube)
@@ -116,9 +116,9 @@ def get_distance(id, b):
116116
dpw = math.hypot(b.xmax - b.xmin, b.ymax - b.ymin) * frame_width
117117
x_dist = y_dist = 0
118118
if id == 0: # cone (labels.txt)
119-
x_dist = cone_diagonal_width * focal_length / dpw / 4
119+
x_dist = cone_diagonal_width * focal_length / dpw
120120
else: # cube (labels.txt)
121-
x_dist = cube_diagonal_width * focal_length / dpw / 4
121+
x_dist = cube_diagonal_width * focal_length / dpw
122122
y_dist = x_dist * math.tan(get_angles(b)[0] * math.pi / 180)
123123
return Point(x_dist, y_dist) # meters
124124

0 commit comments

Comments
 (0)