I’m trying to build depth map using StereoBM. Code:
import cv2
import numpy as np
left_image = cv2.imread('im10.jpg', 0)
right_image = cv2.imread('im11.jpg', 0)
left_image2 = cv2.imread('im0.jpg', 0)
right_image2 = cv2.imread('im1.jpg', 0)
left_image = cv2.resize(left_image, (800, 600))
right_image = cv2.resize(right_image, (800, 600))
left_image2 = cv2.resize(left_image2, (800, 600))
right_image2 = cv2.resize(right_image2, (800, 600))
stereoBM = cv2.StereoBM_create(0, 7)
disparity_map = stereoBM.compute(left_image, right_image).astype(np.float32)
disparity_map2 = stereoBM.compute(left_image2, right_image2).astype(np.float32)
disparity_map = cv2.normalize(disparity_map, 0, 255, cv2.NORM_MINMAX)
disparity_map2 = cv2.normalize(disparity_map2, 0, 255, cv2.NORM_MINMAX)
cv2.imshow('disparity', disparity_map)
cv2.imshow('disparity2', disparity_map2)
cv2.waitKey()
disparity_map - depth map for images from internet
disparity_map2 - depth map for my images
(downloaded image at left side, my images at right side)
I use 2 wide angle IR cameras. For calibration i using this guide -https://stereopi.com/blog/opencv-and-depth-map-stereopi-tutorial
Why my map is so bad? What resolution should the image have?
Sry for my bad english