Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.ip.flandmark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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.ip.flandmark
Commits
49e01904
Commit
49e01904
authored
12 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Adds script to annotate videos
parent
085d56f4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
flandmark/ext/ext.cpp
+1
-1
1 addition, 1 deletion
flandmark/ext/ext.cpp
flandmark/script/__init__.py
+0
-0
0 additions, 0 deletions
flandmark/script/__init__.py
flandmark/script/annotate.py
+55
-0
55 additions, 0 deletions
flandmark/script/annotate.py
with
56 additions
and
1 deletion
flandmark/ext/ext.cpp
+
1
−
1
View file @
49e01904
...
...
@@ -109,7 +109,7 @@ class Localizer {
for
(
int
i
=
0
;
i
<
(
2
*
m_flandmark
->
data
.
options
.
M
);
i
+=
2
)
{
lmlist
.
append
(
make_tuple
(
m_landmarks
[
i
],
m_landmarks
[
i
+
1
]));
}
det
[
"landmark"
]
=
lmlist
;
det
[
"landmark"
]
=
tuple
(
lmlist
)
;
retval
.
append
(
det
);
}
...
...
This diff is collapsed.
Click to expand it.
flandmark/script/__init__.py
0 → 100644
+
0
−
0
View file @
49e01904
This diff is collapsed.
Click to expand it.
flandmark/script/annotate.py
0 → 100644
+
55
−
0
View file @
49e01904
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Andre Anjos <andre.anjos@idiap.ch>
# Fri 21 Sep 2012 10:43:12 CEST
"""
Annotates videos, dumps annotations as text files.
"""
import
os
import
sys
import
bob
from
..
import
Localizer
import
pkg_resources
def
get_biggest
(
dets
):
"""
Returns the biggest detection found
"""
retval
=
dets
[
0
]
for
d
in
dets
[
1
:]:
if
retval
[
'
bbox
'
][
2
]
<
d
[
'
bbox
'
][
2
]:
retval
=
d
return
retval
def
main
():
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
,
formatter_class
=
argparse
.
RawDescriptionHelpFormatter
)
parser
.
add_argument
(
'
video
'
,
metavar
=
'
VIDEO
'
,
type
=
str
,
help
=
"
Video file to load
"
)
from
..version
import
__version__
name
=
os
.
path
.
basename
(
os
.
path
.
splitext
(
sys
.
argv
[
0
])[
0
])
parser
.
add_argument
(
'
-V
'
,
'
--version
'
,
action
=
'
version
'
,
version
=
'
Automatic Video Keypoint Annotation Tool v%s (%s)
'
%
(
__version__
,
name
))
args
=
parser
.
parse_args
()
if
not
os
.
path
.
exists
(
args
.
video
):
parser
.
error
(
"
Input video file
'
%s
'
cannot be read
"
%
args
.
video
)
op
=
Localizer
()
v
=
bob
.
io
.
VideoReader
(
args
.
video
)
for
k
,
frame
in
enumerate
(
v
):
dets
=
op
(
frame
)
if
dets
:
biggest
=
get_biggest
(
dets
)
bbox
=
biggest
[
'
bbox
'
]
landmarks
=
biggest
[
'
landmark
'
]
print
"
%d %d %d %d %d
"
%
((
k
,)
+
bbox
),
for
pair
in
landmarks
:
print
"
%d %d
"
%
(
round
(
pair
[
0
]),
round
(
pair
[
1
])),
print
""
else
:
print
"
%d 0 0 0 0
"
%
k
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