Issues with Building OpenCV 4.10.0 (Master Branch) with Vulkan and Python 3.12 on Windows

Hello OpenCV Community,

I am currently working on building OpenCV 4.10.0 from the master branch on GitHub. My goal is to enable GPU acceleration using Vulkan and integrate Python 3.12 bindings for image processing tasks. Here is my setup and process:

System Details:

  • OS: Windows 10
  • GPU: AMD RX 6700XT
  • CMake Version: 3.31.0
  • Compiler: Visual Studio 2022
  • Vulkan SDK: 1.3.296.0 (configured in environment variables)
  • Python: 3.12.0 (bindings required)

Build Configuration:

  1. Cloned OpenCV and opencv_contrib from the master branch on GitHub.
  2. Used the following CMake settings:
  • Enabled WITH_VULKAN.
  • Set PYTHON3_EXECUTABLE, PYTHON3_INCLUDE_DIR, PYTHON3_LIBRARY, and PYTHON3_PACKAGES_PATH for Python 3.12.
  • Configured Vulkan paths (VULKAN_SDK, Bin, Lib, and Include).
  1. Built OpenCV in Release mode using Visual Studio 2022.

Python Use Case:

The primary goal is to perform image similarity and feature matching tasks in Python, leveraging GPU acceleration for large-scale workloads:

  • Splitting collages into individual design regions.
  • Matching these regions with a dataset of images using ORB descriptors and BFMatcher.
  • GPU acceleration via Vulkan for faster processing.

Issues Encountered:

  1. After successfully building OpenCV, Python bindings (cv2) load but are missing critical functionality:
  • cv2.haveVulkan() raises AttributeError: module 'cv2' has no attribute 'haveVulkan'.
  • cv2.dnn.getAvailableBackends() raises AttributeError: module 'cv2' has no attribute 'dnn'.
  1. Vulkan backend doesn’t appear to be functional, despite enabling it in CMake and verifying that Vulkan SDK is properly installed and added to the environment variables.
  2. For Windows, I am wondering if there are better alternatives to Vulkan for GPU acceleration, such as OpenCL or CUDA (although CUDA isn’t an option for AMD GPUs).

Questions:

  1. Should I switch to the latest release version of OpenCV (e.g., 4.10.0 Latest) instead of building from the master branch? Would this resolve the missing Vulkan and DNN functionality in Python?
  2. Are there any known issues with Vulkan support on AMD GPUs (RX 6700XT) or with Python 3.12?
  3. What could be causing the cv2 module to partially load (i.e., without critical attributes like haveVulkan and dnn)?
  4. On Windows, is there a better alternative to Vulkan for GPU acceleration when using AMD GPUs, or should I continue troubleshooting Vulkan?

Any advice or insights on these issues would be greatly appreciated. Thank you in advance!