Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.db.fargo
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.db.fargo
Commits
c55af829
Commit
c55af829
authored
6 years ago
by
Guillaume HEUSCH
Browse files
Options
Downloads
Patches
Plain Diff
[script] python3 compat for extracting eyes center
parent
80787c20
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/db/fargo/scripts/extract_eyes_center.py
+7
-13
7 additions, 13 deletions
bob/db/fargo/scripts/extract_eyes_center.py
with
7 additions
and
13 deletions
bob/db/fargo/scripts/extract_eyes_center.py
+
7
−
13
View file @
c55af829
...
@@ -146,15 +146,6 @@ def get_eyes_center(landmarks):
...
@@ -146,15 +146,6 @@ def get_eyes_center(landmarks):
reye_y
=
int
(
0.5
*
(
landmarks
[
'
1
'
][
0
]
+
landmarks
[
'
2
'
][
0
]))
reye_y
=
int
(
0.5
*
(
landmarks
[
'
1
'
][
0
]
+
landmarks
[
'
2
'
][
0
]))
leye_x
=
int
(
0.5
*
(
landmarks
[
'
3
'
][
1
]
+
landmarks
[
'
4
'
][
1
]))
leye_x
=
int
(
0.5
*
(
landmarks
[
'
3
'
][
1
]
+
landmarks
[
'
4
'
][
1
]))
leye_y
=
int
(
0.5
*
(
landmarks
[
'
3
'
][
0
]
+
landmarks
[
'
4
'
][
0
]))
leye_y
=
int
(
0.5
*
(
landmarks
[
'
3
'
][
0
]
+
landmarks
[
'
4
'
][
0
]))
# print "============================"
# print "right eye right corner (y,x) = {0}".format(landmarks['1'])
# print "right eye left corner (y,x) = {0}".format(landmarks['2'])
# print "right eye center (y,x) = {0}".format((reye_y, reye_x))
# print "----------------------------"
# print "left eye right corner (y,x) = {0}".format(landmarks['4'])
# print "left eye right corner (y,x) = {0}".format(landmarks['3'])
# print "left eye center (y,x) = {0}".format((leye_y, leye_x))
return
(
reye_x
,
reye_y
,
leye_x
,
leye_y
)
return
(
reye_x
,
reye_y
,
leye_x
,
leye_y
)
...
@@ -516,7 +507,7 @@ def annotate(image_file, eyes, annotation_dir):
...
@@ -516,7 +507,7 @@ def annotate(image_file, eyes, annotation_dir):
f
.
close
()
f
.
close
()
os
.
system
(
'
./bin/annotate.py
'
+
image_file
+
'
00.pos --output temp.txt
'
)
os
.
system
(
'
./bin/annotate.py
'
+
image_file
+
'
00.pos --output temp.txt
'
)
raw_
input
(
"
Press Enter to terminate.
"
)
input
(
"
Press Enter to terminate.
"
)
# read eyes center from temp annotation file
# read eyes center from temp annotation file
f1
=
open
(
'
temp.txt
'
,
'
r
'
)
f1
=
open
(
'
temp.txt
'
,
'
r
'
)
...
@@ -567,7 +558,10 @@ def main(user_input=None):
...
@@ -567,7 +558,10 @@ def main(user_input=None):
os
.
mkdir
(
args
[
'
--eyesdir
'
])
os
.
mkdir
(
args
[
'
--eyesdir
'
])
logfile
=
open
(
args
[
'
--log
'
],
'
w
'
)
logfile
=
open
(
args
[
'
--log
'
],
'
w
'
)
# python 2 / 3 compatibility
from
builtins
import
input
# to compute various stats
# to compute various stats
total_counter
=
0
total_counter
=
0
inexisting_counter
=
0
inexisting_counter
=
0
...
@@ -662,7 +656,7 @@ def main(user_input=None):
...
@@ -662,7 +656,7 @@ def main(user_input=None):
pyplot
.
show
()
pyplot
.
show
()
# ask for re-annotation (i.e. reprojection is not good)
# ask for re-annotation (i.e. reprojection is not good)
reannotate
=
raw_
input
(
"
Want to re-annotate color ? [y/n]:
"
)
reannotate
=
input
(
"
Want to re-annotate color ? [y/n]:
"
)
if
reannotate
==
'
y
'
:
if
reannotate
==
'
y
'
:
# get eyes position in the color frame
# get eyes position in the color frame
...
@@ -696,7 +690,7 @@ def main(user_input=None):
...
@@ -696,7 +690,7 @@ def main(user_input=None):
pyplot
.
show
()
pyplot
.
show
()
# ask for re-annotation (i.e. reprojection is not good)
# ask for re-annotation (i.e. reprojection is not good)
reannotate
=
raw_
input
(
"
Want to re-annotate IR ? [y/n]:
"
)
reannotate
=
input
(
"
Want to re-annotate IR ? [y/n]:
"
)
if
reannotate
==
'
y
'
:
if
reannotate
==
'
y
'
:
# get eyes position in the IR frame
# get eyes position in the IR frame
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment