0% found this document useful (0 votes)
36 views2 pages

Opencv Installation Steps

Uploaded by

harikaku.2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

Opencv Installation Steps

Uploaded by

harikaku.2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Step-by-Step Guide to Install OpenCV from opencv-4.10.0.

zip
1. Unzip the Downloaded File:
• Navigate to the directory where you downloaded the ZIP file and unzip it:
bash
Copy code
unzip opencv-4.10.0.zip
cd opencv-4.10.0

2. Install Required Dependencies:


• Before building OpenCV, install the necessary build dependencies:
bash
Copy code
sudo apt update
sudo apt install -y build-essential cmake git libgtk2.0-dev pkg-
config libavcodec-dev libavformat-dev libswscale-dev
sudo apt install -y python3-dev python3-numpy libtbb2 libtbb-dev
libjpeg-dev libpng-dev libtiff-dev
sudo apt install -y libdc1394-22-dev libopenexr-dev libgstreamer-
plugins-base1.0-dev libgstreamer1.0-dev

3. Create a Build Directory:


• Inside the extracted OpenCV directory, create a separate directory for the build files:
bash
Copy code
mkdir build
cd build

4. Configure OpenCV with CMake:


• Use cmake to set up the build configuration. The command below sets OpenCV for
Python 3 and enables some popular libraries and optimizations:
bash
Copy code
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_TBB=ON \
-D WITH_V4L=ON \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
..

5. Build OpenCV:
• Once CMake completes configuration, build OpenCV using make. This can take
some time:
bash
Copy code
make -j$(nproc) # Adjust $(nproc) to use all CPU cores for faster
compilation
6. Install OpenCV:
• After the build process completes, install OpenCV to your system:
bash
Copy code
sudo make install
sudo ldconfig

7. Verify the Installation:


• Check if OpenCV installed correctly by running:
bash
Copy code
pkg-config --modversion opencv4

• If you’re using Python, you can also check in a Python shell:


python
Copy code
python3 -c "import cv2; print(cv2.__version__)"

After completing these steps, OpenCV should be successfully installed and ready for use on your
Linux machine. Let me know if you run into any issues!

You might also like