OpenCV

03. opencv GPU(CUDA) 로 영상 처리하기(설치편)

2023. 8. 20. 20:57

기본적으로 opencv는 cpu로 영상을 처리한다. 하지만 GPU로 영상을 처리할 수 도 있다.

GPU로 돌리기 위해서는 CUDA 를 사용해야한다.
하지만 릴리즈로 나온 라이브러리는 CUDA에 대한 내용이 없다.
그렇기 때문에 CMAKE 로 필요한 옵션을 주어 다시 빌드해주어야 한다.
또, NVIDIA 그래픽카드라면 드라이버가 필요하다.

무조건 다 할 순 없다.
아래 링크를 통해 해당하는 조건인지 확인해봐야한다.
조건을 확인하고 다운받자.

https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html

 

https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=11 

 

CUDA Toolkit 12.1 Downloads

Get the latest feature updates to NVIDIA's proprietary compute stack.

developer.nvidia.com

 

VS 켜져있으면, 닫고 설치필요
기다리면 설치가 완료된다.

다시 시작을 통해 완료해준다.

완료 후 

https://github.com/nvidia/cuda-samples

 

GitHub - NVIDIA/cuda-samples: Samples for CUDA Developers which demonstrates features in CUDA Toolkit

Samples for CUDA Developers which demonstrates features in CUDA Toolkit - GitHub - NVIDIA/cuda-samples: Samples for CUDA Developers which demonstrates features in CUDA Toolkit

github.com

 

다운받은 파일에 보면 sln 파일이 있다. 빌드해주자

 

1_Utilities -> deviceQuery 를 빌드한다.

 

1_Utilities -> bandwidthTest

 

 

잘 뜬다면 이제 CUDA를 사용할 준비가 되었다는 뜻입니다.