Understanding OpenCV Stereobm implementation

asked 2018-07-10 14:05:26 -0500

mohanen gravatar image

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....

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.

edit retag flag offensive close merge delete