Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Finally I have managed to solve it! I will leave here a more or less detailled description about how I did it. I was able to build the example https://docs.opencv.org/master/d4/d18/tutorial_sfm_scene_reconstruction.html manually using the IDE Eclipse. BTW I built OpenCV in an external hard disk.

It turned out that the source of errors was multiple.

  • First of all, although I had Ceres (installed and working), it was somehow not detected, maybe due to a "conflict" between my ceres version and my Eigen version. I solved this by commenting out the lines //#if defined(CV_DOXYGEN) || defined(CERES_FOUND) //#endif /* CV_DOXYGEN || CERES_FOUND */ in the file reconstruct.hpp file placed at usr/local/include/opencv4/opencv2/sfm

  • Second, I realised that the 3rdParty libraries (correspondence.a, multiview.a, numeric.a and simple_pipeline.a) were not installed directly in usr/local/lib as all the others libraries installed with OpenCV (where all the opencv_xxx.os are), but in usr/local/lib/opencv4/3rdparty. Hence, I added additional paths in order to access these required libraries for reconstruct.

    So finally, in the IDE Eclipse I was using, the libraries I included and linked and the paths I gave to make it work with the C++ compiler GCC C++ (I am aware there are some redundant and not necessary, but with this configuration it worked for me) are: Include paths (-l): /usr/local/include/opencv4, /usr/local/include/vtk-8.1, /usr/local/include Include files (-include): /usr/local/include/opencv4/opencv2/sfm/reconstruct.hpp, /usr/local/include/opencv4/opencv2/viz,viz3d.hpp

Library search path (-L): usr/local/lib, usr/local/lib/opencv4/3rdparty Libraries (-l): opencv_core, opencv_viz, numeric, simple_pipeline, multiview, correspondence, ceres, opencv_sfm, opencv_imgproc, opencv_imgcodecs, opencv_highgui, opencv_ml, opencv_features2d, opencv_calib3d, opencv_objdetect, opencv_flann

  • Third, there is some wrong versions of the structure from motion examples around, where the part regarding visualisation using the viz module has a couple of wrong lines. Use the code of the official OpenCV repository.

Finally I have managed to solve it! I will leave here a more or less detailled description about how I did it. I was able to build the example https://docs.opencv.org/master/d4/d18/tutorial_sfm_scene_reconstruction.html manually using the IDE Eclipse. BTW I built OpenCV in an external hard disk.

It turned out that the source of errors was multiple.

  • First of all, although I had Ceres (installed and working), it was somehow not detected, not during the installation (it did work then and everything installed right), but when using the reconstruct.hpp, maybe due to a "conflict" between my ceres version and my Eigen version. I solved this by commenting out the lines //#if defined(CV_DOXYGEN) || defined(CERES_FOUND) //#endif /* CV_DOXYGEN || CERES_FOUND */ in the file reconstruct.hpp file placed at usr/local/include/opencv4/opencv2/sfm

  • Second, I realised that the 3rdParty libraries (correspondence.a, multiview.a, numeric.a and simple_pipeline.a) were not installed directly in usr/local/lib as all the others libraries installed with OpenCV (where all the opencv_xxx.os are), but in usr/local/lib/opencv4/3rdparty. Hence, I added additional paths in order to access these required libraries for reconstruct.

    So finally, in the IDE Eclipse I was using, the libraries I included and linked and the paths I gave to make it work with the C++ compiler GCC C++ (I am aware there are some redundant and not necessary, but with this configuration it worked for me) are: Include paths (-l): /usr/local/include/opencv4, /usr/local/include/vtk-8.1, /usr/local/include Include files (-include): /usr/local/include/opencv4/opencv2/sfm/reconstruct.hpp, /usr/local/include/opencv4/opencv2/viz,viz3d.hpp

Library search path (-L): usr/local/lib, usr/local/lib/opencv4/3rdparty Libraries (-l): opencv_core, opencv_viz, numeric, simple_pipeline, multiview, correspondence, ceres, opencv_sfm, opencv_imgproc, opencv_imgcodecs, opencv_highgui, opencv_ml, opencv_features2d, opencv_calib3d, opencv_objdetect, opencv_flann

  • Third, there is some wrong versions of the structure from motion examples around, where the part regarding visualisation using the viz module has a couple of wrong lines. Use the code of the official OpenCV repository.