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/d...), 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!
you need the data from the opencv_extra repo, to run the tests successfully
Thanks for your answer.
Which data do you mean? for the reconstruction example I did give a path where there was the (I think) pictures used for that particular example with the given parameters.
For the other test what should I add?
Any clue about the compilation error of reconstruct function?
Thanks again
https://github.com/opencv/opencv_cont...
unfortunately, this has to happen at library build time.
(the sfm module will still build without proper ceres, you just can't reconstruct anything)
((maybe you need to add your cmake output to the question ?))
Thanks again!
The cmake file is pretty big and I do not know how to attach it. In any case, what it may would be the relevant part for this case: Found required Ceres dependency: Eigen, Found required Ceres dependency: glog, Found required Ceres dependency: gflags, Found Ceres version: 2.0.0 installed, Checking SFM deps... TRUE. - .... - OpenCV modules: To be built: ... sfm ...
So apparently it has been detected at the build time. I have seen it does not detect for example Atlas, although it is installed, and I don't have OpenBlas. In the other third-party libraries, "Lapack: NO", Eigen: YES and Ceres is not listed at all. Do you think it could be due to this?
Can you try match_reconstruct.cpp?
ceres version 2.0 ? see https://ceres-solver.googlesource.com...
no, neither atlas nor openblas are used here. the sfm deps are:
@LBerger, please take over here ;) (and nice, to have you back !)
Thanks for your support. Ok, I think it may has something to do with the Ceres I have installed (it seems I am in the future already)...I will reinstall Ceres with the linked source and build again. I will give you feedback when done!
@prater read http://ceres-solver.org/installation....
But it is strange. I did install Ceres using exactly that guide and everything seemed to work fine. I did calculate the suggested example without any problem. But why does it say I have Ceres version 2.0 if the latest version is 1.14??? @LBerger
When running ldconfig -v | grep ceres I get: libceres.so.2 -> libceres.so.2.0.0 /sbin/ldconfig.real: /lib/x86_64-linux-gnu/ld-2.27.so is the dynamic linker, ignoring libceres.so.1 -> libceres.so.1.13.0
I have seen that I do not have any "ceres.pc" in the pkgconfig folder of .../include but I have the ceres.so library in .../lib. May does it have to do with this?
My system is window I cannot help you with your configuration. My cmake output gives Found Ceres version: 1.13.0 installed in: G:/Lib/install/ceres-solver
Now if can you can run my example match_reconstruct.cpp I think that ceres is installed