/vision

This project contains code examples for Computer Vision using C++ & OpenCV.

Primary LanguageC++GNU General Public License v3.0GPL-3.0

License badge Twitter

Computer Vision Examples

This project contains code examples created un Visual Studio Code for Computer Vision using C++ & OpenCV. These examples are created for the Computer Vision Subject of Robotics Software Engineering Degree at URJC.

Installation

Open Ubuntu terminal and follow the next steps:

  1. Install dependencies:
sudo apt install build-essential cmake git pkg-config libgtk-3-dev \
    libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
    libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \
    gfortran openexr libatlas-base-dev python3-dev python3-numpy \
    libtbb2 libtbb-dev libdc1394-22-dev
  1. Clone OpenCV and Contrib repositories:
mkdir ~/opencv_build && cd ~/opencv_build
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git
  1. Create temporary build directory:
cd ~/opencv_build/opencv
mkdir build
cd build
  1. Setup OpenCV:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_GENERATE_PKGCONFIG=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \
    -D BUILD_EXAMPLES=ON ..\
    -D OPENCV_ENABLE_NONFREE=ON
  1. Compilation process:
make -j8
  1. Installation process:
sudo make install
  1. Import OpenCV package:
pkg-config opencv4 --cflags --libs
  1. Add in ~/.bashrc:
export LD_LIBRARY_PATH=$LS_LIBRARY_PATH:/usr/local/lib/
  1. Load the libraries into the current shell:
source ~/.bashrc

About

This is a project made by José Miguel Guerrero, Assistant Professor at Universidad Rey Juan Carlos. Copyright © 2021.