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 4 GB in the thirdparty build directory and more time to compile.
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 |
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 |
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.
The CINELERRA-GG Community, 2021