Check weather child is in proximity to the kettle is added

parent 8617aa18
......@@ -7,6 +7,7 @@ import pickle
import time
import cv2
import sys
from shapely.geometry import box
THRESHOLD_ITEM = 0.5
THRESHOLD_PERSON = 0.5
......@@ -46,4 +47,34 @@ def forFrame(frame_number, output_array, outpun_count, returned_frame):
if len(persons) > 1:
print("Person in room")
# Test commit
if len(persons >= 1):
for person in persons:
# Create person with minX, minY maxX, maxY
person_box = box(person[0], person[3], person[1], person[2])
x1 = person[0]
x2 = person[1]
y1 = person[2]
y2 = person[3]
# x_center = (x1+x2)/2
person_midpoint = ((x1+x2)/2, (y1+y2)/2) # X and Y coordinates
if kettle_count > 0:
# Loop each kettle
for kettle in kettles:
kettle_box = box(kettle[0]+50, kettle[3]+50, kettle[1]+50, kettle[2]+50)
# Check weather child is in proximity to the kettle
k_x1 = kettle[0] + 50 # Left
k_x2 = kettle[1] + 50 # Right
k_y1 = kettle[2] + 50 # Top
k_y2 = kettle[3] + 50 # Bottom
overlap = False
if kettle_box.intersection(person_box) != None:
print("Kettle - Person is in the Kettles Danger Region")
overlap = True
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