Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem with some functions of SFM module

Hi!

I have installed OpenCV 4.0 (C++) with the contrib modules in Ubuntu 18.04 LTS. I had Ceres installed and working before building OpenCV and the other required libraries for SFM module (gflags,glog...), so I was careful about this point. The rest of modules seem to work fine. While generating the cmake file for building OpenCV, I checked that Ceres was detected. When trying to compile one of the examples in the documentation, for example https://docs.opencv.org/4.0.0-alpha/d4/d18/tutorial_sfm_scene_reconstruction.html), the reconstruct() function is not compiling: the error is "src/StructureFromMotion.cpp:78:3: error: ‘reconstruct’ was not declared in this scope".

In the IDE I am using (Eclipse), it seems that among the functions in the SFM spacename, these ones are missing: fundamentalFromCorrespondences7PointRobust, fundamentalFromCorrespondences8PointRobust and the four reconstruct functions (comparing the available functions to the functions listed in the namespace SFM in the documentation). Among the ../include/opencv4/opencv2/sfm it seems to be all the .hpp files (compared to the GIT repository). In the ../lib there is the libopencv_sfm.so.

When trying to run some tests/examples that were compiled while building openCV, I get the next results:

1.)When running the compiled test_sfm I got the error (all the other test were passed):

[----------] 1 test from Sfm_simple_pipeline

[ RUN ] Sfm_simple_pipeline.backyard unknown file: Failure C++ exception with description "OpenCV(4.0.0-pre) /home/jbg/Descargas/opencv_contrib/modules/sfm/test/test_common.cpp:84: error: (-2:Unspecified error) in function 'parser_2D_tracks' Unable to read file: sfm/backyard_tracks.txt " thrown in the test body.

[ FAILED ] Sfm_simple_pipeline.backyard (0 ms)

[----------] 1 test from Sfm_simple_pipeline (0 ms total)

2.) When running the example_sfm_scene_reconstruction I get the error:

terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.0.0-pre) /home/jbg/Descargas/opencv_contrib/modules/sfm/src/reconstruct.cpp:241: error: (-215:Assertion failed) nviews >= 2 in function 'reconstruct'

I also tried things like defining the CERES_FOUND 1 or CERES_FOUND True, etc. but it did not work either. I also tried to rebuild OpenCV, reinstall CERES, etc.

I hope someone can help me. As you see, I have been reading about it and trying to fix it with different solutions but so far it did not work and I do not know how to move on.

Thank you very much in advance!