0

I am trying to create a Disparity Map for rectified stereo images using OpenCV

import numpy as np
import cv2
from matplotlib import pyplot as plt

imgL = cv2.imread('C:/Users/Praveen/Pictures/im2.png',0)
imgR = cv2.imread('C:/Users/Praveen/Pictures/im6.png',0)

stereo = cv2.StereoBM(cv2.STEREO_BM_BASIC_PRESET,ndisparities=16, SADWindowSize=15)
disparity = stereo.compute(imgL,imgR)
plt.imshow(disparity,'gray')
plt.show()

However, how do I change the disparity using a scale factor 4 for gray levels 1 .. 255, while gray level 0 means unknown

Therefore, the encoded disparity range is 0.25 .. 63.75 pixels

Kindly explain.

Praveen
  • 174
  • 15
  • 1
    Unclear to me, could you elaborate ? – kebs Nov 20 '16 at 20:56
  • 1
    Not clear. Disparity value is the separation between pixels, Scaling down the range of intensity values will not directly scale down the disparity value since it is shift in pixels not intensity value. – Optimus 1072 Nov 21 '16 at 05:27

0 Answers0