# Get disparity value from specifi pixel

**URL:** <https://forum.opencv.org/t/get-disparity-value-from-specifi-pixel/5404>\
**Category:** Python\
**Tags:** stereo, core\
**Created:** [September 29, 2021, 12:06pm UTC](https://forum.opencv.org/t/get-disparity-value-from-specifi-pixel/5404 "2021-09-29T12:06:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/simon/32/3316_2.png) [@simon](https://forum.opencv.org/u/simon)\
**Post date:** [September 29, 2021, 12:06pm UTC](https://forum.opencv.org/t/get-disparity-value-from-specifi-pixel/5404/1 "2021-09-29T12:06:07Z")

</div>

Hi all,  
I’am working with t265 camera and this example [here](https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/examples/t265_stereo.py)  
So I get a depth image and disparity

```auto
# compute the disparity on the center of the frames and convert it to a pixel disparity (divide by DISP_SCALE=16)
disparity = stereo.compute(center_undistorted["left"],center_undistorted["right"]).astye(np.float32) / 16.0

 # re-crop just the valid part of the disparity
 disparity = disparity[:,max_disp:]

```

So I know if I want to compute the real distance I need to do this math

```auto
Depth = (focal length * distance between cameras) / (disparity value)

```

But for now I don’t know how I can get a specifi disparity value of a pixel for example how to get disparity value of pixel 150,150 (this pixel is the pixel at the center of my image)?

---

<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:** [September 29, 2021, 12:50pm UTC](https://forum.opencv.org/t/get-disparity-value-from-specifi-pixel/5404/2 "2021-09-29T12:50:00Z")

</div>

it works like with any other numpy array:

```
value = disparity[y,x]
```

---

<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:** [September 29, 2021, 1:58pm UTC](https://forum.opencv.org/t/get-disparity-value-from-specifi-pixel/5404/3 "2021-09-29T13:58:37Z")

</div>

related:

> <https://stackoverflow.com/questions/69372491/opencv-with-intel-t265-depth>
