Difference between revisions of "Compiling OpenCV with GStreamer Support"

From RidgeRun Developer Connection
Jump to: navigation, search
m (Install compiler and building dependencies)
m
Line 1: Line 1:
=Install previous GStreamer dependencies=
+
==Install previous GStreamer dependencies==
  
 
<source lang="bash">
 
<source lang="bash">
Line 7: Line 7:
 
</source>
 
</source>
  
=Install compiler and building dependencies=
+
==Install compiler and building dependencies==
  
 
<source lang="bash">
 
<source lang="bash">
Line 16: Line 16:
 
</source>
 
</source>
  
=Obtain source code from Github=
+
==Obtain source code from Github==
  
 
<source lang="bash">
 
<source lang="bash">
Line 24: Line 24:
 
</source>
 
</source>
  
=Configure with required flags=
+
==Configure with required flags==
 
<source lang="bash">
 
<source lang="bash">
 
mkdir build
 
mkdir build
Line 42: Line 42:
 
</source>
 
</source>
  
=Check configuration log=
+
==Check configuration log==
  
 
✔ Verify if it has Python 3: section and all interpreter and path are right. (If they aren’t there, check the numpy package)
 
✔ Verify if it has Python 3: section and all interpreter and path are right. (If they aren’t there, check the numpy package)
Line 50: Line 50:
 
[[File:Opencv configure.png|600px|center]]
 
[[File:Opencv configure.png|600px|center]]
  
=Building=
+
==Building==
  
 
It will last some time. Please be patient.
 
It will last some time. Please be patient.
Line 57: Line 57:
 
</source>
 
</source>
  
=Install the package=
+
==Install the package==
  
 
<source lang="bash">
 
<source lang="bash">
Line 63: Line 63:
 
sudo ldconfig
 
sudo ldconfig
 
</source>
 
</source>
 +
 +
 +
[[Category:GStreamer]]

Revision as of 06:53, 5 March 2020

Install previous GStreamer dependencies

sudo apt-get install gstreamer1.0*
sudo apt install ubuntu-restricted-extras
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

Install compiler and building dependencies

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev
sudo apt-get install python3-pip python3-numpy

Obtain source code from Github

git clone https://github.com/opencv/opencv.git
cd opencv/
git checkout 4.1.0

Configure with required flags

mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D PYTHON_EXECUTABLE=$(which python3) \
-D BUILD_opencv_python2=OFF \
-D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") \
-D PYTHON3_EXECUTABLE=$(which python3) \
-D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
-D WITH_GSTREAMER=ON \
-D BUILD_EXAMPLES=ON ..

Check configuration log

✔ Verify if it has Python 3: section and all interpreter and path are right. (If they aren’t there, check the numpy package)

✔ Check the GStreamer section. (If it does not indicate YES, go check GStreamer lib package)

Opencv configure.png

Building

It will last some time. Please be patient.

sudo make -j4

Install the package

sudo make install
sudo ldconfig