Export calibrated locations and orientations?

I am currently just testing Pix4Dmatic to calibrate images collected using both drones and ground cameras. I am able to import a number of images and run a calibration, but when I “File > Export image geolocations and orientations …” I only get a CSV with the original data, not the calibrated data, which should be noticeably different, as shown in the Pix4Dmatic 3D view (calibrated vs. input cameras).

How can I export the calibrated locations and orientations of the cameras?

PS: I don’t have any GCP to import and I care less about absolute accuracy (where the images were taken on the planet) than relative accuracy (where images were taken relative to each other).

I’d recommend you look into the Open Photogrammetry Format (OPF) export available in PIX4Dmatic, more here: Pix4D Labs: Meet OPF - the PDF of photogrammetry

That seems to contain the information I need, but unfortunately the position values in calibrated_cameras.json are in the “processing CRS”, whichever that one is. I couldn’t find any indication in my project’s OPF output, nor in the OPF documentation.

In my case, the project CRS is automatically set to WGS 84 / UTM zone 18N, but that appears to be another CRS altogether. I’d like my output in vanilla WGS84/EGM96. How do I obtain that?

Hi Oliver. The “processing CRS” is defined by the scene_reference_frame item. In your case it’s basically the WGS 84 / UTM zone 18N coordinates translated. To get from the processing CRS coordinates to the project CRS you need to subtract the shift from the scene reference frame. For unprojecting to WGS 84 with EGM96 height you will need to process the coordinates with a third party tool such as PROJ.

The calibrated camera orientations are in the OPK convention. There is a document explaining how to convert between OPF and YPR if that’s what you need in the end. In any case, bear in mind that in strict terms when going from projected to geographic coordinates the orientation needs to be adjusted due to the angle between the grid north and the true geographic north. In other words, even if OPK angles are good for you, depending on the distance to the central meridian the kappa angle may be slightly off. Also note that this deviation is not at the whole scene level, but per camera, so the uncorrected orientations will be inconsistent.

Thanks Juan, that helps a lot. I used the individual calibrated cameras’ locations, subtracted the scene_reference_frame’s base_to_canonical.shift, and reprojected from EPSG:32618+5773 to EPSG:4326+5773 using pyproj. The results are very plausible.

I do need OPK in the end. So what you’re saying is that since true north (any meridian in EPSG:4326?) is different from the grid north in UTM18N my kappa angles would be off, and that error depends on where I am in the UTM18N zone? It shouldn’t be too hard to determine that offset, but would it translate directly into a difference in the kappa angle, or would it entail another bit of transformation - i.e. if my grid north is 1° west of true north, would I have to change kappa by 1°, or by a different value?

Yes, the error depends on the longitude. For UTM18N, the error will be 0 on longitude -75° and increase as you move away. I can’t tell you the exact formula without doing some research but from the top of my head it’s about 1° provided you’re within the area of use. Then, I’ve revisited the rotation matrix formula used with OPK angles and I have bad news, the rotation around the Z axis comes first in this convention, so any change in the kappa angle can potentially affect the other two. What you can do is convert first the OPK angles to a matrix, apply a post rotation around the Z axis to correct the grid declination and then recover OPK angles from corrected matrix. The formulas you need are in equations 4 and 10 of the document I linked above.