Skip to content

Conversation

@0AnshuAditya0
Copy link

Summary

Fixes issue where cv::cuda::resize fails with error "invalid argument in function 'createTextureObject'" when using GpuMat created via cv::cuda::createContinuous().

Root Cause

  • CUDA texture objects require properly aligned pitch values
  • createContinuous() GpuMat may have pitch that doesn't meet alignment requirements
  • Previous code only handled single row/column cases, not invalid pitch

Changes

  • texture.hpp: Added validation to check if step/pitch meets CUDA requirements
  • test_resize.cpp: Added regression test ResizeContinuous that verifies:
    • Regular GpuMat works (baseline)
    • Continuous GpuMat works (previously failed)
    • Both produce identical results

Testing

  • Test covers multiple sizes (10x10, 64x64, 128x128)
  • Multiple data types (CV_8UC1, CV_8UC3, CV_32FC1)
  • Multiple interpolation methods (NEAREST, LINEAR, CUBIC)

Fixes opencv/opencv#28407

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

@0AnshuAditya0 0AnshuAditya0 force-pushed the fix-cuda-resize-continuous-28407 branch from 8c0d111 to bf1fde3 Compare February 1, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cv::cuda::resize failed with Continuous GpuMat

1 participant