I'm trying to build OpenCV on Ubuntu 15.10 with opencv_contrib (to use the nonfree modules). I did the following:
cmake -D CMAKE_BUILD_TYPE=RELEASE -DOPENCV_EXTRA_MODULES_PATH=/home/myname/Downloads/opencv_contrib-master/modules -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=OFF -D WITH_OPENGL=ON -D BUILD_opencv_ximgproc=ON ..
but I tried also with
BUILD_opencv_ximgproc=OFF
CMake goes well but it fails during the make step:
CMakeFiles/Makefile2:8403: recipe for target 'modules/xphoto/CMakeFiles/opencv_xphoto.dir/all' failed
make[1]: *** [modules/xphoto/CMakeFiles/opencv_xphoto.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
and then:
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2
Do you have any suggestions?
Thanks.
I solved it by deleting and re-downloading both opencv and opencv_contrib. Then I built everything again:
git clone https://github.com/Itseez/opencv.git
git clone https://github.com/Itseez/opencv_contrib.git
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -DOPENCV_EXTRA_MODULES_PATH=/home/myname/Downloads/opencv_contrib/modules -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=OFF -D WITH_OPENGL=ON -D BUILD_opencv_ximgproc=ON ..
make -j7
sudo make install
Related
I'm using the following Make to build OpenCV from source,
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=/Users/Tools/opencv_contrib/modules \
-D PYTHON3_EXECUTABLE=/miniforge/base/envs/envname/bin/python3 \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D WITH_TBB=ON \
-D WITH_V4L=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D WITH_OPENGL=ON \
-DBUILD_ZLIB=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/Users/Tools/opencv_contrib/modules \
-D BUILD_EXAMPLES=ON ..
Unfortunately it doesn't build. It throws the following error,
: error: unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?
I have of course installed FFmpeg. what am I still missing?
I think that you've installed ffmpeg 5 and OpenCV is not yet compatible with it. Please try the following:
brew install ffmpeg#4
brew unlink ffmpeg
brew link ffmpeg#4
and then recompile OpenCV again.
I installed OpenCV 4.1 on Ubuntu 18.04 LTS. The problem is when I compile my project's CMake file, the output is:
/usr/bin/ld: cannot find -lopencv_nonfree
collect2: error: ld returned 1 exit status
CMakeFiles/river_flow_velocity_estimation.dir/build.make:274: recipe for target 'river_flow_velocity_estimation' failed
make[2]: *** [river_flow_velocity_estimation] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/river_flow_velocity_estimation.dir/all' failed
make[1]: *** [CMakeFiles/river_flow_velocity_estimation.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
My CMake flags when I compile OpenCV are:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D BUILD_EXAMPLES=ON -D OPENCV_GENERATE_PKGCONFIG=YES -D OPENCV_ENABLE_NONFREE=ON -D WITH_OPENMP=ON -D WITH_OPENCL=ON -D INSTALL_CREATE_DISTRIB=ON -DBUILD_opencv_world=OFF -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
Can someone help me?
I'm trying to install opencv on ubuntu. so far I have downloaded opencv 3.1 and done this:
mkdir build
cd build/
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 WITH_CUBLAS=ON -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" ..
but when I try to make it, by using make it shows these kind of errors:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:63:16: error: expected constructor, destructor, or type conversion before ‘(’ token
__MATHCALL_VEC (cos,, (Mdouble __x));
or
/usr/include/c++/5/cmath:199:11: error: ‘::cos’ has not been declared
and so on. what can I do to fix this?
it is a while I am trying to install opencv but each time I have some problems with the configuration of cmake.
this is the cmake I am trying to use:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_PYTHON_SUPPORT=ON
-D WITH_XINE=ON -D WITH_OPENGL=ON -D INSTALL_C_EXAMPLES=ON
-D INSTALL_PYTHON_EXAMPLES=ON -D WITH_TBB=ON -D BUILD_EXAMPLES=ON
-D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON
-D CMAKE_INSTALL_PREFIX=/home/username/main-env/opencv3.0
-D WITH_GTK = ON -D MATLAB_ROOT_DIR=/home/MATLAB/R2015a ..
,but got this error
Parse error in command line argument: -D
Should be: VAR:type=value
CMake Error: No cmake script provided.
CMake Error: Problem processing arguments. Aborting.
P.S. I want to put it in main-env folder which is the virtual environment folder to avoid any problems with system files and less struggling with various errors encountered in previous times. not sure possible maybe it is totally wrong. please let me know if you have some knowledge about it.
the all terms should be separated by -D and shouldn't be any attached terms with -D
I encountered the problem during compiling OpenCV. Error message said that I don't have Eigen. However, I do have one in my /usr/local/include directory. Also, I ran CMake with option below.
CMake:
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D CUDA_GENERATION=Auto USE_EIGEN=/usr/local/include/Eigen ..
Compiling OpenCV(by make):
[ 75%] Building CXX object modules/contrib/CMakeFiles/opencv_contrib.dir/src/rgbdodometry.cpp.o
/home/gom7745/IR/opencv-2.4.11/modules/contrib/src/rgbdodometry.cpp:65:47: fatal error: unsupported/Eigen/MatrixFunctions: No such file or directory
# include <unsupported/Eigen/MatrixFunctions>
^
compilation terminated.
make[2]: *** [modules/contrib/CMakeFiles/opencv_contrib.dir/src/rgbdodometry.cpp.o] Error 1
make[1]: *** [modules/contrib/CMakeFiles/opencv_contrib.dir/all] Error 2
make: *** [all] Error 2
Does anyone have any idea about this? Thanks!!
Building it with -DWITH_EIGEN=OFF solved the issue for me.
here cmake is unable to find unsupported/Eigen/MatrixFunctions. First find where Eigen is installed, in my case it was located at /usr/local/include/eigen3. Now locate your rgbdodometry.cpp file, in my case it was in /opencv_contrib/modules/rgbd/src. Open the cpp file and modify the previous line with something like
"/usr/local/include/eigen3/unsupported/Eigen/MatrixFunctions"