OpenCV 에서 OpenCL 살짝 써보기

  • Published on
    31-Jul-2015

  • View
    663

  • Download
    0

Embed Size (px)

Transcript

1. OpenCV OpenCL 2. OpenCL Apple Aaftab Munshi Khronos Group v2.1 GPGPU OpenCL C Ansi C Streaming Programming Brook String Language nVidia CUDA 3. CUDA GPGPU 4. GPGPU CUDA nVidia, Fxxk you nVidia . 5. OpenCL CUDA 1.2 CUDA (?) 1.2 nVidia . 6. OpenCV OpenCV 3.0 (2015.6.4) Lena 7. 1 : GPU CPU OpenCL 1.2 wikipedia (OpenCL 1.2 ) . .. 8. GPU OpenCL GPU-Z ( OpenCL ) 9. 2 : OpenCL OpenCL 1.2 ! Download and Install~ AMD APP SDK Nvidia OpenCL Driver and Tools Intel SDK for OpenCL IBM OpenCL Common Runtime 10. AMD APP OpenCL 11. AMD APP OpenCL 12. 3 : OpenCV OpenCV 3.0 http://www.opencv.org 2.X deprecated version Transparent API 3.0 13. Download and Install~ 14. OpenCV Transparent API 3.0 CPU API 15. : opencv.org 2.X OpenCL ocl:: API , 3.0 Mat UMat . ( ) 16. ;; 17. 18. cv::Mat matSrc_; //source image cv::UMat umatSrc_; // OpenCL cv::UMat umatGray_; //OpenCL Gray umatSrc_ = matSrc_.getUMat(cv::ACCESS_READ); // OpenCL Psuedo Code 1 : OpenCL OpenCL (GPU) 19. cv::OclCascadeClassifier cascade_; cascade_.load("./haarcascade_frontalface_default.xml"); //ocl cascade classifier cv::cvtColor( umatSrc_, umatGray_, CV_BGR2GRAY ); //cvtColor gray . API UMat . OpenCL . std::vector faces; // cascade_.detectMultiScale( umatGray_, faces, 1.1, 2, CV_HAAR_SCALE_IMAGE); //cascade classifier . OpenCL host(CPU) face vector Psuedo Code 2 : OpenCL 20. , ~? cv::Mat matSrc_; cv::UMat umatSrc_; cv::UMat umatGray_; GPU copy Gray Haarcascade std::vector faces Rect(x, y, w, h) CPU ( ) CPU () GPU (OpenCL ) 21. https://github.com/sshtel/opencv3_practice : Visual Studio 2013 22. !! OpenCV ( OpenCL ) 23. . 24. 25. Intel i5-4690 CPU AMD Radeon R7 200 GPU Intel CPU HD 4600 OPENCV_OPENCL_DEVICE=:CPU:0 Intel i5-4690 CPU OPENCV_OPENCL_DEVICE=:GPU:0 Intel HD4600 GPU OPENCV_OPENCL_DEVICE=:GPU:1 AMD Radeon R7 GPU 26. OPENCV_OPENCL_DEVICE=:GPU:1 27. .. 28. OPENCV_OPENCL_DEVICE=:GPU:1 AMD Radeon R7 200 GPU 29. OPENCV_OPENCL_DEVICE=:GPU:1 HD4600 30. OPENCV_OPENCL_DEVICE=:GPU:0 31. CMD 32. OPENCV_OPENCL_DEVICE=:GPU:0 Intel HD4600( ) 33. OPENCV_OPENCL_DEVICE=:GPU:0 Radeon 34. (Visual studio 2013) 35. (Visual studio 2013) 36. $ export OPENCV_OPENCL_DEVICE=:GPU:1 $ ./face_detection ? 37. OpenCV OpenCL GPU Offload 38. TAPI OpenCL 39. GPGPU