Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Secure smart parking solution
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-122
Secure smart parking solution
Commits
6909b5e5
Commit
6909b5e5
authored
Jul 10, 2021
by
Perera P.A.M.M
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update main.py
parent
f7afcfbd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
ObjectTraking/main.py
ObjectTraking/main.py
+3
-3
No files found.
ObjectTraking/main.py
View file @
6909b5e5
...
@@ -13,7 +13,7 @@ while True:
...
@@ -13,7 +13,7 @@ while True:
ret
,
frame
=
cap
.
read
()
ret
,
frame
=
cap
.
read
()
height
,
width
,
_
=
frame
.
shape
height
,
width
,
_
=
frame
.
shape
# Extract Region of interest
# Extract Region of interest
.
roi
=
frame
[
340
:
720
,
500
:
800
]
roi
=
frame
[
340
:
720
,
500
:
800
]
# 1. Object Detection
# 1. Object Detection
...
@@ -22,7 +22,7 @@ while True:
...
@@ -22,7 +22,7 @@ while True:
contours
,
_
=
cv2
.
findContours
(
mask
,
cv2
.
RETR_TREE
,
cv2
.
CHAIN_APPROX_SIMPLE
)
contours
,
_
=
cv2
.
findContours
(
mask
,
cv2
.
RETR_TREE
,
cv2
.
CHAIN_APPROX_SIMPLE
)
detections
=
[]
detections
=
[]
for
cnt
in
contours
:
for
cnt
in
contours
:
# Calculate area and remove small elements
# Calculate area and remove small elements
.
area
=
cv2
.
contourArea
(
cnt
)
area
=
cv2
.
contourArea
(
cnt
)
if
area
>
100
:
if
area
>
100
:
#cv2.drawContours(roi, [cnt], -1, (0, 255, 0), 2)
#cv2.drawContours(roi, [cnt], -1, (0, 255, 0), 2)
...
@@ -31,7 +31,7 @@ while True:
...
@@ -31,7 +31,7 @@ while True:
detections
.
append
([
x
,
y
,
w
,
h
])
detections
.
append
([
x
,
y
,
w
,
h
])
# 2. Object Tracking
# 2. Object Tracking
.
boxes_ids
=
tracker
.
update
(
detections
)
boxes_ids
=
tracker
.
update
(
detections
)
for
box_id
in
boxes_ids
:
for
box_id
in
boxes_ids
:
x
,
y
,
w
,
h
,
id
=
box_id
x
,
y
,
w
,
h
,
id
=
box_id
...
...
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