I have two images from a stereo snap i.e. left and right. I want to create a depth map of the image out of it. please help with a program using python,c++,c,c# or other programming languages.
I have tried the same using openCV in python, I have pasted the code below
import numpy as np import cv2 #reading two image of same size(dimension) i_left = cv2.imread('image_left.jpg',0) i_right= cv2.imread('image_right.jpg',0) #creating depth map sr = cv2.StereoBM_create(numDisparities=16, blockSize=15) dp= stereo.compute(i_left,i_right) #saving depth map in .jpg file cv2.imwrite("image_left_depth.jpg",dp)
all you need is two images from stereo snap i.e. left image and right image. and correct the file names in the program and click run => done 🙂 🙂 depth map is saved in file name that you provided inside cv2.imwrite().