Tuesday, June 26, 2012

3D Coordinate Transformations

JAG3D is a large software package that can be used for geodetic correction of survey data, however, buried within the interface is a nice compact module for performing full 3D coordinate transformations.


This tutorial is for JAG3D version 3.3.20110211 (published Feb. 11, 2011)



***The interface in newer versions was completely redesigned, though these instructions can still be useful.

The first hurdle to get over is that the coordinate transformation module in this version is all in German, so be patient-I'll try to translate where I can.

The first thing to do is set up JAD3D to run a little more efficiently. In the extracted ZIP file there is a JAD3D_en.bat file that we'll need to edit.
  • Edit the file by right-clicking and choosing ‘Edit’ from the context menu.
  • We need to increase the amount of memory JAG3D can access through the Java Virtual Machine.
  • In the batch file the variable -Xmx controls this.
    • Change the number after this tag to the maximum memory you wish to use, in Megabytes (1000Mb = 1Gb). I usually put it up to just under the maximum RAM for the computer.
  • Save and Close the BAT file.


To run JAG3D with these new settings, simply double-click the JAG3D_en.bat file to launch the program. This also leaves open the Command Line window to view the progress of the transformation.
  • If you get a error “Error occurred during initialization of VM…,” your memory allocation is not right (usually too much). Go back and edit the BAT file with a smaller memory parameter.
We won't be working in the main part of the program, although I'm told it does some pretty amazing things. We will be using the Coordinate Transformation utility under the Modules menu item.
To prep your data for JAG3D please see my other post Data Prep for JAG 3D.
The first step is to import your two datasets.
  • Under the ‘Datei’ menu, select ‘Import Startsystem’, navigate to the text file with your raw data. Your data will populate the Statsystem table when it is complete.
    Depending on the number of points and the memory you allocated, this could take upwards of 10 mins
  • Go back to the ‘Datei’ menu and select ‘Import Zeilsystem’, navigate to the text file with your GCP data. Switch to the 'Zeilsystem' tab on the bottom of the window to ensure your points loaded correctly.
The second step is to choose your transformation.
  • Choose the '3D' option, in the drop down choose the
    7-Parametertransformation-3D (M, Rx,Ry,Rz,Tx,Ty,Tz) option. This will scale the points uniformly and calculate independent coefficients for rotation and translation in all three axes.
    Transformationsarten = Transformation types
  • The three options for parameter estimation are Unweighted or using the Gauss-Markov or Gauss-Helmert models of least squares estimation.
    I've compared the three estimation options on two different datasets and found zero difference in the outputs. Unweighted in fine for most applications.
    Parameterschätzung = Parameter Estimation
If all your data is loaded and you’ve chose the right options you're ready to hit the “Go” button. Press the ‘Berechnung starten’ button in the lower right corner.

If your command prompt window is still open you can watch the progress and it calculates the parameters and applies the transformation. A word of warning, most of the point clouds I've dealt with are between 50,000 and 100,000 points. I've allocated 3.5 Gb to JAG and it routinely takes 20 minutes to process all of the points.

A pop-up will inform you when everything is done. Switch to the Transformation tab on the bottom of the window to see the results.

The next thing to do is export the transformed data.
  • In the ‘Datei’ menu, select ‘Export Transformation.’ By default the file doesn’t have an extension. When you type your file name add .txt to the end.
  • Save the file to the directory of your choosing.
  • This again takes a while depending on the size of your cloud.
If you are so inclined, there are two ways to save the transformation parameters:
  1. Select all the text in the command prompt window and copy it to a blank text file.
  2. In the ‘Datei’ menu, select ‘Report erstellen’. This will generate a HTML report of the outputs.
    Report erstellen = Create report
Congratulations, you’ve just transformed your data!!!

4 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
    Replies
    1. Hello James,

      I have been trying to get the transformation to work using the new version of the JAG3D, but (1) it keeps crashing, and (2) it may be crashing because I am feeding it the wrong files to match the "source" and "target." Basically, its look totally different from the old version which both you and Mark Willis at blog Markaeology used in your tutorials.

      I thought the easiest solution would be to find the older version, which I cannot find so far, so I was wondering if you still had a copy, and if yes, could you ftp me a copy? I would really appreciate the help,

      thanks,
      nicole
      ---
      Nicole,

      I looked around online and couldn't find the older versions either. I uploaded a zipped copy of version 3.3.20110211 to my Dropbox, I'll leave it up for a couple days.

      Good Luck, James

      Delete
  2. Hi James,

    I used the JAG3D software to transfer the marked points (Control points) from SfM point cloud, in order to test the accuracy of SfM points.

    There were 16 control points (both in user coordinates and in SfM pixel coordinates) in total and I used all of them for the transformation. The results in "Transformation" contains the transferred coordinates of the SfM points and the corresponding errors for Y, X, H. Can I treat these errors as the errors of SfM reconstructed point cloud?

    Also, do you have some documents or publications of the JAG3D transformation?

    Kind regards,
    Zhihua Xu

    ReplyDelete
    Replies
    1. You can treat the errors as the SfM point cloud, although you also need to account for the error that comes what ever instrument (GPS, total station...) you used to make your georeferencing measurements. I will say that JAG3D might not be the best option, Mike James' software SFM_Georef is a much more robust way to georeference SFM data.

      As to your question about 'documents or publications of the JAG3D transformation?' - I don't, I used the software for one project a while back and haven't really used it since.

      Delete