Fix OPK computation for oblique/rotated camera orientations and prefer gimbal yaw for DJI #1974
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.