code: def get_disparity(self, pair):
          
          gray = []
          if pair[0].ndim == 3:
              for side in pair:
                  gray.append(cv2.cvtColor(side, cv2.COLOR_BGR2GRAY))
          else:
              gray = pair
          return self._block_matcher.compute(gray[0], gray[1],
                                            disptype=cv2.CV_32F)
docs: Compute disparity from image pair (left, right).
  
          First, convert images to grayscale if needed. Then pass to the
          ``_block_matcher`` for stereo matching.