According to https://github.com/balcilar/DenseDepthMap/blob/3589873ce2d9426302ba900e51f9568132ff9bb1/dense_depth_map.m, the snippet here:
|
KmY[i,j] = mY[i : (m - ng + i), j : (n - ng + j)] - grid - 1 +i |
should be KmY[i,j] = mY[i : (m - ng + i), j : (n - ng + j)] - grid - 1 + j