Calculating position of target of drone

We have an dji matricies 300 rtk video. I would like to detect position of something. Here an example photo what I would like to detect. Green rectangle is my target.Black rectangle is mid point of the image, so focus point of the camera.

First I find some informations like height and position of drone, pitch and yaw angle of drone, compass angle. Then I calculate distance between drone and object like below.

``````distance = height* tan(GIMBAL.pitch)

height: height of drone
GIMBAL.pitch: pitch angle of gimbal.
``````

With the distance, I use this post 1 to calculate position of the target.

However, there is little bit more error when I compare it with Lidar Laser Range Finder.

yellow one is calculation, red one is actual position and blue one is laser range finder. I think calculation an laser range finder should be almost same because both of them measure distance for same point which is center of camera. Is there anything that I do wrong? Here parameters:

``````drone latitude: 37.4534739401493
drone longitude: 38.6699858861775
drone height [m]: 129.17424
gimbal pitch: -20.1
gimbal yaw [360] = 326.3
distance between drone and target 352.98

actual object latitude: 37,4560140571369
actual object longitude: 38,6684240400208

calculated object latitude: 37.45611493462226
calculated object longitude: 38.66776707137195
``````

Here exif data. Note that exif data belogs to another image.

``````ExifTool Version Number         : 12.62
File Name                       : DJI_0069.JPG
ULER
File Size                       : 9.0 MB
File Modification Date/Time     : 2023:05:31 06:19:10+03:00
File Access Date/Time           : 2023:07:14 08:48:22+03:00
File Creation Date/Time         : 2023:06:01 10:55:09+03:00
File Permissions                : -rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
Image Width                     : 5472
Image Height                    : 3648
Bits Per Sample                 : 8 8 8
Image Description               : default
Camera Model Name               : L1D-20c
Orientation                     : Horizontal (normal)
Samples Per Pixel               : 3
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : 10.00.14.06
Modify Date                     : 2023:05:31 06:19:11
Y Cb Cr Positioning             : Centered
Exposure Time                   : 1/30
F Number                        : 2.8
Exposure Program                : Program AE
ISO                             : 120
Exif Version                    : 0230
Date/Time Original              : 2023:05:31 06:19:11
Create Date                     : 2023:05:31 06:19:11
Components Configuration        : Y, Cb, Cr, -
Exposure Compensation           : +2.3
Max Aperture Value              : 2.8
Metering Mode                   : Center-weighted average
Light Source                    : Daylight
Flash                           : No Flash
Focal Length                    : 10.3 mm
AE Debug Info                   : (Binary data 256 bytes, use -b option to extract)
AE Histogram Info               : (Binary data 4096 bytes, use -b option to extract)
AE Local Histogram              : (Binary data 2048 bytes, use -b option to extract)
AE Live View Histogram Info     : (Binary data 4096 bytes, use -b option to extract)
AE Live View Local Histogram    : (Binary data 2048 bytes, use -b option to extract)
AWB Debug Info                  : (Binary data 4096 bytes, use -b option to extract)
AF Debug Info                   : (Binary data 256 bytes, use -b option to extract)
Histogram                       : disable,
Xidiri                          : (Binary data 512 bytes, use -b option to extract)
Gimbal Degree                   : 1341,-710,0
Flight Degree                   : 1315,-10,9
ADJ Debug Info                  : (Binary data 1024 bytes, use -b option to extract)
Sensor ID                       : 0K8TF6U0025620
Flight Speed                    : 0,0,0
Hyperlaps Debug Info            : (Binary data 8 bytes, use -b option to extract)
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 5472
Exif Image Height               : 3648
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
File Source                     : Digital Camera
Scene Type                      : Directly photographed
Exposure Mode                   : Auto
White Balance                   : Auto
Digital Zoom Ratio              : 1
Focal Length In 35mm Format     : 28 mm
Scene Capture Type              : Standard
Gain Control                    : None
Contrast                        : Normal
Saturation                      : Normal
Sharpness                       : Normal
Device Setting Description      : (Binary data 4 bytes, use -b option to extract)
Serial Number                   : 0K8TF6U0025620
Lens Info                       : 28mm f/2.8-11
GPS Version ID                  : 2.3.0.0
GPS Latitude Ref                : North
GPS Latitude                    : 37 deg 58' 3.19"
GPS Longitude Ref               : East
GPS Longitude                   : 41 deg 19' 59.86"
GPS Altitude Ref                : Above Sea Level
GPS Altitude                    : 606 m
XP Comment                      : 0.9.142
XP Keywords                     : single
Image Width                     : 160
Image Height                    : 112
Compression                     : JPEG
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Thumbnail Offset                : 21142
Thumbnail Length                : 22298
Modify Date                     : 1970:01:01
Create Date                     : 1970:01:01
Make                            : DJI
Camera Model Name               : Test_Pro
Format                          : image/jpg
GPS Latitude                    : 37 deg 58' 3.19" N
GPS Longitude                   : 41 deg 19' 59.86" E
Absolute Altitude               : +606.02
Relative Altitude               : +13.20
Gimbal Roll Degree              : +0.00
Gimbal Yaw Degree               : +134.10
Gimbal Pitch Degree             : -71.00
Flight Roll Degree              : +0.90
Flight Yaw Degree               : +131.50
Flight Pitch Degree             : -1.00
Cam Reverse                     : 0
Gimbal Reverse                  : 0
Self Data                       : Self data
Version                         : 7.0
Has Settings                    : False
Has Crop                        : False
MPF Version                     : 0100
Number Of Images                : 2
MP Image Flags                  : Representative image, Dependent parent image
MP Image Format                 : JPEG
MP Image Type                   : Baseline MP Primary Image
MP Image Length                 : 8332922
MP Image Start                  : 0
Dependent Image 1 Entry Number  : 0
Dependent Image 2 Entry Number  : 2
MP Image Flags                  : Dependent child image
MP Image Format                 : JPEG
MP Image Type                   : Large Thumbnail (VGA equivalent)
MP Image Length                 : 653668
MP Image Start                  : 8341114
Dependent Image 1 Entry Number  : 0
Dependent Image 2 Entry Number  : 0
Image UID List                  : (Binary data 66 bytes, use -b option to extract)
Total Frames                    : 1
Image Width                     : 5472
Image Height                    : 3648
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Aperture                        : 2.8
Image Size                      : 5472x3648
Megapixels                      : 20.0
Scale Factor To 35 mm Equivalent: 2.7
Shutter Speed                   : 1/30
Thumbnail Image                 : (Binary data 22298 bytes, use -b option to extract)
GPS Altitude                    : 606 m Above Sea Level
GPS Latitude                    : 37 deg 58' 3.19" N
GPS Longitude                   : 41 deg 19' 59.86" E
Preview Image                   : (Binary data 653668 bytes, use -b option to extract)
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Image Width                     : 960
Image Height                    : 640
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Circle Of Confusion             : 0.011 mm
Field Of View                   : 65.5 deg
Focal Length                    : 10.3 mm (35 mm equivalent: 28.0 mm)
GPS Position                    : 37 deg 58' 3.19" N, 41 deg 19' 59.86" E
Hyperfocal Distance             : 3.41 m
Light Value                     : 7.6
``````
• Maybe your compass angle is magnetic north and not true north?
– GBG
Commented Jul 12, 2023 at 15:39
• @GBG Thank you for the response. How can I know whether it is magnetic or true ? I calculated declination by this website and it says there is 11.83 difference. However, I always se.e there is +5 or -5 offset. Note: I do not have so much knowledge about gis
– Piko
Commented Jul 13, 2023 at 8:49
• I see here that there will be an EXIF tag denoting whether the bearing value is true or magnetic north: exiftool.org/TagNames/GPS.html. Also, EXIFTool is an easy way to view those EXIF tags. One other thought to consider. I have a DJI Mini 3 Pro and the angle is 11 degrees west of true north so something might be amiss with your drone's sensors. This is easy to test as you could align your camera with (the appropriate) north line, snap a picture, and check the EXIF.
– GBG
Commented Jul 13, 2023 at 15:56
• @GBG I added exif data to post as well. However, I do not see any information about magnetic or true north.
– Piko
Commented Jul 14, 2023 at 5:52
• +-5 degrees? Maybe the precision of your compass is not sufficient for this task? Best to run the tests mentioned above and report back your findings.
– GBG
Commented Jul 18, 2023 at 14:49