# Detecting flat surface but not constant depth, pls help

**URL:** <https://forum.opencv.org/t/detecting-flat-surface-but-not-constant-depth-pls-help/1965>\
**Category:** Uncategorized\
**Tags:** calib3d, disparitymap, stereo\
**Created:** [March 5, 2021, 4:27am UTC](https://forum.opencv.org/t/detecting-flat-surface-but-not-constant-depth-pls-help/1965 "2021-03-05T04:27:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bubucar](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@bubucar](https://forum.opencv.org/u/bubucar)\
**Post date:** [March 5, 2021, 4:27am UTC](https://forum.opencv.org/t/detecting-flat-surface-but-not-constant-depth-pls-help/1965/1 "2021-03-05T04:27:10Z")

</div>

Hi, im using stereo vision system to get real world coordinate. i have done the calibration and rectification of stereo images.

however, my present an angle Z and when i get the stereo image, for example a flat pendrive, its surface is not constant depth. How can i get constant depth from tilt camera stereo system?

 ![111](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/4/4a4c1083fd177de90b661221bbb707e86a8a4801.png)

---

<div class="post-metadata">

**Author:** ![kbarni](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/kbarni/32/26_2.png) [@kbarni](https://forum.opencv.org/u/kbarni)\
**Post date:** [March 5, 2021, 2:07pm UTC](https://forum.opencv.org/t/detecting-flat-surface-but-not-constant-depth-pls-help/1965/2 "2021-03-05T14:07:06Z")

</div>

I’m not sure to understand your problem.  
Are you looking for something like [this](https://docs.opencv.org/master/d7/d53/tutorial_py_pose.html)?

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [March 5, 2021, 3:33pm UTC](https://forum.opencv.org/t/detecting-flat-surface-but-not-constant-depth-pls-help/1965/3 "2021-03-05T15:33:28Z")

</div>

please try to keep the angle to the “expected Z-axis” as low as possible.  
the camera rays should meet at an infinite point, not at your “object surface”.  
(maybe you need to reduce the baseline(distance between the cameras) and recalibrate)

if there is a known angle, you could try to edit the depth map using it

---

<div class="post-metadata">

**Author:** ![bubucar](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@bubucar](https://forum.opencv.org/u/bubucar)\
**Post date:** [March 6, 2021, 2:19am UTC](https://forum.opencv.org/t/detecting-flat-surface-but-not-constant-depth-pls-help/1965/4 "2021-03-06T02:19:28Z")

</div>

noo, but thanks!  
my question is my stereo camera on top view of my object with each camera tilt toward each other with an angle, the object is put flat but when it compute to disparity map it shows not constant depth but linear variation

---

<div class="post-metadata">

**Author:** ![bubucar](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@bubucar](https://forum.opencv.org/u/bubucar)\
**Post date:** [March 6, 2021, 2:19am UTC](https://forum.opencv.org/t/detecting-flat-surface-but-not-constant-depth-pls-help/1965/5 "2021-03-06T02:19:54Z")

</div>

aww thanks for suggestion , i will try with reduce the baseline and see

---

<div class="post-metadata">

**Author:** ![bubucar](https://avatars.discourse-cdn.com/v4/letter/b/b5a626/32.png) [@bubucar](https://forum.opencv.org/u/bubucar)\
**Post date:** [March 12, 2021, 9:23am UTC](https://forum.opencv.org/t/detecting-flat-surface-but-not-constant-depth-pls-help/1965/6 "2021-03-12T09:23:26Z")

</div>

reduce baseline didnt help, do you have any other idea??

![dekstop1](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/d/d36956ea2d541d6c3a0312245f1c1b5ddbdb4502.png)

from the color map can see that the object is like tilt abit but its placed on the table, i know its because my stereo camera tilt in angle (converge in each other), how can i make it flat in disparity map?
