Opencv 3.0 introduced a concept called Transparent API to easily accelerate computer vision algorithms on any openCL compatible devise. With the Transparent API no(some time minimal) code change is needed for GPU acceleration. This results in a code which is "Write Once, build once and run everywhere faster!"
To run a simple openCV code with openCL acceleration we have to,
go to the link
go to the link
Variable Name: OPENCV_OPENCL_DEVICE
Variable Value: :GPU:1 (in my case it is Nvidia GPU)
:GPU:0 (intel integrated graphics)
Result
Depending on the algorithm the openCL acceleration will be 1x to 70x. I've tried canny edge detection on webcam images with openCL devise set to Nvidia GPU. The below screen shot shows it all. When edges in the image are dense the speed Up will be more.
(*time is in milisecond)
Code
From the AMD developer conference April 2014
Reference
To run a simple openCV code with openCL acceleration we have to,
- Install the openCL driver.
a.
For NVIDIA
go to the link
chose Developer Drivers
for WinVista and Win7 (257.21) - 64-bit
b.
For intel CPU/ integrated graphics
go to the link
choose appropriate binary based on your model
(in my case HD Graphics 4400)
c.
Restart the PC
- Create an environment variable to choose the openCL devise from the open-CV program
Variable Name: OPENCV_OPENCL_DEVICE
Variable Value: :GPU:1 (in my case it is Nvidia GPU)
:GPU:0 (intel integrated graphics)
- Setup openCV 3 -> compile the program -> Run
Result
Depending on the algorithm the openCL acceleration will be 1x to 70x. I've tried canny edge detection on webcam images with openCL devise set to Nvidia GPU. The below screen shot shows it all. When edges in the image are dense the speed Up will be more.
(*time is in milisecond)
Code
From the AMD developer conference April 2014
Reference
No comments:
Post a Comment