Skip to content

Commit 0726c4d

Browse files
committed
Merge pull request opencv#4190 from sbokov:fixingStereoBMissue
2 parents ae71f0c + e0cea92 commit 0726c4d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

modules/calib3d/src/stereosgbm.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,10 @@ void cv::validateDisparity( InputOutputArray _disp, InputArray _cost, int minDis
11571157
for( x = minX1; x < maxX1; x++ )
11581158
{
11591159
int d = dptr[x], c = cptr[x];
1160+
1161+
if( d == INVALID_DISP_SCALED )
1162+
continue;
1163+
11601164
int x2 = x - ((d + DISP_SCALE/2) >> DISP_SHIFT);
11611165

11621166
if( disp2cost[x2] > c )
@@ -1173,9 +1177,13 @@ void cv::validateDisparity( InputOutputArray _disp, InputArray _cost, int minDis
11731177
for( x = minX1; x < maxX1; x++ )
11741178
{
11751179
int d = dptr[x], c = cptr[x];
1180+
1181+
if( d == INVALID_DISP_SCALED )
1182+
continue;
1183+
11761184
int x2 = x - ((d + DISP_SCALE/2) >> DISP_SHIFT);
11771185

1178-
if( disp2cost[x2] < c )
1186+
if( disp2cost[x2] > c )
11791187
{
11801188
disp2cost[x2] = c;
11811189
disp2buf[x2] = d;

0 commit comments

Comments
 (0)