Depth Map from Stereo-Imaging and Single Camera

asked 2018-11-23 08:51:23 -0600

Raki gravatar image

updated 2018-11-27 02:27:10 -0600

Hi all,

I'm going to try to imitate stereo-imaging by having 1 camera (I am using a camera with 4K res) fixed, and moving the object 0.8 cm left/right (baseline) and taking two pictures later on feeding them into:

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

imgL = cv2.imread('left.png',0)
imgR = cv2.imread('right.png',0)

stereo = cv2.StereoBM_create(numDisparities=16, blockSize=15)
disparity = stereo.compute(imgL,imgR)
plt.imshow(disparity,'gray')
plt.show()

However, my output looks a bit wierd.

image description

Is this because the difference between my images was too little (0.8 cm)?

Thanks in advance.

edit retag flag offensive close merge delete