while creating depth map I got an error that says “AttributeError: module ‘cv2’ has no attribute ‘createStereoBM'” for the following python code snippet.

import numpy as np
import cv2
left = cv2.imread('images/left.jpg',0)
right = cv2.imread('images/right.jpg',0)
stereo = cv2.createStereoBM(numDisparities=16, blockSize=15)
disparity = stereo.compute(left_image,right_image)

on line number 5.

can anyone here debug it?

Selected answer as best