Subsections


How to Build OpenCV Plugins

For users who do their own build or for administrators who want to create a System build that includes OpenCV, here are some notes to facilitate doing so. Building findobject will configure and build OpenCV into the thirdparty library build area if needed (it does not rebuild if done previously). Network access is required to obtain the OpenCV source, at least once. You will need a minimum of GB in the thirdparty build directory and more time to compile.


Build using stable tarballs

Instead of using the latest git version, there is a custom archive source tarball on the website already created to build and test OpenCV versions. The reason for this is that OpenCV is quite volatile, and may or may not work on any given day so this is an already tested version that is considered to be more stable. A build using the tarball requires that your system have wget already installed to initially download the prepared source tar. There are currently 2 tarballs of stable versions on the website used for user builds. The 20180401 version:
https://cinelerra-gg.org/download/opencv/opencv-20180401.tgz
works with older version of cmake, and 20200308 is the current 4.2 release:
https://cinelerra-gg.org/download/opencv/opencv-20200306.tgz

To build using the tarballs on the website, use this bld.sh procedure (you may want to run "make clean" first):
#!/bin/bash
( ./autogen.sh
  ./configure --with-single-user --with-booby \
    --with-opencv=sta,tar=http://cinelerra-gg.org/download/opencv/opencv-20200306.tgz
  make && make install ) 2>&1 | tee log
mv Makefile Makefile.cfg
cp Makefile.devel Makefile


Build using current git version

To build findobject and the other plugins using OpenCV, access the src using git:

git clone --depth 1 "git://git.cinelerra-gg.org/goodguy/cinelerra.git" cinelerra5
To use the latest version, the method for creating a tarball is:

  1. download both opencv and opencv_contrib source tarballs from the web: https://sourceforge.net/projects/opencvlibrary/files/4.2.0/ https://github.com/opencv/opencv_contrib/archive/4.2.0.tar.gz
  2. create a temporary directory opencv_src and unpack the tarballs into the src directory
  3. rename these sources to opencv and opencv_contrib
  4. run a test build, using opencv_build for config:

cd opencv\_src
mkdir build
cd build && cmake \
  -DCMAKE\_BUILD\_TYPE=RELEASE \
  -DWITH\_IPP=OFF \
  -DWITH\_LAPACK=OFF \
  -DWITH\_GPHOTO2=OFF \
  -DBUILD\_SHARED\_LIBS=ON \ 
  -DINSTALL\_C\_EXAMPLES=ON \
  -DINSTALL\_PYTHON\_EXAMPLES=ON \
  -DBUILD\_EXAMPLES=ON .. \
  -DBUILD\_opencv\_python3=no \
  -DCMAKE\_INSTALL\_PREFIX=/usr/local \
  -DOPENCV\_EXTRA\_MODULES\_PATH="\$(opencv)\_contrib/modules/"

Next configure the build, but add the --with-opencv configure parameter. An example of usage of shown next.

cd <path>/cinelerra-5.1
./autogen.sh
./configure <add std params, eg: --with-single-user> --with-findobect=sta
--with-opencv may be set to [<bld>][,<src>]
bld=typ sta,dyn,sys:	 sta=static, dyn=shared, sys=system libraries
src=typ git,tar,git=url,tar=url: git (default git\_url), tar (default: tar\_url)

# Use one of the following:
--with-opencv=sta
--with-opencv=dyn
--with-opencv=sta,tar=https://cinelerra-gg.org/download/opencv/opencv-20180401.tgz

# For example: ./configure <params> --with-opencv=sta,git

Once thirdparty/opencv is built, it will be reused. To remove thirdparty/opencv*, use mrclean.

Ordinarily OpenCV requires the network to download pieces. But to avoid downloading the same source multiple times as you do test builds, you can instead use the following procedure.

  1. Create a new opencv_src directory with the needed source (src) files, plus the missing pieces in ./opencv/.cache/; This source base does not require the network, and so is usable for batch builds.
  2. Store the tarballs in a safe location, and reference them from an httpd server running locally on the build system. for example:
    /var/www/html/cinelerra.patch
    /var/www/html/opencv-20180401.tgz -> /mnt0/opencv-20180401.tgz
    /var/www/html/opencv-20200306.tgz -> /mnt0/opencv-20200306.tgz
  3. systemctl start httpd

The CINELERRA-GG Community, 2021
https://www.cinelerra-gg.org