EnoxSoftware / OpenCVForUnity

OpenCV for Unity (Untiy Asset Plugin)
https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088
550 stars 172 forks source link

GPU Cuda support Windows #179

Closed wimvanhenden-tool closed 6 months ago

wimvanhenden-tool commented 6 months ago

Hi everybody,

Information is scattered and conflicting but is it possible to run OpenCV Unity on a Cuda backend on Windows?

I can build OpenCV with Cuda but how do you tie the dll's into OpenCV for Unity package and does that conflict with the opencvforunity.dll?

Thank you so much for you help.

EnoxSoftware commented 6 months ago

This article is helpful for the combination of OpenCVForUnity and Cuda. https://qiita.com/utibenkei/items/3d9ce5c30ef666e14f44 This approach does not seem to work from Unity2019 to Unity2021, but seems to work for Unity2022 and above.

wimvanhenden-tool commented 6 months ago

Thank you, indeed it works.

A recap: For Windows 11 x64

  1. In the folder '...\Assets\OpenCVForUnity\Plugins\Windows\x86_64' replace the opencvforunity.dll with the one that comes from the 'import extra package'. It is under Assets\OpenCVForUnity\Extra\dll_version\Windows\x86_64.

  2. Copy paste all the opencv dll files into the folder ...\Assets\OpenCVForUnity\Plugins\Windows\x86_64

image

Thank you so much