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
bob
bob.measure
Commits
b4a40ba8
Commit
b4a40ba8
authored
Oct 06, 2015
by
Manuel Günther
Browse files
Solved python3 issue with IO
parent
5b7f3a0f
Changes
1
Hide whitespace changes
Inline
Side-by-side
bob/measure/openbr.py
View file @
b4a40ba8
...
...
@@ -235,16 +235,19 @@ def write_score_file(
If ``None``, the values will not be written in the score file at all.
"""
def
_read_matrix
(
filename
):
py3
=
sys
.
version_info
[
0
]
>=
3
## Helper function to read a matrix file as written by OpenBR
with
open
(
filename
,
'rb'
)
as
f
:
# get version
header
=
f
.
readline
()
if
py3
:
header
=
header
.
decode
(
"utf-8"
)
assert
header
[:
2
]
==
"S2"
# skip gallery and probe files
f
.
readline
()
f
.
readline
()
# read size and type of matrix
size
=
f
.
readline
()
if
py3
:
size
=
size
.
decode
(
"utf-8"
)
splits
=
size
.
rstrip
().
split
()
# TODO: check the endianess of the magic number stored in split[3]
assert
splits
[
0
][
0
]
==
'M'
...
...
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