-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Install OpenCV dari Source dengan Aktivasi Cuda | ||
|
||
Sebelum melakukan instalasi, pastikan CUDA dan CUDNN telah terinstal, lalu jika mau anda dapat menghapus Opencv bawaan yang terinstall pada sistem anda dengan command ini. | ||
``` | ||
sudo rm -r /usr/include/opencv4/opencv2 | ||
``` | ||
berikut langkah-langkah mem-build Opencv dari source dengan aktivasi Cuda: | ||
|
||
A. install deoendencies yang diperlukan. | ||
``` | ||
sudo apt-get update | ||
sudo apt-get install -y libgtk2.0-dev pkg-config build-essential cmake git \ | ||
libatlas-base-dev gfortran python3-dev \ | ||
libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev \ | ||
libavcodec-dev libavformat-dev libswscale-dev | ||
``` | ||
|
||
B. Clone repositori opencv dan opencv_contrib: | ||
``` | ||
git clone https://github.com/opencv/opencv.git | ||
git clone https://github.com/opencv/opencv_contrib.git | ||
``` | ||
|
||
C. Buat folder build pada folder opencv yang telah di clone. | ||
``` | ||
cd opencv | ||
mkdir build | ||
cd build | ||
``` | ||
|
||
D. Build opencv dalam folder build yang telah dibuat, sebelum melakukan build periksa CUDA_ARCH_BIN yang terdapat pada sistem anda, dengan command: | ||
``` | ||
nvidia-smi --query-gpu=compute_cap --format=csv | ||
``` | ||
|
||
masukan nilai dari CUDA_ARCH_BIN, berdasarkan output dari command line diatas. Build opencv dengan aktivasi Cuda dengan command dibawah ini: | ||
|
||
``` | ||
cmake -D CMAKE_BUILD_TYPE=RELEASE \ | ||
-D CMAKE_INSTALL_PREFIX=/usr \ | ||
-D WITH_CUDA=ON \ | ||
-D WITH_CUDNN=ON \ | ||
-D OPENCV_DNN_CUDA=ON \ | ||
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \ | ||
-D INSTALL_PYTHON_EXAMPLES=OFF \ | ||
-D INSTALL_C_EXAMPLES=OFF \ | ||
-D WITH_GTK=ON \ | ||
-D WITH_QT=OFF \ | ||
-D BUILD_EXAMPLES=ON \ | ||
-D CUDA_ARCH_BIN=8.6 \ | ||
-D WITH_FFMPEG=ON \ | ||
.. | ||
``` | ||
|
||
E. Jika proses build telah selesai install opencv. | ||
``` | ||
make -j$(nproc) | ||
sudo make install | ||
sudo ldconfig | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters