Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
klorydryk
FacialRecoTrackingScore
Commits
5126f1f2
Commit
5126f1f2
authored
Sep 02, 2021
by
klorydryk
Browse files
Add Windows positions file read and applied at startup
parent
1afa3723
Changes
2
Hide whitespace changes
Inline
Side-by-side
trackmultiplefaces.py
View file @
5126f1f2
...
...
@@ -12,7 +12,7 @@ from colour import Color
from
threading
import
Thread
import
time
import
random
#
import
tkinter as tk
import
json
# To write and read windows positions
import
randomnames
...
...
@@ -77,7 +77,7 @@ def list_available_cameras():
class
facetracker
:
#We are not
doing
really face recognition
#We are not really
doing
face recognition
# def doRecognizePerson(self, faceNames, fid):
# time.sleep(2)
# faceNames[ fid ] = randomnames.rand_name_statistic(charset) #"Person " + str(fid)
...
...
@@ -575,6 +575,21 @@ if __name__ == '__main__':
facetrackerList
.
append
(
facetracker
(
camera_id
,
videoName
))
data
=
{}
try
:
with
open
(
'windows_pos.json'
)
as
f
:
data
=
json
.
load
(
f
)
except
EnvironmentError
:
# parent of IOError, OSError *and* WindowsError where available
print
(
'Windows position file not found: random position'
)
else
:
print
(
data
)
# To move windows to the previous positions
i
=
0
for
camera
in
facetrackerList
:
cv2
.
namedWindow
(
camera
.
videoName
,
cv2
.
WINDOW_NORMAL
)
cv2
.
resizeWindow
(
camera
.
videoName
,
int
(
data
[
"WindowsList"
][
i
][
"width"
]),
int
(
data
[
"WindowsList"
][
i
][
"height"
]))
cv2
.
moveWindow
(
camera
.
videoName
,
int
(
data
[
"WindowsList"
][
i
][
"X"
]),
int
(
data
[
"WindowsList"
][
i
][
"Y"
]))
i
+=
1
while
True
:
try
:
...
...
windows_pos.json
0 → 100644
View file @
5126f1f2
{
"WindowsList"
:
[
{
"X"
:
"0"
,
"Y"
:
"0"
,
"width"
:
"960"
,
"height"
:
"1200"
},
{
"X"
:
"961"
,
"Y"
:
"0"
,
"width"
:
"960"
,
"height"
:
"1200"
},
{
"X"
:
"20"
,
"Y"
:
"20"
,
"width"
:
"640"
,
"height"
:
"480"
},
{
"X"
:
"30"
,
"Y"
:
"30"
,
"width"
:
"640"
,
"height"
:
"480"
}
]
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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