Implementation: CUDA support in the pre-built binaries of OpenCV

Dear OpenCV Development Team,

I am upset and have much dissatisfaction regarding the absence of CUDA support in the pre-built binaries of OpenCV available through pip.

As a user who relies heavily on GPU acceleration for computational tasks, the lack of CUDA support in the standard opencv-python and opencv-python-headless packages is a significant limitation. CUDA support is crucial for optimizing performance in many applications, especially in the field of computer vision and deep learning.

While I understand that CUDA is an optional feature and building OpenCV with CUDA support from source is possible, this process is complex and time-consuming. Many users, including myself, would greatly benefit from having CUDA support available in the pre-built binaries to streamline the installation process and leverage GPU acceleration efficiently.

I kindly request that the OpenCV team consider providing pre-built binaries with CUDA support included by default. This enhancement would significantly improve the accessibility and performance of OpenCV for users who rely on GPU acceleration for their projects.

Additional context

Proposed Solution:

Build System Integration:

Update Build Scripts: Modify the build scripts used for creating OpenCV binaries to include options for CUDA support. This involves configuring CMake to enable CUDA-related features during the build process.
Use Continuous Integration (CI): Incorporate CUDA support into the CI pipeline to ensure that CUDA-enabled binaries are built and tested regularly. Platforms like GitHub Actions, GitLab CI, or Jenkins can be configured to handle CUDA builds.
Binary Distribution:

Pre-built Binaries: Provide CUDA-enabled binaries through pip. This could be achieved by creating separate packages or adding CUDA support as an optional feature within the existing package.
Package Naming Convention: Use a clear naming convention for CUDA-enabled packages, such as opencv-python-cuda, to differentiate them from the standard binaries.
Documentation and Support:

Update Documentation: Clearly document the availability of CUDA-enabled binaries, including installation instructions, compatibility details, and usage guidelines.
Provide Support: Offer support channels or forums where users can seek assistance related to CUDA support in OpenCV. This can help address any issues or questions that arise.
Community and User Feedback:

Gather Feedback: Engage with the OpenCV user community to gather feedback on the CUDA support implementation. This can be done through surveys, forums, or GitHub issues.
Iterate Based on Feedback: Continuously improve the CUDA support based on user feedback and performance metrics.
By adopting these measures, OpenCV can provide a more robust solution for users who require GPU acceleration, thereby enhancing the overall user experience and broadening the applicability of OpenCV in high-performance computing scenarios.

Thank you for considering this proposal. I look forward to your feedback and the possibility of seeing CUDA support included in future OpenCV releases.

This may be a possibility with OpenCV 5.0 however CUDA is currently very low priority and was moved from the main to the contrib repo years ago because of this. For the record I’m not saying I agree with that decision which even at the time before the AI boom seemed questionable.

Wouldn’t there need to be a different build for each version of cuDNN?

Why not raise this as an issue on Github and see what feedback you get.

nobody wanted to actually maintain the legacy CUDA modules (that now live in contrib). NVIDIA certainly didn’t feel the need… and Intel, who are running OpenCV, weren’t going to spend money on that either. keeping those in the build got to be a chore.

so far, nothing has happened with those modules. I think nothing will happen with those modules. you would have to maintain those modules and produce builds of them… and keep at it, not just a one-off effort.

I would bet against seeing official builds that include the currently unmaintained legacy CUDA modules. I would also bet against seeing appreciable maintenance efforts of those modules, or interest/use.

it is a bit sad CUDA modules are dying slowly.

From my experience, CUDA is not really a must have with OpenCV. It can brings things but i never saw something really significant.

It will be more interesting to replace Numpy with Cupy in OpenCV. Cupy is really great and bring some real improvements (i mean speed improvements).