Skip to content

Conversation

@cudawarped
Copy link
Contributor

@cudawarped cudawarped commented Feb 2, 2022

This aplies the fix identified by @yl070360 in #3163.

The stride information is currently missing inside cuda::LinearFilter::apply() producing incorrect results when GpuMat's are constructed using pointers to pre-allocated device memory.

The current tests should to be sufficient to check this because they are wrongly passing at the moment due to another bug (see below) in the construction of GpuMat's which can be fixed once this is merged.

GpuMat Bug
GpuMat::dataend wrongly points to the last element of an alocated row instead of the last useable element of the ROI unless the GpuMat is constructed from a pointer to pre-allocated device memory.
This means that locateROI(wholeSize,ofs) currently returns the stride in wholeSize instead of the width of the ROI.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders=Custom
buildworker:Custom=linux-4,linux-6
build_image:Custom=ubuntu-cuda:18.04

@alalek
Copy link
Member

alalek commented Feb 2, 2022

Merge branch 'master' of ...

Could you please rebase on upstream/4.x to eliminate unrelated commits? (keep 1 commit in PR)

(where upstream is configured by following this GitHub guide and fetched (git fetch upstream))

(cherry picked from commit 1d207e772285dd2d99eed886c70cb342f0dba8e4)
@opencv-pushbot opencv-pushbot merged commit 6b8d515 into opencv:4.x Feb 4, 2022
@alalek alalek mentioned this pull request Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opencv cuda filter lacks step(stride) information

4 participants