Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-115
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-115
2021-115
Commits
35a31f0d
Commit
35a31f0d
authored
Jul 01, 2021
by
Pramodya Hettiarachchi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'it18006308_pramodya' into 'master'
in proximity kettle part done See merge request
!19
parents
6839e1bf
94ac09c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
1 deletion
+56
-1
Hazardous_object_detection/Hot_objects/hotObject-detection.py
...rdous_object_detection/Hot_objects/hotObject-detection.py
+56
-1
No files found.
Hazardous_object_detection/Hot_objects/hotObject-detection.py
View file @
35a31f0d
...
...
@@ -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,58 @@ 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
if
x1
>=
k_x1
&
x1
<=
k_x2
:
print
(
"Kettle - X1 is inside the Persons Danger region!"
)
overlap
=
True
if
x2
>=
k_x1
&
x2
<=
k_x2
:
print
(
"Kettle - X2 is inside the Persons Danger region!"
)
overlap
=
True
if
y1
>=
k_y2
&
y1
<=
k_y1
:
print
(
"Kettle - Y1 is inside the Persons Danger region!"
)
overlap
=
True
if
y2
>=
k_y2
&
y2
<=
k_y2
:
print
(
"Kettle - Y2 is inside the Persons Danger region!"
)
overlap
=
True
# If kettle and child bounding bor overlap, Calculate Distance between center point of two boxes
if
(
overlap
==
True
):
kettle_midpoint
=
((
k_x1
+
k_x2
)
/
2
,
(
k_y1
+
k_y2
)
/
2
)
distance
=
((((
kettle_midpoint
[
0
]
-
person_midpoint
[
0
])
**
2
)
+
((
kettle_midpoint
[
1
]
-
person_midpoint
[
1
])
**
2
)
)
**
0.5
)
else
:
print
(
"No Kettles Found"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment