From aaebab16352a3e6c04c1af53af72f9a02e6bfde8 Mon Sep 17 00:00:00 2001 From: Jorge Gustavo Rocha Date: Sun, 17 Jun 2018 14:51:37 +0100 Subject: [PATCH 1/9] Add support for compressed LAZ files Add LASzip library to docker Close #845 Former-commit-id: ad4e42643a4b72f44f7c65aa7a6b87b3cf9d4638 --- README.md | 2 +- SuperBuild/CMakeLists.txt | 1 + SuperBuild/cmake/External-LASzip.cmake | 26 ++++++++++++++++++++++++++ SuperBuild/cmake/External-PDAL.cmake | 5 ++--- opendm/types.py | 11 ++++++----- tests/test_odm.py | 2 +- 6 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 SuperBuild/cmake/External-LASzip.cmake diff --git a/README.md b/README.md index cdf8650d..ecc33624 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ When the process finishes, the results will be organized as follows: |-- texture_N.jpg # Associated textured images used by the model |-- odm_georeferencing/ |-- odm_georeferenced_model.ply # A georeferenced dense point cloud - |-- odm_georeferenced_model.ply.laz # LAZ format point cloud + |-- odm_georeferenced_model.laz # LAZ format point cloud |-- odm_georeferenced_model.csv # XYZ format point cloud |-- odm_georeferencing_log.txt # Georeferencing log |-- odm_georeferencing_transform.txt# Transform used for georeferencing diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index 1aee12c3..d559a410 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -124,6 +124,7 @@ set(custom_libs OpenGV CMVS Catkin Ecto + LASzip PDAL MvsTexturing ) diff --git a/SuperBuild/cmake/External-LASzip.cmake b/SuperBuild/cmake/External-LASzip.cmake new file mode 100644 index 00000000..1cea4788 --- /dev/null +++ b/SuperBuild/cmake/External-LASzip.cmake @@ -0,0 +1,26 @@ +set(_proj_name laszip) +set(_SB_BINARY_DIR "${SB_BINARY_DIR}/${_proj_name}") + +ExternalProject_Add(${_proj_name} + DEPENDS + PREFIX ${_SB_BINARY_DIR} + TMP_DIR ${_SB_BINARY_DIR}/tmp + STAMP_DIR ${_SB_BINARY_DIR}/stamp + #--Download step-------------- + DOWNLOAD_DIR ${SB_DOWNLOAD_DIR} + URL https://github.com/LASzip/LASzip/releases/download/3.2.2/laszip-src-3.2.2.tar.gz + #--Update/Patch step---------- + UPDATE_COMMAND "" + #--Configure step------------- + SOURCE_DIR ${SB_SOURCE_DIR}/${_proj_name} + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR} + #--Build step----------------- + BINARY_DIR ${_SB_BINARY_DIR} + #--Install step--------------- + INSTALL_DIR ${SB_INSTALL_DIR} + #--Output logging------------- + LOG_DOWNLOAD OFF + LOG_CONFIGURE OFF + LOG_BUILD OFF +) diff --git a/SuperBuild/cmake/External-PDAL.cmake b/SuperBuild/cmake/External-PDAL.cmake index 7a919804..685f1913 100644 --- a/SuperBuild/cmake/External-PDAL.cmake +++ b/SuperBuild/cmake/External-PDAL.cmake @@ -2,14 +2,13 @@ set(_proj_name pdal) set(_SB_BINARY_DIR "${SB_BINARY_DIR}/${_proj_name}") ExternalProject_Add(${_proj_name} - DEPENDS hexer + DEPENDS hexer laszip PREFIX ${_SB_BINARY_DIR} TMP_DIR ${_SB_BINARY_DIR}/tmp STAMP_DIR ${_SB_BINARY_DIR}/stamp #--Download step-------------- DOWNLOAD_DIR ${SB_DOWNLOAD_DIR} - URL https://github.com/PDAL/PDAL/archive/e881b581e3b91a928105d67db44c567f3b6d1afe.tar.gz - URL_MD5 cadbadf1c83d69d6525cfffd41473323 + URL https://github.com/PDAL/PDAL/releases/download/1.7.2/PDAL-1.7.2-src.tar.gz #--Update/Patch step---------- UPDATE_COMMAND "" #--Configure step------------- diff --git a/opendm/types.py b/opendm/types.py index 271660d5..fcdab164 100644 --- a/opendm/types.py +++ b/opendm/types.py @@ -255,16 +255,18 @@ class ODM_GeoRef(object): 'srs': self.projection.srs, 'json': json_file} - # create pipeline file transform.xml to enable transformation + # create pipeline file las.json to write odm_georeferenced_model.laz point cloud pipeline = '{{' \ ' "pipeline":[' \ ' "untransformed.ply",' \ ' {{' \ + ' "type":"writers.las",' \ ' "a_srs":"{srs}",' \ ' "offset_x":"{east}",' \ ' "offset_y":"{north}",' \ ' "offset_z":"0",' \ - ' "filename":"transformed.las"' \ + ' "compression":"laszip",' \ + ' "filename":"{f_out}"' \ ' }}' \ ' ]' \ '}}'.format(**kwargs) @@ -273,8 +275,7 @@ class ODM_GeoRef(object): f.write(pipeline) # call pdal - system.run('{bin}/pdal pipeline -i {json} --readers.ply.filename={f_in} ' - '--writers.las.filename={f_out}'.format(**kwargs)) + system.run('{bin}/pdal pipeline -i {json} --readers.ply.filename={f_in}'.format(**kwargs)) def utm_to_latlon(self, _file, _photo, idx): @@ -478,7 +479,7 @@ class ODM_Tree(object): self.odm_georeferencing_las_json = io.join_paths( self.odm_georeferencing, 'las.json') self.odm_georeferencing_model_las = io.join_paths( - self.odm_georeferencing, 'odm_georeferenced_model.las') + self.odm_georeferencing, 'odm_georeferenced_model.laz') self.odm_georeferencing_dem = io.join_paths( self.odm_georeferencing, 'odm_georeferencing_model_dem.tif') diff --git a/tests/test_odm.py b/tests/test_odm.py index 648a657b..2604c315 100644 --- a/tests/test_odm.py +++ b/tests/test_odm.py @@ -136,7 +136,7 @@ class TestGeoreferencing(unittest.TestCase): def test_las_out(self): self.assertTrue(os.path.isfile(os.path.join(self.app.georeferencing.inputs.tree.odm_georeferencing, - "odm_georeferenced_model.ply.las"))) + "odm_georeferenced_model.laz"))) class TestOrthophoto(unittest.TestCase): From 50a4195afca2014a8011c6d050ec712e5e8171ac Mon Sep 17 00:00:00 2001 From: Danilo Bargen Date: Mon, 18 Jun 2018 13:55:26 +0200 Subject: [PATCH 2/9] README: Line-wrap and fix docker commands - The paths need to be quoted, in case `pwd` contains spaces - Some dashes were missing in the `-v` parameters - Line wrapping for easier readability Former-commit-id: 67dc735297ec2e533f260c8d09a2e49dc5e7fe97 --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index cdf8650d..598e2ac8 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,11 @@ instructions through "Create a Docker group". The Docker image workflow has equivalent procedures for Mac OS X and Windows found at [docs.docker.com](docs.docker.com). Then run the following command which will build a pre-built image and run on images found in `$(pwd)/images` (you can change this if you need to, see the [wiki](https://github.com/OpenDroneMap/OpenDroneMap/wiki/Docker) for more detailed instructions. ``` -docker run -it --rm -v $(pwd)/images:/code/images -v $(pwd)/odm_orthophoto:/code/odm_orthophoto -v $(pwd)/odm_texturing:/code/odm_texturing opendronemap/opendronemap +docker run -it --rm \ + -v "$(pwd)/images:/code/images" \ + -v "$(pwd)/odm_orthophoto:/code/odm_orthophoto" \ + -v "$(pwd)/odm_texturing:/code/odm_texturing" \ + opendronemap/opendronemap ``` ### Native Install (Ubuntu 16.04) @@ -155,12 +159,20 @@ installed on your machine. Docker software is free to install and use in this co see the [Docker Ubuntu installation tutorial](https://docs.docker.com/engine/installation/linux/ubuntulinux/) and follow the instructions through "Create a Docker group". Once Docker is installed, the fastest way to use OpenDroneMap is to run a pre-built image by typing: - docker run -it --rm -v $(pwd)/images:/code/images -v $(pwd)/odm_orthophoto:/code/odm_orthophoto -v $(pwd)/odm_texturing:/code/odm_texturing opendronemap/opendronemap + docker run -it --rm \ + -v "$(pwd)/images:/code/images" \ + -v "$(pwd)/odm_orthophoto:/code/odm_orthophoto" \ + -v "$(pwd)/odm_texturing:/code/odm_texturing" \ + opendronemap/opendronemap If you want to build your own Docker image from sources, type: docker build -t my_odm_image . - docker run -it --rm -v $(pwd)/images:/code/images -v $(pwd)/odm_orthophoto:/code/odm_orthophoto -v $(pwd)/odm_texturing:/code/odm_texturing my_odm_image + docker run -it --rm \ + -v "$(pwd)/images:/code/images" \ + -v "$(pwd)/odm_orthophoto:/code/odm_orthophoto" \ + -v "$(pwd)/odm_texturing:/code/odm_texturing" \ + my_odm_image Using this method, the containerized ODM will process the images in the OpenDroneMap/images directory and output results to the OpenDroneMap/odm_orthophoto and OpenDroneMap/odm_texturing directories as described in the [Viewing Results](https://github.com/OpenDroneMap/OpenDroneMap/wiki/Output-and-Results) section. @@ -168,19 +180,40 @@ If you want to view other results outside the Docker image simply add which dire established above. For example, if you're interested in the dense cloud results generated by PMVS and in the orthophoto, simply use the following `docker run` command after building the image: - docker run -it --rm -v $(pwd)/images:/code/images -v $(pwd)/odm_georeferencing:/code/odm_georeferencing -v $(pwd)/odm_orthophoto:/code/odm_orthophoto my_odm_image + docker run -it --rm \ + -v "$(pwd)/images:/code/images" \ + -v "$(pwd)/odm_georeferencing:/code/odm_georeferencing" \ + -v "$(pwd)/odm_orthophoto:/code/odm_orthophoto" \ + my_odm_image If you want to get all intermediate outputs, run the following command: - docker run -it --rm -v $(pwd)/images:/code/images -v $(pwd)/odm_georeferencing:/code/odm_georeferencing -v $(pwd)/odm_meshing:/code/odm_meshing -v $(pwd)/odm_orthophoto:/code/odm_orthophoto -v $(pwd)/odm_texturing:/code/odm_texturing -v $(pwd)/opensfm:/code/opensfm -v $(pwd)/pmvs:/code/pmvs opendronemap/opendronemap + docker run -it --rm \ + -v "$(pwd)/images:/code/images" \ + -v "$(pwd)/odm_georeferencing:/code/odm_georeferencing" \ + -v "$(pwd)/odm_meshing:/code/odm_meshing" \ + -v "$(pwd)/odm_orthophoto:/code/odm_orthophoto" \ + -v "$(pwd)/odm_texturing:/code/odm_texturing" \ + -v "$(pwd)/opensfm:/code/opensfm" \ + -v "$(pwd)/pmvs:/code/pmvs" \ + opendronemap/opendronemap To pass in custom parameters to the run.py script, simply pass it as arguments to the `docker run` command. For example: - docker run -it --rm -v $(pwd)/images:/code/images v $(pwd)/odm_orthophoto:/code/odm_orthophoto -v $(pwd)/odm_texturing:/code/odm_texturing opendronemap/opendronemap --resize-to 1800 --force-ccd 6.16 + docker run -it --rm \ + -v "$(pwd)/images:/code/images" \ + -v "$(pwd)/odm_orthophoto:/code/odm_orthophoto" \ + -v "$(pwd)/odm_texturing:/code/odm_texturing" \ + opendronemap/opendronemap --resize-to 1800 --force-ccd 6.16 If you want to pass in custom parameters using the settings.yaml file, you can pass it as a -v volume binding: - docker run -it --rm -v $(pwd)/images:/code/images v $(pwd)/odm_orthophoto:/code/odm_orthophoto -v $(pwd)/odm_texturing:/code/odm_texturing -v $(pwd)/settings.yaml:/code/settings.yaml opendronemap/opendronemap + docker run -it --rm \ + -v "$(pwd)/images:/code/images" \ + -v "$(pwd)/odm_orthophoto:/code/odm_orthophoto" \ + -v "$(pwd)/odm_texturing:/code/odm_texturing" \ + -v "$(pwd)/settings.yaml:/code/settings.yaml" \ + opendronemap/opendronemap When building your own Docker image, if image size is of importance to you, you should use the ```--squash``` flag, like so: @@ -203,7 +236,7 @@ A web interface and API to OpenDroneMap is currently under active development in ## Video Support -Currently we have an experimental feature that uses ORB_SLAM to render a textured mesh from video. It is only supported on Ubuntu 14.04 on machines with X11 support. See the [wiki](https://github.com/OpenDroneMap/OpenDroneMap/wiki/Reconstruction-from-Video)for details on installation and use. +Currently we have an experimental feature that uses ORB_SLAM to render a textured mesh from video. It is only supported on Ubuntu 14.04 on machines with X11 support. See the [wiki](https://github.com/OpenDroneMap/OpenDroneMap/wiki/Reconstruction-from-Video) for details on installation and use. ## Examples From 3022ff3463e53fada4d2b83cd2e1ac5687a03e0a Mon Sep 17 00:00:00 2001 From: Stephen Mather Date: Mon, 18 Jun 2018 09:49:51 -0400 Subject: [PATCH 3/9] odm_georeferencing_las_json to laz Former-commit-id: 1d2fab6c90d00b65e9b502ca03e0ceec06f36dcc --- opendm/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendm/types.py b/opendm/types.py index fcdab164..dea7eafb 100644 --- a/opendm/types.py +++ b/opendm/types.py @@ -476,7 +476,7 @@ class ODM_Tree(object): self.odm_georeferencing_model_obj_geo = 'odm_textured_model_geo.obj' self.odm_georeferencing_xyz_file = io.join_paths( self.odm_georeferencing, 'odm_georeferenced_model.csv') - self.odm_georeferencing_las_json = io.join_paths( + self.odm_georeferencing_laz_json = io.join_paths( self.odm_georeferencing, 'las.json') self.odm_georeferencing_model_las = io.join_paths( self.odm_georeferencing, 'odm_georeferenced_model.laz') From c936737acd4037842f0093e9da1b212e82c947d7 Mon Sep 17 00:00:00 2001 From: Stephen Mather Date: Mon, 18 Jun 2018 09:56:19 -0400 Subject: [PATCH 4/9] Revert "Add support for compressed LAZ files" Former-commit-id: 829117ba8b22df185e396fa5b3555385229ce468 --- README.md | 2 +- SuperBuild/CMakeLists.txt | 1 - SuperBuild/cmake/External-LASzip.cmake | 26 -------------------------- SuperBuild/cmake/External-PDAL.cmake | 5 +++-- opendm/types.py | 13 ++++++------- tests/test_odm.py | 2 +- 6 files changed, 11 insertions(+), 38 deletions(-) delete mode 100644 SuperBuild/cmake/External-LASzip.cmake diff --git a/README.md b/README.md index 7495cc03..598e2ac8 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ When the process finishes, the results will be organized as follows: |-- texture_N.jpg # Associated textured images used by the model |-- odm_georeferencing/ |-- odm_georeferenced_model.ply # A georeferenced dense point cloud - |-- odm_georeferenced_model.laz # LAZ format point cloud + |-- odm_georeferenced_model.ply.laz # LAZ format point cloud |-- odm_georeferenced_model.csv # XYZ format point cloud |-- odm_georeferencing_log.txt # Georeferencing log |-- odm_georeferencing_transform.txt# Transform used for georeferencing diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index d559a410..1aee12c3 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -124,7 +124,6 @@ set(custom_libs OpenGV CMVS Catkin Ecto - LASzip PDAL MvsTexturing ) diff --git a/SuperBuild/cmake/External-LASzip.cmake b/SuperBuild/cmake/External-LASzip.cmake deleted file mode 100644 index 1cea4788..00000000 --- a/SuperBuild/cmake/External-LASzip.cmake +++ /dev/null @@ -1,26 +0,0 @@ -set(_proj_name laszip) -set(_SB_BINARY_DIR "${SB_BINARY_DIR}/${_proj_name}") - -ExternalProject_Add(${_proj_name} - DEPENDS - PREFIX ${_SB_BINARY_DIR} - TMP_DIR ${_SB_BINARY_DIR}/tmp - STAMP_DIR ${_SB_BINARY_DIR}/stamp - #--Download step-------------- - DOWNLOAD_DIR ${SB_DOWNLOAD_DIR} - URL https://github.com/LASzip/LASzip/releases/download/3.2.2/laszip-src-3.2.2.tar.gz - #--Update/Patch step---------- - UPDATE_COMMAND "" - #--Configure step------------- - SOURCE_DIR ${SB_SOURCE_DIR}/${_proj_name} - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR} - #--Build step----------------- - BINARY_DIR ${_SB_BINARY_DIR} - #--Install step--------------- - INSTALL_DIR ${SB_INSTALL_DIR} - #--Output logging------------- - LOG_DOWNLOAD OFF - LOG_CONFIGURE OFF - LOG_BUILD OFF -) diff --git a/SuperBuild/cmake/External-PDAL.cmake b/SuperBuild/cmake/External-PDAL.cmake index 685f1913..7a919804 100644 --- a/SuperBuild/cmake/External-PDAL.cmake +++ b/SuperBuild/cmake/External-PDAL.cmake @@ -2,13 +2,14 @@ set(_proj_name pdal) set(_SB_BINARY_DIR "${SB_BINARY_DIR}/${_proj_name}") ExternalProject_Add(${_proj_name} - DEPENDS hexer laszip + DEPENDS hexer PREFIX ${_SB_BINARY_DIR} TMP_DIR ${_SB_BINARY_DIR}/tmp STAMP_DIR ${_SB_BINARY_DIR}/stamp #--Download step-------------- DOWNLOAD_DIR ${SB_DOWNLOAD_DIR} - URL https://github.com/PDAL/PDAL/releases/download/1.7.2/PDAL-1.7.2-src.tar.gz + URL https://github.com/PDAL/PDAL/archive/e881b581e3b91a928105d67db44c567f3b6d1afe.tar.gz + URL_MD5 cadbadf1c83d69d6525cfffd41473323 #--Update/Patch step---------- UPDATE_COMMAND "" #--Configure step------------- diff --git a/opendm/types.py b/opendm/types.py index dea7eafb..271660d5 100644 --- a/opendm/types.py +++ b/opendm/types.py @@ -255,18 +255,16 @@ class ODM_GeoRef(object): 'srs': self.projection.srs, 'json': json_file} - # create pipeline file las.json to write odm_georeferenced_model.laz point cloud + # create pipeline file transform.xml to enable transformation pipeline = '{{' \ ' "pipeline":[' \ ' "untransformed.ply",' \ ' {{' \ - ' "type":"writers.las",' \ ' "a_srs":"{srs}",' \ ' "offset_x":"{east}",' \ ' "offset_y":"{north}",' \ ' "offset_z":"0",' \ - ' "compression":"laszip",' \ - ' "filename":"{f_out}"' \ + ' "filename":"transformed.las"' \ ' }}' \ ' ]' \ '}}'.format(**kwargs) @@ -275,7 +273,8 @@ class ODM_GeoRef(object): f.write(pipeline) # call pdal - system.run('{bin}/pdal pipeline -i {json} --readers.ply.filename={f_in}'.format(**kwargs)) + system.run('{bin}/pdal pipeline -i {json} --readers.ply.filename={f_in} ' + '--writers.las.filename={f_out}'.format(**kwargs)) def utm_to_latlon(self, _file, _photo, idx): @@ -476,10 +475,10 @@ class ODM_Tree(object): self.odm_georeferencing_model_obj_geo = 'odm_textured_model_geo.obj' self.odm_georeferencing_xyz_file = io.join_paths( self.odm_georeferencing, 'odm_georeferenced_model.csv') - self.odm_georeferencing_laz_json = io.join_paths( + self.odm_georeferencing_las_json = io.join_paths( self.odm_georeferencing, 'las.json') self.odm_georeferencing_model_las = io.join_paths( - self.odm_georeferencing, 'odm_georeferenced_model.laz') + self.odm_georeferencing, 'odm_georeferenced_model.las') self.odm_georeferencing_dem = io.join_paths( self.odm_georeferencing, 'odm_georeferencing_model_dem.tif') diff --git a/tests/test_odm.py b/tests/test_odm.py index 2604c315..648a657b 100644 --- a/tests/test_odm.py +++ b/tests/test_odm.py @@ -136,7 +136,7 @@ class TestGeoreferencing(unittest.TestCase): def test_las_out(self): self.assertTrue(os.path.isfile(os.path.join(self.app.georeferencing.inputs.tree.odm_georeferencing, - "odm_georeferenced_model.laz"))) + "odm_georeferenced_model.ply.las"))) class TestOrthophoto(unittest.TestCase): From e61c8d9547f4d08ab9d9ad537682ddfb262a4c53 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 18 Jun 2018 09:57:20 -0400 Subject: [PATCH 5/9] Renamed las-->laz Former-commit-id: 84cfe9026fc21a13a5dd5ccd655d91c56d8ecbbe --- opendm/types.py | 2 +- scripts/odm_dem.py | 10 +++++----- scripts/odm_georeferencing.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/opendm/types.py b/opendm/types.py index dea7eafb..fea83142 100644 --- a/opendm/types.py +++ b/opendm/types.py @@ -478,7 +478,7 @@ class ODM_Tree(object): self.odm_georeferencing, 'odm_georeferenced_model.csv') self.odm_georeferencing_laz_json = io.join_paths( self.odm_georeferencing, 'las.json') - self.odm_georeferencing_model_las = io.join_paths( + self.odm_georeferencing_model_laz = io.join_paths( self.odm_georeferencing, 'odm_georeferenced_model.laz') self.odm_georeferencing_dem = io.join_paths( self.odm_georeferencing, 'odm_georeferencing_model_dem.tif') diff --git a/scripts/odm_dem.py b/scripts/odm_dem.py index ec039eeb..7958fe91 100644 --- a/scripts/odm_dem.py +++ b/scripts/odm_dem.py @@ -28,7 +28,7 @@ class ODMDEMCell(ecto.Cell): # get inputs args = self.inputs.args tree = self.inputs.tree - las_model_found = io.file_exists(tree.odm_georeferencing_model_las) + las_model_found = io.file_exists(tree.odm_georeferencing_model_laz) # check if we rerun cell or not rerun_cell = (args.rerun is not None and @@ -40,7 +40,7 @@ class ODMDEMCell(ecto.Cell): log.ODM_INFO('Classify: ' + str(args.pc_classify != "none")) log.ODM_INFO('Create DSM: ' + str(args.dsm)) log.ODM_INFO('Create DTM: ' + str(args.dtm)) - log.ODM_INFO('DEM input file {0} found: {1}'.format(tree.odm_georeferencing_model_las, str(las_model_found))) + log.ODM_INFO('DEM input file {0} found: {1}'.format(tree.odm_georeferencing_model_laz, str(las_model_found))) # Setup terrain parameters terrain_params_map = { @@ -61,8 +61,8 @@ class ODMDEMCell(ecto.Cell): pc_classify_marker = os.path.join(odm_dem_root, 'pc_classify_done.txt') if not io.file_exists(pc_classify_marker) or rerun_cell: - log.ODM_INFO("Classifying {} using {}".format(tree.odm_georeferencing_model_las, args.pc_classify)) - commands.classify(tree.odm_georeferencing_model_las, + log.ODM_INFO("Classifying {} using {}".format(tree.odm_georeferencing_model_laz, args.pc_classify)) + commands.classify(tree.odm_georeferencing_model_laz, args.pc_classify == "smrf", slope, cellsize, @@ -96,7 +96,7 @@ class ODMDEMCell(ecto.Cell): for product in products: commands.create_dems( - [tree.odm_georeferencing_model_las], + [tree.odm_georeferencing_model_laz], product, radius=map(str, radius_steps), gapfill=True, diff --git a/scripts/odm_georeferencing.py b/scripts/odm_georeferencing.py index 054ba278..69a519e3 100644 --- a/scripts/odm_georeferencing.py +++ b/scripts/odm_georeferencing.py @@ -138,7 +138,7 @@ class ODMGeoreferencingCell(ecto.Cell): # convert ply model to LAS reference system geo_ref.convert_to_las(odm_georeferencing_model_ply_geo, - tree.odm_georeferencing_model_las, + tree.odm_georeferencing_model_laz, tree.odm_georeferencing_las_json) reconstruction.georef = geo_ref @@ -171,7 +171,7 @@ class ODMGeoreferencingCell(ecto.Cell): if args.crop > 0: log.ODM_INFO("Calculating cropping area and generating bounds shapefile from point cloud") cropper = Cropper(tree.odm_georeferencing, 'odm_georeferenced_model') - cropper.create_bounds_shapefile(tree.odm_georeferencing_model_las, args.crop) + cropper.create_bounds_shapefile(tree.odm_georeferencing_model_laz, args.crop) # Do not execute a second time, since # We might be doing georeferencing for From 03ba92e7971072cb30e1be83705b2b5f366fd4b5 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Mon, 18 Jun 2018 11:27:33 -0400 Subject: [PATCH 6/9] Replayed laz support commit Former-commit-id: 6a2b6d14e084ace593e33172c7fd7dd5185107a8 --- README.md | 2 +- SuperBuild/CMakeLists.txt | 1 + SuperBuild/cmake/External-LASzip.cmake | 26 ++++++++++++++++++++++++++ SuperBuild/cmake/External-PDAL.cmake | 5 ++--- opendm/types.py | 11 ++++++----- tests/test_odm.py | 2 +- 6 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 SuperBuild/cmake/External-LASzip.cmake diff --git a/README.md b/README.md index 598e2ac8..7495cc03 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ When the process finishes, the results will be organized as follows: |-- texture_N.jpg # Associated textured images used by the model |-- odm_georeferencing/ |-- odm_georeferenced_model.ply # A georeferenced dense point cloud - |-- odm_georeferenced_model.ply.laz # LAZ format point cloud + |-- odm_georeferenced_model.laz # LAZ format point cloud |-- odm_georeferenced_model.csv # XYZ format point cloud |-- odm_georeferencing_log.txt # Georeferencing log |-- odm_georeferencing_transform.txt# Transform used for georeferencing diff --git a/SuperBuild/CMakeLists.txt b/SuperBuild/CMakeLists.txt index 1aee12c3..d559a410 100644 --- a/SuperBuild/CMakeLists.txt +++ b/SuperBuild/CMakeLists.txt @@ -124,6 +124,7 @@ set(custom_libs OpenGV CMVS Catkin Ecto + LASzip PDAL MvsTexturing ) diff --git a/SuperBuild/cmake/External-LASzip.cmake b/SuperBuild/cmake/External-LASzip.cmake new file mode 100644 index 00000000..1cea4788 --- /dev/null +++ b/SuperBuild/cmake/External-LASzip.cmake @@ -0,0 +1,26 @@ +set(_proj_name laszip) +set(_SB_BINARY_DIR "${SB_BINARY_DIR}/${_proj_name}") + +ExternalProject_Add(${_proj_name} + DEPENDS + PREFIX ${_SB_BINARY_DIR} + TMP_DIR ${_SB_BINARY_DIR}/tmp + STAMP_DIR ${_SB_BINARY_DIR}/stamp + #--Download step-------------- + DOWNLOAD_DIR ${SB_DOWNLOAD_DIR} + URL https://github.com/LASzip/LASzip/releases/download/3.2.2/laszip-src-3.2.2.tar.gz + #--Update/Patch step---------- + UPDATE_COMMAND "" + #--Configure step------------- + SOURCE_DIR ${SB_SOURCE_DIR}/${_proj_name} + CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR} + #--Build step----------------- + BINARY_DIR ${_SB_BINARY_DIR} + #--Install step--------------- + INSTALL_DIR ${SB_INSTALL_DIR} + #--Output logging------------- + LOG_DOWNLOAD OFF + LOG_CONFIGURE OFF + LOG_BUILD OFF +) diff --git a/SuperBuild/cmake/External-PDAL.cmake b/SuperBuild/cmake/External-PDAL.cmake index 7a919804..685f1913 100644 --- a/SuperBuild/cmake/External-PDAL.cmake +++ b/SuperBuild/cmake/External-PDAL.cmake @@ -2,14 +2,13 @@ set(_proj_name pdal) set(_SB_BINARY_DIR "${SB_BINARY_DIR}/${_proj_name}") ExternalProject_Add(${_proj_name} - DEPENDS hexer + DEPENDS hexer laszip PREFIX ${_SB_BINARY_DIR} TMP_DIR ${_SB_BINARY_DIR}/tmp STAMP_DIR ${_SB_BINARY_DIR}/stamp #--Download step-------------- DOWNLOAD_DIR ${SB_DOWNLOAD_DIR} - URL https://github.com/PDAL/PDAL/archive/e881b581e3b91a928105d67db44c567f3b6d1afe.tar.gz - URL_MD5 cadbadf1c83d69d6525cfffd41473323 + URL https://github.com/PDAL/PDAL/releases/download/1.7.2/PDAL-1.7.2-src.tar.gz #--Update/Patch step---------- UPDATE_COMMAND "" #--Configure step------------- diff --git a/opendm/types.py b/opendm/types.py index 65a61c20..fea83142 100644 --- a/opendm/types.py +++ b/opendm/types.py @@ -255,16 +255,18 @@ class ODM_GeoRef(object): 'srs': self.projection.srs, 'json': json_file} - # create pipeline file transform.xml to enable transformation + # create pipeline file las.json to write odm_georeferenced_model.laz point cloud pipeline = '{{' \ ' "pipeline":[' \ ' "untransformed.ply",' \ ' {{' \ + ' "type":"writers.las",' \ ' "a_srs":"{srs}",' \ ' "offset_x":"{east}",' \ ' "offset_y":"{north}",' \ ' "offset_z":"0",' \ - ' "filename":"transformed.las"' \ + ' "compression":"laszip",' \ + ' "filename":"{f_out}"' \ ' }}' \ ' ]' \ '}}'.format(**kwargs) @@ -273,8 +275,7 @@ class ODM_GeoRef(object): f.write(pipeline) # call pdal - system.run('{bin}/pdal pipeline -i {json} --readers.ply.filename={f_in} ' - '--writers.las.filename={f_out}'.format(**kwargs)) + system.run('{bin}/pdal pipeline -i {json} --readers.ply.filename={f_in}'.format(**kwargs)) def utm_to_latlon(self, _file, _photo, idx): @@ -475,7 +476,7 @@ class ODM_Tree(object): self.odm_georeferencing_model_obj_geo = 'odm_textured_model_geo.obj' self.odm_georeferencing_xyz_file = io.join_paths( self.odm_georeferencing, 'odm_georeferenced_model.csv') - self.odm_georeferencing_las_json = io.join_paths( + self.odm_georeferencing_laz_json = io.join_paths( self.odm_georeferencing, 'las.json') self.odm_georeferencing_model_laz = io.join_paths( self.odm_georeferencing, 'odm_georeferenced_model.laz') diff --git a/tests/test_odm.py b/tests/test_odm.py index 648a657b..2604c315 100644 --- a/tests/test_odm.py +++ b/tests/test_odm.py @@ -136,7 +136,7 @@ class TestGeoreferencing(unittest.TestCase): def test_las_out(self): self.assertTrue(os.path.isfile(os.path.join(self.app.georeferencing.inputs.tree.odm_georeferencing, - "odm_georeferenced_model.ply.las"))) + "odm_georeferenced_model.laz"))) class TestOrthophoto(unittest.TestCase): From 2edf69d71f67dd809ae3bb731757410dc9e2d58f Mon Sep 17 00:00:00 2001 From: Stephen Mather Date: Mon, 18 Jun 2018 18:15:44 -0400 Subject: [PATCH 7/9] revert odm_georeferencing_laz_json Former-commit-id: a84a04d716356d5992cf66fe0876f4b4451ac402 --- opendm/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendm/types.py b/opendm/types.py index fea83142..c3cbe382 100644 --- a/opendm/types.py +++ b/opendm/types.py @@ -476,7 +476,7 @@ class ODM_Tree(object): self.odm_georeferencing_model_obj_geo = 'odm_textured_model_geo.obj' self.odm_georeferencing_xyz_file = io.join_paths( self.odm_georeferencing, 'odm_georeferenced_model.csv') - self.odm_georeferencing_laz_json = io.join_paths( + self.odm_georeferencing_las_json = io.join_paths( self.odm_georeferencing, 'las.json') self.odm_georeferencing_model_laz = io.join_paths( self.odm_georeferencing, 'odm_georeferenced_model.laz') From ccd053c24b7fddc88c6dc33c640c6661a52363a2 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sat, 30 Jun 2018 13:41:01 -0400 Subject: [PATCH 8/9] Fixes PDAL compilation issue Former-commit-id: b92697962d3f8fb06c4be481a22af9afce589b88 --- SuperBuild/cmake/External-LASzip.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SuperBuild/cmake/External-LASzip.cmake b/SuperBuild/cmake/External-LASzip.cmake index 1cea4788..54d0fbe3 100644 --- a/SuperBuild/cmake/External-LASzip.cmake +++ b/SuperBuild/cmake/External-LASzip.cmake @@ -8,13 +8,16 @@ ExternalProject_Add(${_proj_name} STAMP_DIR ${_SB_BINARY_DIR}/stamp #--Download step-------------- DOWNLOAD_DIR ${SB_DOWNLOAD_DIR} - URL https://github.com/LASzip/LASzip/releases/download/3.2.2/laszip-src-3.2.2.tar.gz + URL https://github.com/LASzip/LASzip/archive/master.zip #--Update/Patch step---------- UPDATE_COMMAND "" #--Configure step------------- SOURCE_DIR ${SB_SOURCE_DIR}/${_proj_name} CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX:PATH=${SB_INSTALL_DIR} + -DBUILD_SHARED_LIBS=ON + -DBUILD_STATIC_LIBS=OFF + -DCMAKE_INSTALL_PREFIX=${SB_INSTALL_DIR} + -DCMAKE_INSTALL_LIBDIR=lib #--Build step----------------- BINARY_DIR ${_SB_BINARY_DIR} #--Install step--------------- @@ -23,4 +26,4 @@ ExternalProject_Add(${_proj_name} LOG_DOWNLOAD OFF LOG_CONFIGURE OFF LOG_BUILD OFF -) +) \ No newline at end of file From 31405471637b8489212cb47507ab2042a258fa58 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sat, 30 Jun 2018 16:27:48 -0400 Subject: [PATCH 9/9] Added _proj_name to download paths to avoid conflicts Former-commit-id: 3036e14a2feb2b5b5f7e6c8b4c6f35b65077f21d --- SuperBuild/cmake/External-LASzip.cmake | 2 +- SuperBuild/cmake/External-MvsTexturing.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SuperBuild/cmake/External-LASzip.cmake b/SuperBuild/cmake/External-LASzip.cmake index 54d0fbe3..c2e997eb 100644 --- a/SuperBuild/cmake/External-LASzip.cmake +++ b/SuperBuild/cmake/External-LASzip.cmake @@ -7,7 +7,7 @@ ExternalProject_Add(${_proj_name} TMP_DIR ${_SB_BINARY_DIR}/tmp STAMP_DIR ${_SB_BINARY_DIR}/stamp #--Download step-------------- - DOWNLOAD_DIR ${SB_DOWNLOAD_DIR} + DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}/${_proj_name} URL https://github.com/LASzip/LASzip/archive/master.zip #--Update/Patch step---------- UPDATE_COMMAND "" diff --git a/SuperBuild/cmake/External-MvsTexturing.cmake b/SuperBuild/cmake/External-MvsTexturing.cmake index 0999c14d..a5eaa1f9 100644 --- a/SuperBuild/cmake/External-MvsTexturing.cmake +++ b/SuperBuild/cmake/External-MvsTexturing.cmake @@ -7,7 +7,7 @@ ExternalProject_Add(${_proj_name} TMP_DIR ${_SB_BINARY_DIR}/tmp STAMP_DIR ${_SB_BINARY_DIR}/stamp #--Download step-------------- - DOWNLOAD_DIR ${SB_DOWNLOAD_DIR} + DOWNLOAD_DIR ${SB_DOWNLOAD_DIR}/${_proj_name} URL https://github.com/OpenDroneMap/mvs-texturing/archive/master.zip #--Update/Patch step---------- UPDATE_COMMAND ""