Olliver_Reunion,
I had some not so insignificant problems with my DJI m210rtk. I modified the above mentioned script to fix the problems I have/had, which are not to dissimilar from yours.
# Script to fix referencing for DJI Meta data for all cameras in the active chunk.
# this is an improved version of the script read_altitude_from_DJI_meta.py
# available at PhotoScan Pro Scripts repository: https://github.com/agisoft-llc/photoscan-scripts
# updated by H3xx1st (https://github.com/H3xx1st)
import PhotoScan
# Checking compatibility
compatible_major_version = "1.4"
found_major_version = ".".join(PhotoScan.app.version.split('.')[:2])
if found_major_version != compatible_major_version:
raise Exception("Incompatible PhotoScan version: {} != {}".format(found_major_version, compatible_major_version))
def dji_refFix():
"""
Reads DJI/RelativeAltitude
fixes impossible Lat values due to inverted Lat/Long
Sets the reference angles based upon the gimbal values
"""
doc = PhotoScan.app.document
if not len(doc.chunks):
raise Exception("No chunks!")
print("Script started...")
chunk = doc.chunk
for camera in chunk.cameras:
vect = camera.reference.rotation
rAccuracy = PhotoScan.Vector((10, 10, 10))
lAccuracy = PhotoScan.Vector((10, 10, 10))
# Sets the altitude to the RelativeAltitude
if 'DJI/RelativeAltitude' in camera.photo.meta.keys() and camera.reference.location:
z = float(camera.photo.meta["DJI/RelativeAltitude"])
lAccuracy[2] = float("0.5")
# Checks for an impossible latitude value and reverses the Lat/Long
if abs(camera.reference.location.y) > 90:
camera.reference.location = (camera.reference.location.y, camera.reference.location.x, z)
else:
camera.reference.location = (camera.reference.location.x, camera.reference.location.y, z)
# The camera/photo yaw, pitch, roll is taken from the exif data DJI/Gimbal
if 'DJI/GimbalYawDegree' in camera.photo.meta.keys():
vect[0] = float(camera.photo.meta["DJI/GimbalYawDegree"])
rAccuracy[0] = float("0.5")
if 'DJI/GimbalPitchDegree' in camera.photo.meta.keys():
vect[1] = float(camera.photo.meta["DJI/GimbalPitchDegree"]) + 90 # 90 Degrees is added to adjust for the flight angle
rAccuracy[1] = float("0.5")
if 'DJI/GimbalRollDegree' in camera.photo.meta.keys():
vect[2] = float(camera.photo.meta["DJI/GimbalRollDegree"])
rAccuracy[2] = float("0.5")
# Looks for an RTK Flag and sets accuracy accordingly
if 'DJI/RtkFlag' in camera.photo.meta.keys():
if camera.photo.meta("DJI/RtkFlag") == 1:
lAccuracy[0] = float("0.5")
lAccuracy[1] = float("0.5")
else:
lAccuracy[0] = float("2")
lAccuracy[1] = float("2")
camera.reference.rotation = vect
camera.reference.rotation_accuracy = rAccuracy
camera.reference.location_accuracy = lAccuracy
chunk.updateTransform()
PhotoScan.app.update()
print("Script finished")
label = "Custom menu/Fix DJI References"
PhotoScan.app.addMenuItem(label, dji_refFix)
print("To execute this script press {}".format(label))
Run the script and then activate it in the "custom menu" available at the top of the main agisoft window
Please let me know if this fixes your problems. I have only tested this script on my DJI M210RTK and Phantom3Pro