Fixed CSV export, added pc-csv flag

pull/832/head
Piero Toffanin 2018-06-03 21:01:04 -04:00
rodzic 0677565096
commit a80de54e92
3 zmienionych plików z 24 dodań i 18 usunięć

Wyświetl plik

@ -334,6 +334,11 @@ def config():
'Default: '
'%(default)s')
parser.add_argument('--pc-csv',
action='store_true',
default=False,
help='Export the georeferenced point cloud in CSV format. Default: %(default)s')
parser.add_argument('--texturing-data-term',
metavar='<string>',
default='gmi',

Wyświetl plik

@ -1,6 +1,7 @@
import ecto
import csv
import os
import struct
from opendm import io
from opendm import log
@ -143,21 +144,28 @@ class ODMGeoreferencingCell(ecto.Cell):
reconstruction.georef = geo_ref
# XYZ point cloud output
log.ODM_INFO("Creating geo-referenced CSV file (XYZ format)")
with open(tree.odm_georeferencing_xyz_file, "wb") as csvfile:
csvfile_writer = csv.writer(csvfile, delimiter=",")
reachedpoints = False
with open(odm_georeferencing_model_ply_geo) as f:
for lineNumber, line in enumerate(f):
if reachedpoints:
tokens = line.split(" ")
if args.pc_csv:
log.ODM_INFO("Creating geo-referenced CSV file (XYZ format)")
with open(tree.odm_georeferencing_xyz_file, "wb") as csvfile:
csvfile_writer = csv.writer(csvfile, delimiter=",")
with open(odm_georeferencing_model_ply_geo) as f:
endianess = '<' # little endian
while True:
line = f.readline()
if "binary_big_endian" in line:
endianess = '>'
if line.startswith("end_header"):
break
while True:
chunk = f.read(27) # 3 doubles, 3 uints
if len(chunk) < 27:
break
tokens = struct.unpack('<dddBBB', chunk)
csv_line = [float(tokens[0]),
float(tokens[1]),
tokens[2]]
csvfile_writer.writerow(csv_line)
if line.startswith("end_header"):
reachedpoints = True
csvfile.close()
if args.crop > 0:
log.ODM_INFO("Calculating cropping area and generating bounds shapefile from point cloud")

Wyświetl plik

@ -136,13 +136,6 @@ class ODMOpenSfMCell(ecto.Cell):
log.ODM_WARNING('Found a valid OpenSfM reconstruction file in: %s' %
tree.opensfm_reconstruction)
if not io.file_exists(tree.opensfm_reconstruction_meshed) or rerun_cell:
system.run('PYTHONPATH=%s %s/bin/opensfm mesh %s' %
(context.pyopencv_path, context.opensfm_path, tree.opensfm))
else:
log.ODM_WARNING('Found a valid OpenSfM meshed reconstruction file in: %s' %
tree.opensfm_reconstruction_meshed)
if not args.use_pmvs:
if not io.file_exists(tree.opensfm_reconstruction_nvm) or rerun_cell:
system.run('PYTHONPATH=%s %s/bin/opensfm export_visualsfm %s' %