Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
py-3d-face-reconstruction
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard Torenvliet
py-3d-face-reconstruction
Commits
ccc250b5
Commit
ccc250b5
authored
Nov 14, 2016
by
Richard Torenvliet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use global array of images
parent
cea9fbc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
+9
-15
src/server.py
src/server.py
+9
-15
No files found.
src/server.py
View file @
ccc250b5
...
@@ -21,6 +21,11 @@ FACE_DB_NAME = 'imm_face_db'
...
@@ -21,6 +21,11 @@ FACE_DB_NAME = 'imm_face_db'
FACE_DB
=
'{}{}'
.
format
(
FILES_DIR
,
FACE_DB_NAME
)
FACE_DB
=
'{}{}'
.
format
(
FILES_DIR
,
FACE_DB_NAME
)
DATASET
=
os
.
environ
.
get
(
'DATASET'
,
'ibug'
)
# see src/datasets for options
DATASET
=
os
.
environ
.
get
(
'DATASET'
,
'ibug'
)
# see src/datasets for options
images
=
glob
(
'{}/*.jpg'
.
format
(
FACE_DB
))
images
.
sort
()
asf
=
glob
(
'{}/*.asf'
.
format
(
FACE_DB
))
asf
.
sort
()
class
ImageWebSocketHandler
(
websocket
.
WebSocketHandler
):
class
ImageWebSocketHandler
(
websocket
.
WebSocketHandler
):
handlers
=
{
handlers
=
{
...
@@ -29,12 +34,6 @@ class ImageWebSocketHandler(websocket.WebSocketHandler):
...
@@ -29,12 +34,6 @@ class ImageWebSocketHandler(websocket.WebSocketHandler):
}
}
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
images
=
glob
(
'{}/*.jpg'
.
format
(
FACE_DB
))
self
.
asf
=
glob
(
'{}/*.asf'
.
format
(
FACE_DB
))
self
.
images
.
sort
()
self
.
asf
.
sort
()
# todo get from settings
# todo get from settings
model_texture_file
=
'{}/pca_{}_texture_model.npy'
.
format
(
model_texture_file
=
'{}/pca_{}_texture_model.npy'
.
format
(
FILES_DIR
,
DATASET
)
FILES_DIR
,
DATASET
)
...
@@ -77,9 +76,9 @@ class ImageWebSocketHandler(websocket.WebSocketHandler):
...
@@ -77,9 +76,9 @@ class ImageWebSocketHandler(websocket.WebSocketHandler):
logger
.
info
(
'using %s shape_components'
,
shape_components
)
logger
.
info
(
'using %s shape_components'
,
shape_components
)
if
DATASET
==
'imm'
:
if
DATASET
==
'imm'
:
image_filename
=
self
.
asf
[
image_index
]
image_filename
=
asf
[
image_index
]
else
:
else
:
image_filename
=
self
.
images
[
image_index
]
image_filename
=
images
[
image_index
]
dst_image
=
reconstruction
.
reconstruct_shape_texture
(
dst_image
=
reconstruction
.
reconstruct_shape_texture
(
DATASET
,
DATASET
,
...
@@ -126,11 +125,6 @@ class ImageWebSocketHandler(websocket.WebSocketHandler):
...
@@ -126,11 +125,6 @@ class ImageWebSocketHandler(websocket.WebSocketHandler):
class
ApiHandler
(
web
.
RequestHandler
):
class
ApiHandler
(
web
.
RequestHandler
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
images
=
glob
(
'{}/*.jpg'
.
format
(
FACE_DB
))
self
.
asf_files
=
glob
(
'{}/*.asf'
.
format
(
FACE_DB
))
self
.
images
.
sort
()
self
.
asf_files
.
sort
()
web
.
RequestHandler
.
__init__
(
self
,
*
args
,
**
kwargs
)
web
.
RequestHandler
.
__init__
(
self
,
*
args
,
**
kwargs
)
def
set_default_headers
(
self
):
def
set_default_headers
(
self
):
...
@@ -149,13 +143,13 @@ class FaceHandler(ApiHandler):
...
@@ -149,13 +143,13 @@ class FaceHandler(ApiHandler):
"""
"""
data
=
[]
data
=
[]
for
id
,
filename
in
enumerate
(
self
.
asf_files
):
for
id
,
filename
in
enumerate
(
asf
):
data
.
append
({
data
.
append
({
'type'
:
'faces'
,
'type'
:
'faces'
,
'id'
:
id
,
'id'
:
id
,
'attributes'
:
{
'attributes'
:
{
'filename'
:
'{}/{}'
.
format
(
'filename'
:
'{}/{}'
.
format
(
FACE_DB_NAME
,
os
.
path
.
basename
(
self
.
images
[
id
])
FACE_DB_NAME
,
os
.
path
.
basename
(
images
[
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