# Stereo calibration: problem with projection matrices and SGBM

I am trying to create a depth map from a disparity using SGBM. The resulting disparity map has almost no definition. So I set up sliders for the various SGBM values and can get very limited results - they are basically blank.

After calibrating the cameras individually followed by the stereo calibration I can rectify images which comes out rather well:

Something I've noticed is the projection matrices and the Q matrix have several NAN values. Also the ROI for each camera is all zeros which can['t be right. Below are the saved calibration setting that I am using showing the NAN values.

Since the RMS values for each single camera calibration are under 0.4 and the stereo RMS is less than 2.0 with a re-projection error of less then 4.0 I'm not sure what may be wrong at this point. Suggestions and help would be greatly appreciated.

Camera_0_Matrix

8.2360702625110662e+002 0. 3.1410424020211406e+002

0. 8.1860608380736392e+002 2.4384904263053622e+002

0. 0. 1.

Camera_1_Matrix

8.1134698384868875e+002 0. 3.1328331721626449e+002

0. 8.0724997468627953e+002 2.3930244099756220e+002

0. 0. 1.

Camera_0_Distortion_Coefficients

2.6712887348238189e-002 -1.8664642728347297e-001

-4.8596016262543446e-004 -1.4728080493686517e-003

5.2687479496305778e-001 0. 0. 0.

Camera_1_Distortion_Coefficients

3.9590803660099684e-002 -1.8981006469293660e-001

-6.4688587632222173e-003 -3.7797348771147284e-003

2.7996253215102412e-001 0. 0. 0.

Mat_R

9.9922618707330479e-001 -1.4827571495127988e-002 -3.6430347109269276e-002

1.4533977386417006e-002 9.9985983789215160e-001 -8.3107202823446188e-003

3.6548468754191266e-002 7.7748114984945516e-003 9.9930163701351293e-001

Mat_T

-7.1373089613768613e+001 -6.5822496464438818e-001 -6.3515467302110000e+000

Mat_E

6.8256121992123484e-002 6.3455389090094831e+000 -7.1055121292732304e-001

-3.7380546856077390e+000 6.4909033105906033e-001 7.1554634341813454e+001

-3.7961924878715458e-001 -7.1372845688807843e+001 5.6918241952876536e-001

Mat_F

7.2342254670288030e-008 6.7664989166222400e-006 -2.2929759854297700e-003

-3.9819395869095442e-006 6.9566352175857590e-007 6.3859013286650543e-002

6.0378280400693674e-004 -6.4036046720140641e-002 1.

Camera_0_Rotation_Matrix

9.9862396895832117e-001 -4.8951125057362125e-003 5.2213087396614198e-002

5.1174999253298069e-003 9.9997839183290060e-001 -4.1263860459532032e-003

-5.2191760043559916e-002 4.3879084815174659e-003 9.9862744126261294e-001

Camera_1_Rotation_Matrix

9.9602166255538394e-001 9.1856234214931377e-003 8.8636742058627288e-002

-9.5633854847882640e-003 9.9994690362209304e-001 3.8381759545177280e-003

-8.8596779729730887e-002 -4.6705737278212095e-003 9.9605662307048315e-001

Camera_0_Projection_Matrix

.Nan 0. .Nan 0.

0. .Nan .Nan 0.

0. 0. 1. 0.

Camera_1_Projection_Matrix

.Nan 0. .Nan .Nan

0. .Nan .Nan 0.

0. 0. 1. 0.

Mat_Q

1. 0. 0. .Nan

0. 1. 0. .Nan

0. 0. 0. .Nan

0. 0. 1.3955142868906164e-002 .Nan

ROI_0

0 0 0 0

ROI_1

0 0 0 0