Skip to content

There's a bug in calcPixelCostBT() in stereosgbm.cpp #15206

@tensorbuffer

Description

@tensorbuffer

Hi,
I traced the code in the function and I think the subpixel calculation is wrong (offset by 1).
Here's the detail:
xrange_min is 0, width is 480, minD is 0, maxX2 is 480.
So line 194 (https://github.com/opencv/opencv/blob/master/modules/calib3d/src/stereosgbm.cpp#L194) width-1-maxX2 is actually -1.
So in line 204, the x in the loop starts at -1. This is fine for 'buffer' since it has adjusted at line 194, but for prow2 this is not right.
For example, the first buffer array (e.g. buffer[-1]) should be min of (prow2[0], prow2[0], (prow2[0]+prow2[1]/2), but it's now the min of (prow2[0], prow2[-1], (prow2[-1]+prow2[0]/2). All the rest is the same thing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions