Skip to content

Commit

Permalink
install_opencv.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyahput committed Sep 26, 2024
1 parent ebd39ae commit 39ae4f7
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
60 changes: 60 additions & 0 deletions docs/INSTALL/install_opencv.md
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
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ nav:
- Install All Package Robot: INSTALL/install_all.md
- Build rtdb2 Package Robot: INSTALL/rtdb2_build.md
- Install ZED SDK: INSTALL/zed_sdk_install.md
- Install OpenCV dengan Aktivasi Cuda: INSTALL/install_opencv.md

0 comments on commit 39ae4f7

Please sign in to comment.