Greetings to everyone who has taken the time to read through my post. I am hopeful that not only will this post be beneficial for me, but also for others who may come across it!
A Brief Overview
Currently, my focus is on a project involving point clouds created using photogrammetry techniques. These point clouds are a combination of photos and laser scans, generated using Reality Capture software. Apart from exporting the point cloud, one can also export "Internal/External camera parameters," which allows for retrieving the specific photos used to create a particular 3D point in the point cloud. Since Reality Capture lacks comprehensive online documentation, I have also reached out on their forum regarding camera variables. Perhaps this information could help resolve the current issue at hand?
For now, only a selected few variables listed in the camera parameters file are pertinent in referencing camera positioning, such as filename, x, y, altitude for location, heading, pitch, and roll for rotation.
https://i.sstatic.net/WxKxj.png
The generated point cloud is currently being loaded into a browser-compatible THREE.JS viewer, followed by loading the camera parameters .csv file. For each known photo, a 'PerspectiveCamera' is instantiated with a green cube representing it. An example is illustrated below:
https://i.sstatic.net/eaQcM.png
The Challenge Ahead
As you might have deduced from the preceding image (or perhaps the title of this post), the orientation of the cameras is all wrong. To visually showcase this discrepancy, I have crudely depicted vectors indicating the correct direction (marked in red) and the current orientation (in green).
https://i.sstatic.net/NiLo1.png https://i.sstatic.net/8KWSr.png
Row 37, 'DJI_0176.jpg,' represents the furthest right camera with a red reference line; row 38 corresponds to DJI_0177.jpg, and so forth. The last image (Row 48, DJI_189.jpg) aligns with the leftmost image within the clustered images.
Upon copying the data provided below into an Excel sheet, the display should present accurately ^^
#name x y alt heading pitch roll f px py k1 k2 k3 k4 t1 t2
DJI_0174.JPG ...
...
...
DJI_0189.JPG ...
Exploration Thus Far
An interesting discovery was made that the exported model appeared mirrored from reality; however, this mirroring did not impact the placement of the camera references, as they aligned perfectly. Attempts were made to mirror the referenced cameras, point cloud, and viewport camera, yet this did not rectify the ongoing issue (hence, the usage of 'camera.applyMatrix4(new THREE.Matrix4().makeScale(-1, 1, 1));').
Thus far, we have experimented with loading Euler angles, setting angles directly, or converting and applying Quaternions, unfortunately without yielding satisfactory results. The camera reference file is parsed utilizing the following logic:
// Code snippet showcasing parsing of CSV file
...
Below, the code snippet demonstrates the instantiation of a camera along with its position and rotation. Comments have been included elaborating on the process, while some commented-out lines reveal additional attempted strategies:
private createCamera(fileName: string, xPos: number, yPos: number, zPos: number, xDeg: number, yDeg: number, zDeg: number, f: number, isRadianFormat = false) : void {
// Camera creation function
...
...
}
The cameras generated above are then processed by the subsequent piece of code, passing them to the camera manager and rendering a CameraHelper (depicted in both 3D viewer images). This section operates within an async function awaiting the loading of the CSV file before initializing the cameras.
private initializeCameraPoses(url: string, csvLoader: CSVLoader) {
// Initializing camera poses function
...
...
}
Marquizzo's Intervention
The modified code snippet provided by Marquizzo appears to bring us closer to a solution. The cameras now seem properly oriented, although there seems to be a slight discrepancy in the pitch. I will include an image of DJI_0189.jpg below for reference. Please note that, for this example, the FOV is not set, as rendering a camera helper for every camera position may appear cluttered. Only the DJI_0189 camera helper is rendered for demonstration purposes.
https://i.sstatic.net/dU7ww.jpg
Incorporating the adjustment recommended by Marquizzo to invert the pitch (
const rotX = deg2rad(photo.pitch * -1);
) resulted in the intersection point appearing slightly lower than expected:
https://i.sstatic.net/GxCah.png
When adjusting the pitch to
const rotX = deg2rad(photo.pitch * -.5);
, the midpoint intersection closely resembles that of the source image:
https://i.sstatic.net/8F8QB.png
I strongly believe that a resolution is within our grasp and that it may ultimately boil down to overlooking a small detail. I eagerly anticipate any feedback and assistance offered. Feel free to seek further details if anything remains unclear. Thank you for delving into this post!