Skip to content

opencv cuda filter lacks step(stride) information #3163

@yl070360

Description

@yl070360
System information (version)
  • OpenCV => 4.2 - 4.5
  • Operating System / Platform => linux
  • Compiler => gcc/g++
Detailed description
Steps to reproduce
Hi,I found that the processing of GPUMat in filtering.cpp(line:284) lacks step(stride) information, 
And tried the following modifications, it seems to work normally

filtering.cpp
// C++ code example
void LinearFilter::apply(InputArray _src, OutputArray _dst, Stream& _stream)
{
    GpuMat src = _src.getGpuMat();
    ...
    Point ofs;
    Size wholeSize;
    src.locateROI(wholeSize, ofs);

    // GpuMat srcWhole(wholeSize, src.type(), src.datastart);
    // line:284, this is my modifications test
    GpuMat srcWhole(wholeSize, src.type(), src.datastart, src.step);
    

    func_(srcWhole, ofs.x, ofs.y, dst, kernel_.ptr<float>(),
          kernel_.cols, kernel_.rows, anchor_.x, anchor_.y,
          borderMode_, borderVal_.val, StreamAccessor::getStream(_stream));
}
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions