# Triangulation with world cameras

**URL:** <https://forum.magicleap.cloud/t/triangulation-with-world-cameras/5303>\
**Category:** Unity Development\
**Tags:** pixel-sensor\
**Created:** [March 6, 2025, 4:39pm UTC](https://forum.magicleap.cloud/t/triangulation-with-world-cameras/5303 "2025-03-06T16:39:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tangjq15](https://avatars.discourse-cdn.com/v4/letter/t/a3d4f5/32.png) [@tangjq15](https://forum.magicleap.cloud/u/tangjq15)\
**Post date:** [March 6, 2025, 4:39pm UTC](https://forum.magicleap.cloud/t/triangulation-with-world-cameras/5303/1 "2025-03-06T16:39:11Z")

</div>

I want to use **two world cameras** on Magic Leap 2 to perform **triangulation** and determine the 3D coordinates of a target point in **Unity world space**.

I tried to use the following data:

- **From `PixelSensorFisheyeIntrinsics`** :
  - `FocalLength`(pixel)
  - `PrincipalPoint`(pixel)
  - `RadialDistortion`
  - `TangentialDistortion`

- **From `PixelSensorFeature.GetSensorPose()`**:
  - `position` (Vector3)
  - `rotation` (Quaternion)

I have also used **OpenCV for Unity** to undistort the image and obtained the target point’s pixel coordinates in the undistorted image.

However, I failed to use the above data for triangulation. Is there any **example code or documentation** for performing **triangulation using World Cameras**? I want to know if I’m using the correct parameters.

Thank you very much for your help!

---

<div class="post-metadata">

**Author:** ![kbabilinski](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kbabilinski/32/19_2.png) [@kbabilinski](https://forum.magicleap.cloud/u/kbabilinski)\
**Post date:** [March 6, 2025, 5:35pm UTC](https://forum.magicleap.cloud/t/triangulation-with-world-cameras/5303/2 "2025-03-06T17:35:29Z")

</div>

Have you looked at the following post ?

> [@Undistorting World Camera and Depth Camera Images](https://forum.magicleap.cloud/t/undistorting-world-camera-and-depth-camera-images/3312#world-camera-3):
>
> Undistorting World and Depth Camera Images This post details instructions and examples for undistorting images and points captured by the world and depth cameras in the Magic Leap 2 (ML2) device. It includes the implementation of custom distortion models for the world camera and the use of standard OpenCV models for the depth camera. Table of Contents [World Camera](#world-camera-3)[Distortion Model](#implementation-4)[Undistort Images](#undistortion-of-wcam-images-5)[Undistort Points](#distorting-and-undistorting-of-individual-pixels-6)[Depth Camera](#depth-camera-7)[Undistort Images and Points](#undistort-image-and-points-using-opencv-pinhole-model-8)[Interactive Python Notebook](#interactive-python-notebook-9)Worl…

---

<div class="post-metadata">

**Author:** ![tangjq15](https://avatars.discourse-cdn.com/v4/letter/t/a3d4f5/32.png) [@tangjq15](https://forum.magicleap.cloud/u/tangjq15)\
**Post date:** [March 7, 2025, 10:22am UTC](https://forum.magicleap.cloud/t/triangulation-with-world-cameras/5303/3 "2025-03-07T10:22:47Z")

</div>

Thank you for your reply!

Yes, I successfully obtained the undistorted world camera image by referring to the post you mentioned.

However, I would like to ask whether triangulation can be performed using these undistorted images along with the parameters mentioned above. The reason I ask is that I couldn’t find detailed explanations for some of the parameters.

Specifically:

- Does **`PixelSensorFeature.GetSensorPose()`** return the optical center’s position in Unity’s world coordinate system, along with the optical axis orientation?
- The **PrincipalPoint** values I obtained are around **(508, 508)**, but I am unsure which corner of the image is considered the origin for these coordinates.

Any clarification on these points would be greatly appreciated. Thank you!

---

<div class="post-metadata">

**Author:** ![kbabilinski](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.magicleap.cloud/kbabilinski/32/19_2.png) [@kbabilinski](https://forum.magicleap.cloud/u/kbabilinski)\
**Post date:** [March 7, 2025, 5:34pm UTC](https://forum.magicleap.cloud/t/triangulation-with-world-cameras/5303/4 "2025-03-07T17:34:09Z")

</div>

It’s the same origin as it is in OpenCV. I think that’s bottom left corner? But you would need to double check the opencv documentation to be sure.

You are correct that the get pose function provides the pose from the sensor’s center.

* * *

Unfortunately the topic of triangulating points from multiple images is a little out side of the scope of the forum. But it sounds like you are on the right track, using OpenCV and undistorted images.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/magicleap1/original/1X/bd9b737a4d45ea243aa7eb177d60a773b806899a.svg) [@system](https://forum.magicleap.cloud/u/system)\
**Post date:** [March 21, 2025, 5:34pm UTC](https://forum.magicleap.cloud/t/triangulation-with-world-cameras/5303/5 "2025-03-21T17:34:41Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
