New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SFM module example error (reconstruct not declared in this scope ) #476
Comments
Probably you have not provided enough dependencies for the build. This example is checked on buildbot and the build is fine. How do you build it? Please provide more details. |
Sorry for my ignorance, but I'm pretty new at this. Here is what I've done. To install OpenCV:
To compile the example code I did:
And the error pops up. Have I done something wrong? Am I missing something? |
Add |
Also, it could be better to build this example by adding |
Seems that OpenCV is found, I got the following: -- Found OpenCV version 3.0.0 |
With the -DBUILD_EXAMPLES=ON it does work. :/ |
@Wababa could you check that after installing you got the sfm module headers copied into your filesystem? This smacks to me that there's an issue in the installation part. |
@edgarriba @mshabunin I have the same problem, but mine did not go away with -DBUILD_EXAMPLES=ON flag. Indeed the sfm module headers are there in my filesystem, so i do not get errors including the headers and the namespace cv::sfm. But only on reconstruct method :| thats strange! I can call other methods of sfm including homogeneousToEuclidean but not reconstruct. Though i get the executable of the example (sfm_scene_recontruction) in bin directory successfully, as the build was successful. |
I have exactly the same issue as @Wababa, cv::sfm::reconstruct() is not recognized. I have:
I don't really know what to do. Edit: $ ./example_sfm_scene_reconstruction works for me... So, there is something different between the compilation of my example and the OpenCV one, but what? |
@manishaluthra Actually It didn't work with the DBUILD_EXAMPLES=ON, sorry for expressing myself wrong. I meant that the compiled example worked. @edgarriba I have the same headers as @Debize. |
hey wait, do you guys have Ceres installed? For reconstruction and build samples is needed. There's a note explaining that plus a tutorial about Ceres installation: Check as well that in case you don't have Ceres then examples are not built: |
yes i have the same issue too @Debize, i have the sfm module headers as well in /usr/local/include/opencv2/sfm including reconstruct.hpp. example_sfm_scene_reconstruction works for me too, there indeed are some differences in compilation of example. Just when I write my own example, cv::sfm::reconstruct() do not get recognized. @edgarriba i did install Ceres, here are the libraries installed in my file system: /usr/local/include/ceres. I wonder how to solve this. |
Hello all, I have the same issue. Any suggestion would be great! |
Hey guys! I had these same problems. I knew that i had installed ceres and it was visible, so i just opened the files 'reconstruct.hpp' and 'sfm.hpp' and commented the directive 'if CERES NOT FOUND'. PS: Virtual machine may cause some problems. |
@BorgesJVT very good! 你说的对! |
@BorgesJVT I had the same issue. Thanks a lot for that. I commented 'if CERES NOT FOUND' and the code could be built, but no Visualization view was showed after executing this command: ./example_sfm_scene_reconstruction image_paths_file.txt 350 240 360 I wonder if you had the point cloud as in here: https://github.com/Itseez/opencv_contrib/tree/master/modules/sfm I really appreciate your help. |
This command: ./example_sfm_trajectory_reconstruction tracks_file.txt 1914 640 360 worked well for me (display as same as in https://github.com/Itseez/opencv_contrib/tree/master/modules/sfm). It means that I had no problem with building OpenCV 3.1 + opencv_contrib (with VTK, opencv_viz). Ceres did not show anything wrong. |
Hi @ntthuy11 I have the same configuration (opencv + ceres) in two virtual machines. In both machines i can compile and execute all sample files, but one of the machines i have the same issue (i can't visualize too). I suppose that it could be some graphical issue, perhaps because of virtual machine or visual graphics limitation. Try use another machine configuration! |
Hi @BorgesJVT. Thank you very much. I tried to clean everything and install again but I still had the same problem with visualization. But it is fine, as long as the recontruct() function works. |
Hello, |
Hello, I had the same problem: I can run the example from opencv, but cannot compile and link my own code. Compiler says reconstruct is undefined. Following the answer from @BorgesJVT I propose an alternative procedure: I added in my code #define CERES_FOUND true This line must be before the include instructions to the sfm modules, e.g., #include <opencv2/sfm.hpp>
#include <opencv2/viz.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/core.hpp> An it now compiles. In my opinion, its better than changing the source code from opencv_contrib. Of course this assumes that you do have CERES installed, but I think that if it is not installed a linking error should appear. I have also have the problem of not seeing anything in the visualizer ... |
I agree with @miguelriemoliveira. It's better than change the source code. |
…gs, Check issues opencv#636 and opencv#476
@gunshi, why don't you do as I suggested above? As a matter of fact, you could also use @BorgesJVT suggestion as well. |
Hi, I was able to resolve the error, which was due to a version mismatch between eigen and ceres, as described in the config cmake file for ceres, and that was quietly setting both the ceres_found flags to false, despite ceres being installed. |
Hi @gunshi could you explain how you solved it? |
I changed find_package(CERES QUIET) to find_package(CERES REQUIRED), and thus got an error during cmake, which gave a message about eigen version being 3.2.8 and the requested eigen version for ceres being 3.2.7 (as listed in the cmake config file for ceres under /usr/local/share/Ceres). |
Hi, I was having the same problems for compiling and the trick was to use eigen 3.2.7 as mentioned by @gunshi. I also needed the To see the visualisation, I added
|
Hi @botverse if you are using the "#define CERES_FOUND true directive at the top of the example" I do not think you need to bother about downgrading Eigen. Thanks for the waitkey(0) tip, I will try it. |
waitkey(0) didn't work for me, unfortunately. |
I could also run sfm sample but I have problem with visualizing! actually no visualization!! I tried waitkey() as well but it doesn work...help please.. |
I`m also using my own project cmake file find_package(Ceres QUIET) file(GLOB test_project by using cmake .. and make. I end up haveing the same error as yours. Problem is that if you have multiple version of opencv eg one at /opt/ros/indigoXXXXXXXXXX another is at /usr local it will automatically lock in ros one. I solve the problem by link manually, there are 6 tab in the opencv group that you need to fill in Then it works for me. You might want to give it a try. |
Hi, I was having the same problems for compiling,I do |
I think uncomment the sfm.hpp and reconstruct #if CERES_FOUND is not a good idea, I got this error:
Anyone have suggestions? To be more clear, those file are being commented:
but it still gets some error as above. |
Ok, things not simple as I know, I succeed build the sfm module by uncomment both CERES and DOXYGEN, I can load reconstruct now, but when I build my program, it says:
Compeletely have now idea what is going on?? |
This code tries to work with |
@alalek I am just token the tutorial code from https://docs.opencv.org/3.1.0/d4/d18/tutorial_sfm_scene_reconstruction.html , and I am just using the original usage of sfm::recontrcut:
I think there is nothing to do with your addressed issue. |
@jinfagang You should open a new issue about invalid types in sfm samples. It is not related to original issue. |
I know this is an old post now, but for anybody else who is trying to build the extra opencv modules from source (on windows); I found that if you use cmake to build and install Ceres-solver from source, it doesnt install correctly. You need to make sure you have gflags and glog build from Visual Studio, then build Ceres in debug mode, the release mode, in Visual Studio. THEN build the "INSTALL" project in release and it should install correctly. Make sure to close cmake and re-open then when you configure opencv it "should" pick up the new install location |
Hi,
I followed the steps from the opencv docs to install the dependencies and the Ceres solver for the SFM module and everything seemed to have worked. Afterwards I tried compiling the example code and I get the following error:
structure.cpp:118:77: error: ‘reconstruct’ was not declared in this scope
reconstruct(points2d, Rs_est, ts_est, K, points3d_estimated, is_projective);
The full code can be found here: http://docs.opencv.org/master/d4/d18/tutorial_sfm_scene_reconstruction.html#gsc.tab=0
Im running Ubuntu 14.04.
I hope someone can help me. Thank you!
The text was updated successfully, but these errors were encountered: