How to build Depthmap with python using stereoSGBM?

well, IF you use a VideoCapture, make sure you have proper error handling

should have been:

ok, imgL = CamL.read()`
if (not ok):
     print("no image !")
     break