Skip to content

Fix OPK computation for oblique/rotated camera orientations and prefer gimbal yaw for DJI#1974

Open
thadwald wants to merge 1 commit intoOpenDroneMap:masterfrom
thadwald:fix/opk-oblique-gimbal-yaw
Open

Fix OPK computation for oblique/rotated camera orientations and prefer gimbal yaw for DJI#1974
thadwald wants to merge 1 commit intoOpenDroneMap:masterfrom
thadwald:fix/opk-oblique-gimbal-yaw

Conversation

@thadwald
Copy link

@thadwald thadwald commented Jan 3, 2026

This PR improves camera orientation handling for DJI drones with oblique or non-standard camera mounts.

When parsing XMP values, Xmp.DJI.GimbalYawDegree (world-referenced) is preferred over Xmp.DJI.FlightYawDegree when available
Flight yaw reflects aircraft heading; gimbal yaw reflects actual camera pointing direction
Critical for flights where the gimbal is rotated independently of aircraft heading

The change also refactors OPK rotation matrix to include camera roll

The refactored cbb reduces to the original [[0,1,0],[1,0,0],[0,0,-1]] when roll=0, so behavior is unchanged for standard configurations.

Tested with DJI M3E and Zenmuse X5S oblique imagery and standard nadir datasets. Nadir datasets produce identical results to the original implementation. Oblique datasets work fine.

Also tested with Sheffield park 1 and Güterweg Ritzing - Helenenschacht datasets. Gimbal positions look correct, and model solves correctly with OpenSFM Algorithm set to triangulation.

…tor YPR rotation matrix for camera orientation
@YanNoun
Copy link

YanNoun commented Feb 4, 2026

Does it work with the dataset mentioned in this issue mapillary/OpenSfM#1098 ? This one has 180 roll images so there’s a 180-roll check + axis flip to perform to make it work.

@thadwald
Copy link
Author

thadwald commented Feb 4, 2026

I have ported your commit to opensfm, to the compute_OPK function of ODM:

YanNoun/OpenSfM@dd18fe7

It produces identical (correct) results as my fix on my branch does with DJI M3E data, including with the 180-roll images.

I suggest that if you keep the compute_OPK function in ODM then just copy your opensfm one instead of using mine. It's much cleaner.

@thadwald
Copy link
Author

thadwald commented Feb 5, 2026

Does it work with the dataset mentioned in this issue mapillary/OpenSfM#1098 ? This one has 180 roll images so there’s a 180-roll check + axis flip to perform to make it work.

I have also tested your new OPK procedure on the dataset mentioned. It works fine.

@thadwald
Copy link
Author

thadwald commented Feb 5, 2026

To straighten up some potential confusion/miscommunication:
This PR needs to be removed because while It fixes the 180º DJI issue , it fails to address the issue with NED frame Z axis somehow being incorrectly aligned with ECEF Z, which causes angle errors that only emerge off-nadir.

Would it be any help if I submitted a PR that merges your changes to the OPK calculation from openSFM?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants