c++ - opencv sgbm custom min max disparity per pixel -


i want use sgbm compute disparity rather setting global parameters of min , max disparity want have values per pixel (so each pixel have own range search). know sgbm opencv not support have change source code bit. not quite details of implementation, know use dynamic programming solve it.

for( int d = mind; d < maxd; d++ )             {                 int v = prow2[width-x-1 + d];                 int v0 = buffer[width-x-1 + d];                 int v1 = buffer[width-x-1 + d + width2];                 int c0 = std::max(0, u - v1); c0 = std::max(c0, v0 - u);                 int c1 = std::max(0, v - u1); c1 = std::max(c1, u0 - v);                  cost[x*d + d] = (costtype)(cost[x*d+d] + (std::min(c0, c1) >> diff_scale));             } 

this code sample source.cpp https://github.com/itseez/opencv/blob/master/modules/calib3d/src/stereosgbm.cpp between lines 240 , 250. enough change mind , maxd here values current pixel x. not sure if mess calculations. if has experience source code appreciate help.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -