Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
convert_metafiles_to_colmap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Alcolado Nuthall, George E (PG/R - Comp Sci & Elec Eng)
convert_metafiles_to_colmap
Commits
80e5d902
Commit
80e5d902
authored
2 years ago
by
Alcolado Nuthall
Browse files
Options
Downloads
Patches
Plain Diff
initial commit
parents
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
convert_metafiles.py
+37
-0
37 additions, 0 deletions
convert_metafiles.py
with
37 additions
and
0 deletions
convert_metafiles.py
0 → 100644
+
37
−
0
View file @
80e5d902
import
argparse
import
re
# Original IMAGE_PATH, TX, TY, TZ, QW, QX, QY, QZ
# Image list (COLMAP) with two lines of data per image:
# IMAGE_ID, QW, QX, QY, QZ, TX, TY, TZ, CAMERA_ID, NAME
def
parse_args
():
parser
=
argparse
.
ArgumentParser
(
description
=
"
convert a standard posenet metafiles format to COLMAP image.txt format
"
)
parser
.
add_argument
(
"
--name
"
,
default
=
"
images
"
,
help
=
"
path to the metafile that will be converted
"
)
parser
.
add_argument
(
"
--input_path
"
,
help
=
"
path to the metafile that will be converted
"
)
parser
.
add_argument
(
"
--output_path
"
,
help
=
"
path to where the converted metafile will be generated
"
)
args
=
parser
.
parse_args
()
return
args
if
__name__
==
"
__main__
"
:
args
=
parse_args
()
metaFile
=
open
(
args
.
input_path
)
convertedMetaFile
=
open
(
f
"
{
args
.
output_path
}
/
{
args
.
name
}
.txt
"
,
'
a
'
)
lines
=
metaFile
.
readlines
()
for
count
,
row
in
enumerate
(
lines
):
row
=
row
.
split
()
name
,
x
,
y
,
z
,
qw
,
qx
,
qy
,
qz
=
row
searchObj
=
re
.
search
(
'
([^\/]+$)
'
,
name
)
name
=
searchObj
.
group
()
newRow
=
[
count
,
qw
,
qx
,
qy
,
qz
,
x
,
y
,
z
,
1
,
name
]
newRow
=
'
'
.
join
(
str
(
x
)
for
x
in
newRow
)
convertedMetaFile
.
write
(
newRow
)
convertedMetaFile
.
write
(
'
\n\n
'
)
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