Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Understanding OpenCV Stereobm implementation

Hello all,

I'm trying to understand the StereoBM implementation in CPU and GPU.
I started with the CPU on https://github.com/opencv/opencv/blob/master/modules/calib3d/src/stereobm.cpp.

I have some basic knowledge on how a Stereo Block Matching works.

I was able to get into the flow but had some hiccups when hit the line 1204 which initialized an integer bufSize0 which then added with further values in the upcoming lines.

    int bufSize0 = (int)((ndisp + 2)*sizeof(int));
    bufSize0 += (int)((height+wsz+2)*ndisp*sizeof(int));
    bufSize0 += (int)((height + wsz + 2)*sizeof(int));
    bufSize0 += (int)((height+wsz+2)*ndisp*(wsz+2)*sizeof(uchar) + 256);

It would be great if someone can help me out in understanding in what basis these buffer size calculations are done and what it is used for.