Difference between revisions of "Running OpenDroneMap"

From Geomaster, Lda
Jump to navigation Jump to search
Line 204: Line 204:
  
 
Será que voar com a câmara a 75 graus ajuda? Fiz um voo com Double Grid, com a camara a 70 graus (default do Pix4d capture).
 
Será que voar com a câmara a 75 graus ajuda? Fiz um voo com Double Grid, com a camara a 70 graus (default do Pix4d capture).
 +
 +
==== Mac ====
 +
 +
1. Install Docker
 +
 +
2. <syntaxhighlight lang="bash">
 +
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)/odm_georeferencing:/code/odm_georeferencing -v $(pwd)/odm_meshing:/code/odm_meshing -v $(pwd)/opensfm:/code/opensfm -v $(pwd)/odm_dem:/code/odm_dem opendronemap/opendronemap --dtm --dsm
 +
</syntaxhighlight>
  
 
==== Windows ====
 
==== Windows ====

Revision as of 15:19, 4 February 2019

Drone Workshop

1. Flight

WebODM

pip install docker-compose

10:54

2. Data products

2.1 Orthophoto

Discussion: GCP, impact on the elevation model

Swipe tool

Point value: check ortho values

2.2 DEM/DSM

Discussion: difference between

Raster value

Profile tool

Visualization: hillshade

http://plas.io/

https://pdal.io/tutorial/pcl_ground/index.html#pcl-ground

-- original
pdal translate -i /code/odm_georeferencing/odm_georeferenced_model.laz -o /code/odm_georeferencing/odm_georeferenced_model.laz smrf --filters.smrf.cell=2 --filters.smrf.slope=10 --filters.smrf.window=10

-- VERY GOOD
pdal translate -i odm_georeferencing/odm_georeferenced_model.ply -o odm_georeferencing/odm_georeferenced_model_2.laz smrf --filters.smrf.cell=2 --filters.smrf.window=10

-- good
pdal ground -i odm_georeferencing/odm_georeferenced_model.ply -o odm_georeferencing/odm_georeferenced_model_3.laz

2.3 Point cloud

What we get from the software

Visualization tools

https://pdal.io/workshop/exercises/analysis/dtm/dtm.html

3. Processing data products


3.1 Better classification

lasground

3.2 lasheight

3.3 lasclassify

DJI Mavic 2 PRO

Sensor size, Video about sensor size

Erro

Culpado: /home/jgr/PycharmProjects/OpenDroneMap/modules/odm_extract_utm

Todas as imagens estão com Exif.GPSInfo.GPSAltitude = 0.0

      if (lon == 0.0 || lat == 0.0 || alt == 0.0) {
        std::string error("Failed parsing GPS position for " + imageFilename);
        throw UtmExtractorException(error);
      }

Remendo

exiv2 -pa DJI_0210.JPG
Exif.GPSInfo.GPSAltitude                     Rational    1  0.0 m

exiv2 -M"set Exif.GPSInfo.GPSAltitude Rational 1/10" DJI_0210.JPG
exiv2 -pa DJI_0210.JPG
Exif.GPSInfo.GPSAltitude                     Rational    1  0.1 m

Chamada:

[INFO]    Wrote images database: /code/images.json
[INFO]    Found 106 usable images
[DEBUG]   running /code/build/bin/odm_extract_utm -imagesPath /code/images/ -imageListFile /code/img_list.txt -outputCoordFile /code/odm_georeferencing/coords.txt  -logFile /code/odm_georeferencing/odm_georeferencing_utm_log.txt
Error in OdmExtractUtm:
Failed parsing GPS position for DJI_0301.JPG
For more detailed information, see log file.
[INFO]    Found 106 usable images
[WARNING] Could not generate coordinates file. Ignore if there is a GCP file. Error: Error in OdmExtractUtm:
Failed parsing GPS position for DJI_0301.JPG
For more detailed information, see log file.

(...)

Building objmodel:
	Saving model... done.
Whole texturing procedure took: 225.586s
[INFO]    Running ODM Texturing Cell - Finished
[INFO]    Running ODM Georeferencing Cell
[WARNING] Georeferencing failed. Make sure your photos have geotags in the EXIF or you have provided a GCP file. 
[INFO]    Running ODM Georeferencing Cell - Finished
[INFO]    Running ODM DEM Cell
[INFO]    Classify: True
[INFO]    Create DSM: True
[INFO]    Create DTM: True
[INFO]    DEM input file /code/odm_georeferencing/odm_georeferenced_model.las found: False
[WARNING] DEM will not be generated
[INFO]    Running ODM DEM Cell - Finished
[INFO]    Running ODM Orthophoto Cell
[DEBUG]   running /code/build/bin/odm_orthophoto -inputFile /code/odm_texturing/odm_textured_model.obj -logFile /code/odm_orthophoto/odm_orthophoto_log.txt -outputFile /code/odm_orthophoto/odm_orthophoto.png -resolution 10.0  -outputCornerFile /code/odm_orthophoto/odm_orthophoto_corners.txt
[WARNING] No geo-referenced orthophoto created due to missing geo-referencing or corner coordinates.
[INFO]    Running ODM OrthoPhoto Cell - Finished
[INFO]    OpenDroneMap app finished - Sat Dec 29 22:12:22  2018

Running docker OpenDroneMap

Update to last OpenDroneMap docker image

docker pull opendronemap/opendronemap

OpenDroneMap docker image

  1. Install docker
  2. Add you user to docker group
  3. sudo -H pip install requests
mkdir OpenDroneMap
cd OpenDroneMap
git clone git@github.com:OpenDroneMap/odm_data_aukerman.git
cd odm_data_aukerman

export odmi=`pwd`
ls -l $odmi

docker run -it --rm \
-v $odmi/images:/code/images \
-v $odmi/odm_orthophoto:/code/odm_orthophoto \
-v $odmi/odm_texturing:/code/odm_texturing \
-v $odmi/odm_georeferencing:/code/odm_georeferencing \
-v $odmi/odm_meshing:/code/odm_meshing \
-v $odmi/opensfm:/code/opensfm \
-v $odmi/odm_dem:/code/odm_dem \
opendronemap/opendronemap --dtm --dsm
cd /home/jgr/Documentos/sletten16maj2018-gcp
export odmi=`pwd`

docker run -it --rm \
-v $odmi/images:/code/images \
-v $odmi/gcp_list.txt:/code/gcp_list.txt \
-v $odmi/odm_orthophoto:/code/odm_orthophoto \
-v $odmi/odm_texturing:/code/odm_texturing \
-v $odmi/odm_georeferencing:/code/odm_georeferencing \
-v $odmi/odm_meshing:/code/odm_meshing \
-v $odmi/opensfm:/code/opensfm \
opendronemap/opendronemap --gcp gcp_list.txt --dtm --dsm

Sem GCP:

cd ~/Documentos/costanovadoprado/
export odmi=`pwd`

docker run -it --rm \
-v $odmi/images:/code/images \
-v $odmi/odm_orthophoto:/code/odm_orthophoto \
-v $odmi/odm_texturing:/code/odm_texturing \
-v $odmi/odm_georeferencing:/code/odm_georeferencing \
-v $odmi/odm_meshing:/code/odm_meshing \
-v $odmi/opensfm:/code/opensfm \
-v $odmi/odm_dem:/code/odm_dem \
opendronemap/opendronemap --dtm --dsm --orthophoto-resolution 10.0

Nota: os ortos estão a ficar com muitas interferências do modelo 3D, nas áreas urbanas.

Related problem: http://community.opendronemap.org/t/buildings/929

Será que voar com a câmara a 75 graus ajuda? Fiz um voo com Double Grid, com a camara a 70 graus (default do Pix4d capture).

Mac

1. Install Docker

2.

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)/odm_georeferencing:/code/odm_georeferencing -v $(pwd)/odm_meshing:/code/odm_meshing -v $(pwd)/opensfm:/code/opensfm -v $(pwd)/odm_dem:/code/odm_dem opendronemap/opendronemap --dtm --dsm

Windows

Install Docker

Configure docker (more CPU, more memory)

CPUs: 6

Memory: 12032 Mb

Swap: 4096 Mb

Create the projet folder structure

Project folder: c:\Users\dlt265\Documents\uav_sckovskolen_feb20018_incl_GCP\

Image folder: c:\Users\dlt265\Documents\uav_sckovskolen_feb20018_incl_GCP\images

Create folders for the OpenDroneMap output.

cd Documents\uav_sckovskolen_feb20018_incl_GCP
md odm_orthophoto
md odm_texturing
md odm_georeferencing
md odm_meshing
md opensfm
md odm_dem
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/odm_georeferencing:/code/odm_georeferencing -v $pwd/odm_meshing:/code/odm_meshing -v $pwd/opensfm:/code/opensfm -v $pwd/odm_dem:/code/odm_dem opendronemap/opendronemap --dtm --dsm
cd ~/Documentos/costanovadoprado2xgrid
export odmi=`pwd`

docker run -it --rm \
-v $odmi/images:/code/images \
-v $odmi/odm_orthophoto:/code/odm_orthophoto \
-v $odmi/odm_texturing:/code/odm_texturing \
-v $odmi/odm_georeferencing:/code/odm_georeferencing \
-v $odmi/odm_meshing:/code/odm_meshing \
-v $odmi/opensfm:/code/opensfm \
-v $odmi/odm_dem:/code/odm_dem \
opendronemap/opendronemap --dtm --dsm --orthophoto-resolution 10.0 --mesh-octree-depth 10

OpenSFM viewer (update)

sudo chown -R jgr:jgr *
git clone https://github.com/mapillary/OpenSfM.git
cd OpenSfM/viewer
ln -s ../../images .
python2 -m SimpleHTTPServer 7777

OpenSFM viewer

jgr@zoe:~/Documentos/costanovadoprado$ sudo chown -R jgr:jgr *
jgr@zoe:~/Documentos/costanovadoprado$ cp -r ~/dev/OpenSfM/viewer opensfm
jgr@zoe:~/Documentos/costanovadoprado$ cd opensfm/
jgr@zoe:~/Documentos/costanovadoprado/opensfm$ ln -s ../images .
jgr@zoe:~/Documentos/costanovadoprado/opensfm$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...

http://localhost:8000/viewer/reconstruction.html#file=/reconstruction.json

OpenSFM view images on QGIS

/home/jgr/Documentos/costanovadoprado/images/DJI_0595.JPG

-8.7515052, 40.6114774, 22.4100000, 2018:08:23 10:05:11

/home/jgr/Documentos/costanovadoprado/opensfm/reference_lla.json

Centro aproximado do ortophoto resultante (adicionado ao projeto QGIS)

{
    "latitude": 40.61272372901514, 
    "altitude": 0, 
    "longitude": -8.752983409509966
}
            "DJI_0595.JPG": {
                "orientation": 1, 
                "camera": "v2 dji fc220 4000 3000 perspective 0.7222", 
                "gps_position": [
                    125.10012061257521, 
                    -138.4010433354888, 
                    22.407269606366754
                ], 
                "gps_dop": 15.0, 
                "rotation": [
                    2.1445873611073996, 
                    -2.2856282209697523, 
                    0.20066193557381898
                ], 
                "translation": [
                    -132.67853610360638, 
                    133.40968771622724, 
                    1.9668907291333997
                ], 
                "capture_time": 1535018711.0
            },

https://github.com/mapillary/OpenSfM/blob/master/opensfm/commands/export_geocoords.py

jgr@zoe:~/Documentos/costanovadoprado/opensfm$ wget https://raw.githubusercontent.com/mapillary/OpenSfM/master/opensfm/commands/export_geocoords.py

NÃO FUNCIONOU...

export_geocoords.py -dataset costanova

Ver: https://github.com/mapillary/OpenSfM/issues/183

webODM

https://github.com/OpenDroneMap/WebODM

git clone https://github.com/OpenDroneMap/WebODM --config core.autocrlf=input
cd WebODM
./webodm.sh start

jgrocha/xxbatata

Tools

CloudCompare

QGIS Plugin Photo2Shape

Criar uma shapefile photos

Nas propriedades, no campo filepath mudar para o tipo Fotografia.

Ground Control File

echo -7.778152 41.833203 957.575989  | cs2cs +init=epsg:4326 +to +init=epsg:3763
echo 708610.702 6209972.025 26.085 | cs2cs +init=epsg:25832 +to +init=epsg:32633

jgr@zoe:~/Documentos/sletten16maj2018-exif$ gdalsrsinfo epsg:32633 -o proj4
'+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs '
jgr@zoe:~/Documentos/sletten16maj2018-exif$ gdalsrsinfo epsg:25832 -o proj4
'+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs '

Make my own OpenDroneMap image

Fork and clone ODM repository

git clone git@github.com:jgrocha/OpenDroneMap.git
cd OpenDroneMap
git checkout -b generate-laz-output

Change source

Build new image

jgr@zoe:~/PycharmProjects/OpenDroneMap$ docker build --no-cache -t odm_altitude_0 .
docker build -t odm_laz_image .

Run new image

# cd "/mnt/bonn/nextCloud/Photos/DJI MAVIC PRO 2 Paradela/100MEDIA"
cd /mnt/bonn/nextCloud/Photos
ln -s 'DJI MAVIC PRO 2 Paradela/100MEDIA' images
export odmi=`pwd`
docker run --cpus 8 -it --rm -v $odmi/images:/code/images -v $odmi/odm_orthophoto:/code/odm_orthophoto -v $odmi/odm_texturing:/code/odm_texturing -v $odmi/odm_georeferencing:/code/odm_georeferencing -v $odmi/odm_meshing:/code/odm_meshing -v $odmi/opensfm:/code/opensfm -v $odmi/odm_dem:/code/odm_dem odm_altitude_0 --dtm --dsm --force-ccd 13.2
# --orthophoto-resolution 2.0 --mesh-octree-depth 2 --opensfm-processes 8


cd /home/jgr/Documentos/sletten16maj2018-gcp
export odmi=`pwd`
sudo rm -rf odm_georeferencing odm_meshing odm_orthophoto odm_texturing opensfm
docker run -it --rm \
-v $odmi/images:/code/images \
-v $odmi/gcp_list.txt:/code/gcp_list.txt \
-v $odmi/odm_orthophoto:/code/odm_orthophoto \
-v $odmi/odm_texturing:/code/odm_texturing \
-v $odmi/odm_georeferencing:/code/odm_georeferencing \
-v $odmi/odm_meshing:/code/odm_meshing \
-v $odmi/opensfm:/code/opensfm \
odm_laz_image --gcp gcp_list.txt --dtm --dsm

The options for rerunning are: 'resize', 'opensfm', 'slam', 'cmvs', 'pmvs', 'odm_meshing', 'mvs_texturing', 'odm_georeferencing', 'odm_orthophoto'

docker run -it --rm \
-v $odmi/images:/code/images \
-v $odmi/gcp_list.txt:/code/gcp_list.txt \
-v $odmi/odm_orthophoto:/code/odm_orthophoto \
-v $odmi/odm_texturing:/code/odm_texturing \
-v $odmi/odm_georeferencing:/code/odm_georeferencing \
-v $odmi/odm_meshing:/code/odm_meshing \
-v $odmi/opensfm:/code/opensfm \
odm_laz_image --gcp gcp_list.txt --dtm --dsm --rerun-from odm_georeferencing

Check the output

running /code/build/bin/odm_georef -bundleFile /code/opensfm/bundle_r000.out -imagesPath /code/images -imagesListPath /code/opensfm/list_r000.out -inputFile /code/odm_texturing/odm_textured_model.obj -outputFile /code/odm_texturing/odm_textured_model_geo.obj -inputPointCloudFile /code/opensfm/depthmaps/merged.ply -outputPointCloudFile /code/odm_georeferencing/odm_georeferenced_model.ply  -logFile /code/odm_georeferencing/odm_georeferencing_log.txt -outputTransformFile /code/odm_georeferencing/odm_georeferencing_transform.txt -georefFileOutputPath /code/odm_georeferencing/odm_georeferencing_model_geo.txt -gcpFile gcp_list.txt -outputCoordFile /code/odm_georeferencing/coords.txt
[DEBUG]   running /code/SuperBuild/build/pdal/bin/pdal pipeline -i /code/odm_georeferencing/las.json --readers.ply.filename=/code/odm_georeferencing/odm_georeferenced_model.ply
PDAL: writers.las: Can't write LAZ output.  PDAL not built with LASzip or LAZperf.
{
  "pipeline": [
    "untransformed.ply",
    {
      "type": "writers.las",
      "a_srs": "+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs ",
      "offset_x": "334230.28164",
      "offset_y": "6208095.41529",
      "offset_z": "0",
      "compression": "laszip",
      "filename": "/code/odm_georeferencing/odm_georeferenced_model.laz"
    }
  ]
}

Captura de ecrã de 2018-06-17 14-34-10.png

Local pdal+LASzip

Build from source!

/usr/local/bin/pdal pipeline -i las.json --readers.ply.filename=odm_georeferenced_model.ply
-rw-r--r-- 1 jgr jgr  22661583 jun 17 11:47 odm_georeferenced_model.laz
-rw-r--r-- 1 jgr jgr 121586206 jun 17 11:42 odm_georeferenced_model.ply

Previous result

Captura de ecrã de 2018-06-16 12-26-36.png

New result

Create Pull Request

close #845

Other fixes

epsg versus EPSG

Point cloud classification

[DEBUG] running pdal info --boundary --filters.hexbin.edge_length=1 --filters.hexbin.threshold=0 /code/odm_georeferencing/odm_georeferenced_model.filtered.las > /code/odm_georeferencing/odm_georeferenced_model.boundary.json PDAL: Argument references invalid/unused stage: 'filters.hexbin'.