Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

How to install xphoto from opencv_contrib

$
0
0
Hi, I want to use the [cv::xphoto::balanceWhite()](http://docs.opencv.org/3.0-last-rst/modules/xphoto/doc/whitebalance.html) function in my code. However, I have some problems installing the library. So far I understood that I need opencv 3.0.0 combined with the opencv_contrib repository. To install these I followed mostly the instructions by [Rodrigo Berriel](http://rodrigoberriel.com/2014/10/installing-opencv-3-0-0-on-ubuntu-14-04/) and the README.md in the [opencv_contrib repository](https://github.com/itseez/opencv_contrib). The steps I performed where (my operating system is Ubuntu 14.04): sudo apt-get -y install libopencv-dev build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff4-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip qt5-default libvtk6-dev zlib1g-dev libwebp-dev libpng-dev libtiff5-dev libopenexr-dev libgdal-dev libx264-dev yasm libxine2-dev libeigen3-dev python-tk python3-dev python3-tk python3-numpy ant default-jdk doxygen These dependencies are probably more than I need. I combined the recommendations from several pages. wget https://github.com/Itseez/opencv/archive/3.0.0.zip -O opencv-3.0.0.zip git clone https://github.com/Itseez/opencv_contrib.git unzip opencv-3.0.0.zip cd opencv-3.0.0 mkdir -pv build cd build cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D WITH_TBB=ON \ -D WITH_V4L=ON \ -D WITH_QT=ON \ -D WITH_OPENGL=ON \ -D BUILD_opencv_ximgproc=OFF \ -D BUILD_opencv_python2=OFF \ -D BUILD_opencv_python3=OFF \ .. I removed ximgproc and python because these modules gave me some errors during configuration. However, I am only interested in xphoto anyway. make -j 8 sudo make install sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf' sudo ldconfig This process goes through without any errors. Further, I can compile my opencv code that does not contain any contrib modules so far. But, as soon as I add a call to the following code, compilation fails. #include "opencv2/xphoto.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/highgui.hpp" #include "opencv2/core/utility.hpp" #include "opencv2/imgproc/types_c.h" ... cv::Mat whiteBalanced; cv::xphoto::balanceWhite(ImageOriginal, whiteBalanced, cv::xphoto::WHITE_BALANCE_SIMPLE); I identified the problem so far, that the compiler (clang) does not find the include files. I searched my machine and only found them scattered in the opencv_contrib repository, but not installed in a common place like /usr/include. So my assumption is that opencv got compiled and installed correctly, however the modules from the opencv_contrib repository where only compiled but not installed. Is there a step missing or did I something wrong during the installation? How do you compile opencv together with the xphoto module? Thank you very much. **supplement**: If I compile with the options: cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D WITH_TBB=ON \ -D WITH_V4L=ON \ -D WITH_QT=ON \ -D WITH_OPENGL=ON \ -D BUILD_opencv_ximgproc=ON \ -D BUILD_opencv_python2=OFF \ -D BUILD_opencv_python3=OFF \ .. I get the error: [ 94%] Building CXX object modules/ximgproc/CMakeFiles/opencv_ximgproc.dir/src/sparse_match_interpolators.cpp.o In file included from /home/mkreim/bin/opencv/opencv/opencv-3.0.0/modules/core/include/opencv2/core.hpp:54:0, from /home/mkreim/bin/opencv/opencv/opencv-3.0.0/build/modules/ximgproc/precomp.hpp:40: /home/mkreim/bin/opencv/opencv/opencv_contrib/modules/ximgproc/src/sparse_match_interpolators.cpp: In member function 'virtual void cv::ximgproc::EdgeAwareInterpolatorImpl::interpolate(cv::InputArray, cv::InputArray, cv::InputArray, cv::InputArray, cv::OutputArray)': /home/mkreim/bin/opencv/opencv/opencv_contrib/modules/ximgproc/src/sparse_match_interpolators.cpp:171:52: error: 'const class cv::_InputArray' has no member named 'isVector' CV_Assert( !from_points.empty() && from_points.isVector() && ^ /home/mkreim/bin/opencv/opencv/opencv-3.0.0/modules/core/include/opencv2/core/base.hpp:389:33: note: in definition of macro 'CV_Assert' #define CV_Assert( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ) ^ /home/mkreim/bin/opencv/opencv/opencv_contrib/modules/ximgproc/src/sparse_match_interpolators.cpp:172:52: error: 'const class cv::_InputArray' has no member named 'isVector' !to_points .empty() && to_points .isVector() && ^ /home/mkreim/bin/opencv/opencv/opencv-3.0.0/modules/core/include/opencv2/core/base.hpp:389:33: note: in definition of macro 'CV_Assert' #define CV_Assert( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ) ^ make[2]: *** [modules/ximgproc/CMakeFiles/opencv_ximgproc.dir/src/sparse_match_interpolators.cpp.o] Error 1 make[1]: *** [modules/ximgproc/CMakeFiles/opencv_ximgproc.dir/all] Error 2 make: *** [all] Error 2 **Supplement 2** If tried to follow beraks advice and started over. Especially I changed the source of opencv. I use the two repositories git clone https://github.com/Itseez/opencv.git git clone https://github.com/Itseez/opencv_contrib.git and use cmake with the parameters cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D WITH_TBB=ON \ -D WITH_V4L=ON \ -D WITH_QT=ON \ -D WITH_OPENGL=ON \ -D BUILD_opencv_ximgproc=ON \ -D BUILD_opencv_python2=ON \ -D BUILD_opencv_python3=OFF \ .. This compiles opencv and the modules without any problems or error messages. If I turn on python3 it mocks about missing dependencies. However that is no problem because I don't need python3. My problems start when I try to link my own code (compilation works fine): $ make g++ -g -O2 -W -Wall -Wextra -Werror -pedantic -std=c++11 -I/usr/local/include/ -c main.cpp g++ -g -O2 -W -Wall -Wextra -Werror -pedantic -std=c++11 -I/usr/local/include/ -c RootAreaModule.cpp g++ -W -Wall -Wextra -Werror -pedantic -std=c++11 -o RootAreaModule.bin main.o RootAreaModule.o -L/usr/local/lib/ -lopencv_calib3d -lopencv_contrib -lopencv_core - lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab /usr/bin/ld: main.o: undefined reference to symbol '_ZN2cv7imwriteERKNS_6StringERKNS_11_InputArrayERKSt6vectorIiSaIiEE' //usr/local/lib/libopencv_imgcodecs.so.3.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [all] Error 1

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>