Forum

Author Topic: Problems with DJI Pictures to build an correct elevation model  (Read 3965 times)

Olliver_Reunion

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hi,
im relatively new to agisoft.
We used the Software UgCS and a DJI Phantom 4 to genarate pictures for photogrammetry.
The picturesets were taken on two diffenrent days. The problem is, when i import them to agisoft following along the tutorial the two chunks have a very strange offset to ech other, even though they were taken at the same place. Also when aligned the second pointcloud has an completly wrong orientation in the view.

When looking through the Altitudevalues, they are also strange, because we never flew over 50 meteres hight.

The problem is hard to explain, i'll attach some pictures.....

I hope sombody can hlep me with my problem

ruyi7952

  • Full Member
  • ***
  • Posts: 104
    • View Profile
    • My Blog
Re: Problems with DJI Pictures to build an correct elevation model
« Reply #1 on: March 14, 2018, 02:33:05 AM »
The DJI record has a problem with the height value. If you only need a relative height, please visit:https://github.com/agisoft-llc/photoscan-scripts/blob/master/src/read_altitude_from_DJI_meta.py if you need the absolute height, you need to get the normal high or altitude of the take-off point in advance, please visit:https://github.com/agisoft-llc/photoscan-scripts/blob/master/src/add_altitude_to_reference.py
Real Scene Model Professional Contractor

Collect、Process、Publish

Olliver_Reunion

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Problems with DJI Pictures to build an correct elevation model
« Reply #2 on: March 14, 2018, 12:04:35 PM »
Thank you for the quick reply.
The script just works fine and i get the correct hight values.
But the orientation of the TiePoints are still completly wrong.
Both surfaces should be flat, but they are still at an angle......

Does anyone has an idea why this mistake occurs?

Both surfaces were scanned at the same place on different days.
If you look from the top view the surfaces align very good, but if you look from the side view they are not aligned and are placed in an angle to each other.....

Hexx

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Problems with DJI Pictures to build an correct elevation model
« Reply #3 on: March 24, 2018, 11:22:53 AM »
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.

Code: [Select]
# 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
« Last Edit: March 24, 2018, 11:45:06 AM by Hexx »

ciara123

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Problems with DJI Pictures to build an correct elevation model
« Reply #4 on: April 04, 2018, 12:29:48 PM »
Hi Olliver_Reunion,

Did you find a solution to this? I have a similar problem with a dataset collected in the same area on different days using a DJI Phantom 4 Pro. The side profile shows there is a discrepancy and there are two different planes of data rather than it all being on the same plane. I followed the ideas of what others are suggesting, stripping the altitude EXIF data and replacing it with ground elevations from the web (using Geosetter, not the scripts posted here). In one project that worked, but in another it did not solve the issue. Were all your Ground Control Points in one of the datasets?

If you have solved your problem, could you share a solution please?

Best,
Ciara



Thank you for the quick reply.
The script just works fine and i get the correct hight values.
But the orientation of the TiePoints are still completly wrong.
Both surfaces should be flat, but they are still at an angle......

Does anyone has an idea why this mistake occurs?

Both surfaces were scanned at the same place on different days.
If you look from the top view the surfaces align very good, but if you look from the side view they are not aligned and are placed in an angle to each other.....

Hexx

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Problems with DJI Pictures to build an correct elevation model
« Reply #5 on: April 05, 2018, 03:24:37 PM »
I followed the ideas of what others are suggesting, stripping the altitude EXIF data and replacing it with ground elevations from the web (using Geosetter, not the scripts posted here).

Maybe try one of the above scripts and see if you get an improved result?

ciara123

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Problems with DJI Pictures to build an correct elevation model
« Reply #6 on: April 17, 2018, 01:32:37 PM »
I haven't been using scripts and honestly I'm not too code savvy. Is it just a matter or importing and running the script from a text file?

Looking at the start of it I probably need to get the latest update done too!

Cheers,
Ciara

hkyon

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Problems with DJI Pictures to build an correct elevation model
« Reply #7 on: April 17, 2018, 07:05:36 PM »
Hi,
I download python script and run it.
In the Custom menu, after executing fix tool, Altitude of first camera seems fixed. But others are unchanged.
I can look console pane "Error: 'NoneType' object does not support item assignment".
Could you tell me what should I do?
Thanks in advance.