Commit a894545c authored by Maduranga Jayakody's avatar Maduranga Jayakody

Electric Fan detection

parent 753d71c6
......@@ -266,6 +266,20 @@ for fno in range(0, total_frames):
else:
no_intersection = True
if label == "Fan" and float(confidence) >= CONFIDENCE_FAN:
left, top, right, bottom = bbox2points(bbox)
left, top, right, bottom = int(left * width_ratio2), int(top * height_ratio2), int(
right * width_ratio2), int(bottom * height_ratio2)
cv2.rectangle(frame, (left, top), (right, bottom), class_colors2[str(label)], 2)
cv2.putText(frame, "{} [{:.2f}]".format(label, float(confidence)),
(left, top - 5), cv2.FONT_HERSHEY_SIMPLEX, 0.5,
class_colors2[str(label)], 2)
# Person - A (Left1,Bottom1) (x1,y1) # B (Right1,Top1) (x2,y2)
# Fan - C (Left,Bottom) (x3,y3) # D (Right,Top) (x4,y4)
if (intersection([left, top, right, bottom], [left1, top1, right1, bottom1])):
warning_message += "Child is too close to the Fan\n"
else:
no_intersection = True
#import libries
#Define new libries for Darkent
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment