Extracting orthorectified images


#1

I tried to figure out if there was a way to retrieve the orthorectified images used to build the orthomosaic. I would like to test taking a subset of the original ~90% overlap data and mosaic them with the classic ~30% so I can stitch with only two overlapping.

Is it possible for ODM to save those images to disk?


#2

Hey @gabriel.couet, there are no intermediate orthorectified images. ODM doesn’t do image stitching. See this page for more info: https://support.pix4d.com/hc/en-us/articles/202558869-Photo-stitching-vs-orthomosaic-generation


#3

It’s a challenge to think about as, in effect, we are mosaicking the imagery on a 2.5D mesh. This is similar to the Pix4D approach and different from Agisoft and also more traditional photogrammetry approaches, which tend to orthorectifiy the imagery and then put it all together.

In principle, one could script up ODM to produce something similar by iteratively texturing with one image at a time through to orthorectification, if individual orthorectified frames are useful for other reasons.


#4

@pierotofy I understand how orthorectification works. When I mentioned stitching, I was speaking of rectified images, else I would simply stitch the original ones (which would never work). I wasn’t certain how ODM proceeded but if it’s impossible to get intermediate rectified images, it’s not the end of the world.


#5

@gabriel.couet – it’s not impossible, it’s just not straightforward. We don’t currently build them independently but they could be built with the tools that exist in ODM, with a bit of tweaking.

You can achieve the same effect by reducing your reconstruction.nvm to each frame in sequence and run the remaining steps. This will texture your model with just one image frame. You would have to do this for each frame individually, but it would not be hard to batch up if you have some capacity to script. Each step (after creating a reconstruction.nvm that contained just the image of interest) would look something like this:

/home/gisuser/OpenDroneMap/SuperBuild/install/bin/texrecon /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/opensfm/reconstruction.nvm /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_meshing/odm_25dmesh.ply /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_texturing_25d/odm_textured_model -d gmi -o gauss_clamping -t none      --nadir_mode -n 65535

/home/gisuser/OpenDroneMap/build/bin/odm_georef -bundleFile /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/opensfm/bundle_r000.out -inputTransformFile /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/opensfm/geocoords_transformation.txt -inputCoordFile /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_georeferencing/coords.txt -inputFile /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_texturing_25d/odm_textured_model.obj -outputFile /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_texturing_25d/odm_textured_model_geo.obj   -logFile /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_25dgeoreferencing/odm_georeferencing_log.txt -outputTransformFile /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_25dgeoreferencing/odm_georeferencing_transform.txt -georefFileOutputPath /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_25dgeoreferencing/odm_georeferencing_model_geo.txt

/home/gisuser/OpenDroneMap/build/bin/odm_orthophoto -inputFile /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_texturing_25d/odm_textured_model_geo.obj -logFile /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_orthophoto/odm_orthophoto_log.txt -outputFile /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_orthophoto/odm_orthophoto.png -resolution <resolution>  -outputCornerFile /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_orthophoto/odm_orthophoto_corners.txt

gdal_translate -a_ullr <xyxy> -co TILED=yes  -co BIGTIFF=IF_SAFER -co COMPRESS=DEFLATE -co PREDICTOR=2  -co BLOCKXSIZE=512 -co BLOCKYSIZE=512 -co NUM_THREADS=8 -a_srs "+units=m +no_defs=True +datum=WGS84 +proj=utm +zone=37 " --config GDAL_CACHEMAX 46.8% /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_orthophoto/odm_orthophoto.png /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_orthophoto/odm_orthophoto.tif > /mnt/volume-blr1-01/ZMI/ODMProjects/msimbasi_test1/odm_orthophoto/gdal_translate_log.txt

If you have the time to get this working, I would be very interested in the results. This process would then be quite similar to Agisoft’s approach, and could have value as an alternative way to process to orthophotos.