# Removing translation from 2 cameras facing the same direction

**URL:** <https://forum.opencv.org/t/removing-translation-from-2-cameras-facing-the-same-direction/336>\
**Category:** Uncategorized\
**Created:** [December 15, 2020, 2:46pm UTC](https://forum.opencv.org/t/removing-translation-from-2-cameras-facing-the-same-direction/336 "2020-12-15T14:46:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwertyquest](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/qwertyquest/32/210_2.png) [@qwertyquest](https://forum.opencv.org/u/qwertyquest)\
**Post date:** [December 15, 2020, 2:46pm UTC](https://forum.opencv.org/t/removing-translation-from-2-cameras-facing-the-same-direction/336/1 "2020-12-15T14:46:52Z")

</div>

Hi all,

I have a project for Android with which I take an image from the main camera as well as the “depth camera”. The only problem is that the actual sensors are placed few centimeters away from each other, thus producing a result as seen below

[![enter image description here](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/8/8bc50aca653ae00d0304bcae87f1558bcc4659f9.jpeg)](https://i.stack.imgur.com/DAIn3.jpg)

In order to map each pixel of the depth image to the actual image, I found the following method on android developers forum:

> To transform a pixel coordinates between two cameras facing the same direction, first the source camera **CameraCharacteristics#LENS\_DISTORTION** must be corrected for. Then the source camera **CameraCharacteristics#LENS\_INTRINSIC\_CALIBRATION** needs to be applied, followed by the **CameraCharacteristics#LENS\_POSE\_ROTATION** of the source camera, the translation of the source camera relative to the destination camera, the **CameraCharacteristics#LENS\_POSE\_ROTATION** of the destination camera, and finally the inverse of **CameraCharacteristics#LENS\_INTRINSIC\_CALIBRATION** of the destination camera. This obtains a radial-distortion-free coordinate in the destination camera pixel coordinates.

but I am not quite sure how to approach this with opencv.

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [December 15, 2020, 3:13pm UTC](https://forum.opencv.org/t/removing-translation-from-2-cameras-facing-the-same-direction/336/2 "2020-12-15T15:13:14Z")

</div>

related:

> <https://stackoverflow.com/questions/65294440/put-image-from-depth-sensor-on-top-of-original-image-from-main-camera>
