<p>For your question:</p>
<p><a href="https://i.sstatic.net/9mFDR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9mFDR.png" alt="enter image description here" /></a></p>
<p>If the camera model and the scene settings are as simple as what you've stated in the post, I think simple geometry will do. Note that <span class="math-container">$f$</span> is the focal length and <span class="math-container">$p_i$</span> is the projected pixel length for one of the edges of the bounding box. <span class="math-container">$x$</span> is the unknown 3D length of the bounding box, <span class="math-container">$t$</span> is the distance you moved (known) and <span class="math-container">$d$</span> or <span class="math-container">$d-t$</span> is the depth you want.</p>
<hr />
<p>For more generally-purposed depth estimation, I think these are some methods you can try. Since it is easy for you to get the correspondences between images (especially when you have bounding boxes), you can use:</p>
<ul>
<li><p><strong>Triangulation</strong>: two known scene view points (two images) and the pixel coordinates projected by that 3D point. In an ideal situation, two rays from the pixels should intersect on that very 3D point of which the depth you want, but due to noise and discrete quantization (2D images), these two rays won't intersect. Therefore the depth is usually recovered from least-square methods.</p>
</li>
<li><p><strong>PnP</strong> algorithms. You have at least four pairs of points (your bounding box). Using PnP algorithms, you can even recover the 3D position of each points in the camera coordinate frame, so depth won't be a problem.</p>
</li>
</ul>
<p>Even if you don't have bounding boxes, using feature point based pixel correspondence search should get you point pairs you need. For the methods above, you will need:</p>
<ul>
<li>Camera intrinsic matrix (if it is CG generated, this is usually simple and only related to camera focal length).</li>
<li>Viewpoint transforms. As you've said, you know the transforms between different cameras, so this won't be a problem.</li>
<li>Pixel correspondences. For points of which depth is to be calculated, you should know the pixel coordinates for those points in at least two images. This won't be a problem for you.</li>
</ul>

CC BY-SA 4.0
2023-10-25T04:17:02.743Z
2023-10-25T04:17:02.743Z
Enigmatisms
<p><a href="https://i.sstatic.net/BfSOl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BfSOl.png" alt="enter image description here" /></a>how can I estimate the depth of an object with a bound box from just a few images where i moved it?(knowing how much i moved)</p>
<p>For testing purposes I have a cube and a camera perpendicular to it and I need to estimate its z-axis and I only have a few images of it moving backwards or forwards.</p>

CC BY-SA 4.0
2023-10-25T04:16:49.183Z
Do you have the intrinsic parameters of your camera?
Thomas
<3d>
how can I estimate the depth of an object with a bound box from just a few images where i moved it?(knowing how much i moved)
Dare
# how can I estimate the depth of an object with a bound box from just a few images where i moved it?(knowing how much i moved)

(Asked by: username_0 on 2023-10-24)

[![enter image description here](https://i.sstatic.net/BfSOl.png)](https://i.sstatic.net/BfSOl.png)how can I estimate the depth of an object with a bound box from just a few images where i moved it?(knowing how much i moved)

For testing purposes I have a cube and a camera perpendicular to it and I need to estimate its z-axis and I only have a few images of it moving backwards or forwards.

**Tags:** 3d

> **Comments:**
> **username_1**: Do you have the intrinsic parameters of your camera?  

---

## 1 answers

### Answer by username_2 on 2023-10-25. Score: 1 | Accepted answer

For your question:

[![enter image description here](https://i.sstatic.net/9mFDR.png)](https://i.sstatic.net/9mFDR.png)

If the camera model and the scene settings are as simple as what you've stated in the post, I think simple geometry will do. Note that $f$ is the focal length and $p\_i$ is the projected pixel length for one of the edges of the bounding box. $x$ is the unknown 3D length of the bounding box, $t$ is the distance you moved (known) and $d$ or $d-t$ is the depth you want.

---

For more generally-purposed depth estimation, I think these are some methods you can try. Since it is easy for you to get the correspondences between images (especially when you have bounding boxes), you can use:

* **Triangulation**: two known scene view points (two images) and the pixel coordinates projected by that 3D point. In an ideal situation, two rays from the pixels should intersect on that very 3D point of which the depth you want, but due to noise and discrete quantization (2D images), these two rays won't intersect. Therefore the depth is usually recovered from least-square methods.
* **PnP** algorithms. You have at least four pairs of points (your bounding box). Using PnP algorithms, you can even recover the 3D position of each points in the camera coordinate frame, so depth won't be a problem.

Even if you don't have bounding boxes, using feature point based pixel correspondence search should get you point pairs you need. For the methods above, you will need:

* Camera intrinsic matrix (if it is CG generated, this is usually simple and only related to camera focal length).
* Viewpoint transforms. As you've said, you know the transforms between different cameras, so this won't be a problem.
* Pixel correspondences. For points of which depth is to be calculated, you should know the pixel coordinates for those points in at least two images. This won't be a problem for you.


---

