# Disparity for both left and right image, is it possible?

Hello,

I have a stereo pair and I would like to find the disparity map of the left image, then the disparity map of the right image and see the difference of these two disparity maps. Now, I know that in order to compute disparity (e.g. with Block Matching) I run:

```
bm->compute(img1, img2, disp).
```

Therefore, If I wish to find the disparity of the left image I should run:

```
bm->compute(imgL, imgR, disp).
```

and for the disparity of the right image:

```
bm->compute(imgR, imgL, disp).
```

That is, I just changed the order of the arguments. Is it the correct way to do it? The disparity of the right image seems really poor quality in comparison with the one of the left image. Is there any other way to find the disparity difference between these two disparity maps (i.e. left and right image disparity maps)?

Look for Left-Right Consistency Check. There should be some stereo methods / implementations that already have it.

The Left-Right Consistency Check is performed by openCV function validateDisparity(), and is used as a filter in both BM and SGBM algorithms. That is, it just returns the filtered disparity map not the difference between the left and right disparity maps. It also takes as input the left disparity map and the matrix "cost" computed by the stereo correspondence algorithm.

It is more like a pseudo LR consistency check.

When searching the corresponding pixel in the right image, its x-position should be >= x-position in the left image.

When searching the corresponding pixel in the left image, its x-position should <= x-position in the right image.

This should explain why switching the argument gives poor results.