opencv_contrib icon indicating copy to clipboard operation
opencv_contrib copied to clipboard

Subpixel cuda StereoSGM

Open Jerry-Master opened this issue 5 months ago • 0 comments

I would like to suggest exposing the functionality for removing subpixel accuracy in cv::cuda::StereoSGM. It is already implemented in void winnerTakesAll(const GpuMat& src, GpuMat& left, GpuMat& right, float uniqueness, bool subpixel, int mode, cv::cuda::Stream& _stream) but then in the compute function the parameter is always put to true:

switch (params.numDisparities)
    {
    case 64:
        pathAggregation.operator()<64>(censused_left, censused_right, aggregated, params.mode, params.P1, params.P2, params.minDisparity, _stream);
        winner_takes_all::winnerTakesAll<64>(aggregated, left_disp_tmp, right_disp_tmp, (float)(100 - params.uniquenessRatio) / 100, true, params.mode, _stream);
        break;
    case 128:
        pathAggregation.operator()<128>(censused_left, censused_right, aggregated, params.mode, params.P1, params.P2, params.minDisparity, _stream);
        winner_takes_all::winnerTakesAll<128>(aggregated, left_disp_tmp, right_disp_tmp, (float)(100 - params.uniquenessRatio) / 100, true, params.mode, _stream);
        break;
    case 256:
        pathAggregation.operator()<256>(censused_left, censused_right, aggregated, params.mode, params.P1, params.P2, params.minDisparity, _stream);
        winner_takes_all::winnerTakesAll<256>(aggregated, left_disp_tmp, right_disp_tmp, (float)(100 - params.uniquenessRatio) / 100, true, params.mode, _stream);
        break;
    default:
        CV_Error(Error::StsBadArg, "Unsupported num of disparities");
    }

To avoid API changes it could be an option to add an extra setter for a subpixel parameter.

Jerry-Master avatar Jun 16 '25 12:06 Jerry-Master