Forum

Author Topic: Custom reprojections for point clouds, DEMs, and Orthos  (Read 350 times)

cstallings@b1rd.io

  • Newbie
  • *
  • Posts: 8
    • View Profile
Custom reprojections for point clouds, DEMs, and Orthos
« on: May 07, 2021, 11:49:49 PM »
Hello, I made a set of tools that allows me to scale, translate, and rotate my camera positions for localized survey projects. I want to know if I can do the same to the finalized ortho, point cloud, and DEM? sometimes projects need deliverables in both grid and ground coordinates. If possible, I would prefer to process my projects in grid coordinates and then convert the products (point clouds, DEMs, and orthos) to ground coordinates. This way I can have two sets in both projections.  I looked through the API documentation but I was unable to clearly identify methods to do these types of transformations. If you could point me in the right direction to the methods in the API documentation for each deliverable or have some examples, that would be great.
Thank you

Paulo

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: Custom reprojections for point clouds, DEMs, and Orthos
« Reply #1 on: May 08, 2021, 04:16:10 AM »
Hi,

once you tansform your project into local coordinates, the point clouds will be automatically transformed.

However the DEM and Ortho have to be regenerated in the new local system....

The following example shows how I transform a project from grid crs to local crs, setting 1st camera center local coordinates to (100, 100, 100) with local crs coordinate axes set to localframe (E, N, Up) at 1st camera center.

Obviously, the dense cloud is automatically in local crs while DEM is still in original grid crs and has to be regenerated if needed in local crs.
« Last Edit: May 08, 2021, 01:37:17 PM by Paulo »
Best Regards,

Paul Pelletier

cstallings@b1rd.io

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Custom reprojections for point clouds, DEMs, and Orthos
« Reply #2 on: May 10, 2021, 06:55:15 PM »
Thank you Paul, If I'm looking at it correctly, I believe your process is similar. You are applying your correction to your chunk. I'm applying it to my cameras prior to my bundle adjustment. My hope is that there was a way to apply a transformation to the product so that you don't have to reprocess if you were creating outputs in both a grid and local coordinate system. Do you know if that is possible?

Paulo

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: Custom reprojections for point clouds, DEMs, and Orthos
« Reply #3 on: May 11, 2021, 12:55:14 AM »
Hi.

be careful if you apply your transformation to each camera, in case you already have point clouds present in the project. Then the point clouds would need to be recalculated as their internal position corresponds to original camera alignment. Changing your cameras position and orientation (camera.transform) you would need to reprocess the sparse point cloud using chunk.triangulatePoints() and regenerate the dense cloud. That is why it is preferable to apply transformation to local using the chunk transform without touching the camera transforms... Hope this is clear. As for Dem and Ortho maybe it could be posible to apply some 2d transformation to x,y grid (translation,rotation,scale) and a shift to each elevationn in case of DEM to get new products in local crs but that would have to be investigated....

I think that for example in case of DEM, it would be simpler to export the DEM (dsm.tif in example) in original grid CRS (UTM 30 N). And then with script in MS export to a Global Mapper transformation file (*.gm_xform) the 2D shift, scale and rotation parameters, Then in Global Mapper, open the dsm.tif file and with Shift - Transform Coordinates..., apply the transformation file to the dem. Then apply the elevation offset (-254.95 m) in Alter Elevation Values (Elevation options). Finally export as a GeoTiff but with Advanced: Don't write GeoTiff header option and with Generate world file option. You will then obtain a dem in local reference without GeoTiff header and with a world file (tfw)... Same procedure could be done with Ortho without need of course of altering elevation values. Probably also could be done in Qgis or with GDAL.... But of course, depending on the extent of your local/grid projects, it may be quicker just to regenerate DEMs/Orthos in local crs....
« Last Edit: May 11, 2021, 12:27:13 PM by Paulo »
Best Regards,

Paul Pelletier

cstallings@b1rd.io

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Custom reprojections for point clouds, DEMs, and Orthos
« Reply #4 on: May 17, 2021, 06:58:27 PM »
Thank you Paul,

That is a very good point on the camera transformations vs. the block. In my workflow, all transformations have been completed prior to alignment. I didn't know Metashape allowed you to much your block post alignment allowing you to keep your tie points and dense point cloud. I'll try that.

Regarding the translation of the raster products, the workflow you described is similar to what I do already in Global Mapper. My thought was if I could do it in Metashape as well, I could create a script to just process and export products in Grid and Ground and not have to worry about any post processing.

Thank you for your help with this. you have been very helpfull!