|
|
|
@ -6,9 +6,20 @@ AREAS = [
|
|
|
|
|
("id", 1), |
|
|
|
|
("area", ((0, 40), (12, 129))), |
|
|
|
|
("target", ["car", "bus", "motorbike"]), |
|
|
|
|
("next", [6]), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
("id", 2), |
|
|
|
|
("area", ((85, 0), (222, 74))), |
|
|
|
|
("target", ["person", "bicycle"]), |
|
|
|
|
("next", [7]), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
("id", 3), |
|
|
|
|
("area", ((38, 340), (99, 482))), |
|
|
|
|
("target", ["person", "wheelchair"]), |
|
|
|
|
("next", [5]), |
|
|
|
|
], |
|
|
|
|
[("id", 2), ("area", ((85, 0), (222, 74))), ("target", ["person", "bicycle"])], |
|
|
|
|
[("id", 3), ("area", ((38, 340), (99, 482))), ("target", ["person", "wheelchair"])], |
|
|
|
|
[ |
|
|
|
|
("id", 4), |
|
|
|
|
("area", ((106, 310), (164, 461))), |
|
|
|
@ -18,35 +29,57 @@ AREAS = [
|
|
|
|
|
("id", 5), |
|
|
|
|
("area", ((286, 230), (441, 346))), |
|
|
|
|
("target", ["person", "wheelchair"]), |
|
|
|
|
("next", [8]), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
("id", 6), |
|
|
|
|
("area", ((421, 190), (555, 304))), |
|
|
|
|
("target", ["car", "bus", "motorbike"]), |
|
|
|
|
("next", []), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
("id", 7), |
|
|
|
|
("area", ((555, 170), (720, 295))), |
|
|
|
|
("target", ["person", "wheelchair", "bicycle"]), |
|
|
|
|
("next", [4]), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
("id", 8), |
|
|
|
|
("area", ((877, 224), (947, 334))), |
|
|
|
|
("target", ["person", "wheelchair"]), |
|
|
|
|
("next", [7, 9, 5]), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
("id", 9), |
|
|
|
|
("area", ((1047, 229), (112, 338))), |
|
|
|
|
("target", ["person", "wheelchair"]), |
|
|
|
|
("next", [8]), |
|
|
|
|
], |
|
|
|
|
[ |
|
|
|
|
("id", 10), |
|
|
|
|
("area", ((1158, 200), (1230, 307))), |
|
|
|
|
("target", ["person", "wheelchair"]), |
|
|
|
|
("next", [9]), |
|
|
|
|
], |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_heading(x1, y1, x2, y2): |
|
|
|
|
diff_x, diff_y = x2 - x1, y2 - y1 |
|
|
|
|
if diff_x > 0 and diff_y > 0: |
|
|
|
|
return "NE" |
|
|
|
|
if diff_x > 0 and diff_y == 0: |
|
|
|
|
return "N" |
|
|
|
|
if diff_x > 0: |
|
|
|
|
return "NW" |
|
|
|
|
|
|
|
|
|
if diff_y > 0: |
|
|
|
|
return "SE" |
|
|
|
|
if diff_y == 0: |
|
|
|
|
return "S" |
|
|
|
|
return "SW" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def box_distance(pos1, pos2): |
|
|
|
|
x1, y1, w1, h1 = pos1 |
|
|
|
|
x2, y2, w2, h2 = pos2 |
|
|
|
@ -75,7 +108,8 @@ def check_if_inside_the_boxes(x, y, w, h, _type):
|
|
|
|
|
# if diff_x < box_w |
|
|
|
|
if is_inside: |
|
|
|
|
print("INSIDE!! this -> ", box) |
|
|
|
|
return is_inside |
|
|
|
|
return box |
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def is_it_the_same_obj(x1, y1, w1, h1, i1, j1, w2, h2, **kwargs): |
|
|
|
|