This a repo for compiled OpenCV Python Lib with CUDA and cuDNN for Windows 10.
Please check your system and need with following version info:
- Windows 10 V1909
- OpenCV 4.3.0
- Python 3.8.2
- CUDA 10.2
- cuDNN 7.5
Follow these steps if you want to use the lib directly:
- Install Python 3.8, CUDA 10.2 and cuDNN 7.5 via the official website. VS integration option for CUDA isn't necessary here.
- Install numpy and opencv-python via pip.
- Replace the {Your Python Installation Path}\Lib\site-packages\cv2 with the cv2 of this repo.
- Run test.py and check the opencv version in the console.
Your python installation path may be C:\Users\{Your_User}\AppData\Local\Programs\Python\Python38 for Windows.
Follow these steps if you want to compile the library by yourself:
- You are using Windows 10.
- Install Python 3.8, CMake 3.17.1, Visual Studio 2019 Community, CUDA 10.2 and cuDNN 7.5 via the official website.
- Install numpy via pip.
- Download the source code of OpenCV 4.3.0 via GitHub.
- Run the CMake, indicate the folder of OpenCV source code and the target folder you want to place the built code.
- Trigger the configure for the first time.
- Check the options in the list. Make sure you have checked these options.
- Configure again. Check the errors and fix them. Some downloading for ffmpeg or other lib from GitHub may be blocked by GFW. You need to download them manually and replace the cache in /.cache in the target folder. You may use this (website)[https://d.serctl.com/?dl_start] to help you.
- When you clear all errors, you could generate the project.
- Click the open project to jump to VS or you could manually open the project from target folder.
- Set the env as release on the top toolbar.
- Right click the ALL_BUILD in the right tree and start the generation. It may take 30~60 minutes here.
- Right click the INSTALL in the right tree and start the generation. It may take 10 minutes here if you choose to build with all dependency.
- The python lib will be created automatically after the code installation in VS. You could run the test.py and check the opencv version in the console now.
Refer to https://blog.csdn.net/hitpisces/article/details/104266030