From 03f0b94fbeef5fc5fa633bf3cc462b93a306d353 Mon Sep 17 00:00:00 2001 From: LaurentBerger Date: Fri, 19 May 2017 09:19:07 +0200 Subject: [PATCH] try to solve issue #8748 --- modules/sfm/include/opencv2/sfm/reconstruct.hpp | 4 ++-- modules/sfm/include/opencv2/sfm/simple_pipeline.hpp | 8 ++++---- modules/sfm/samples/scene_reconstruction.cpp | 5 ++--- modules/sfm/samples/trajectory_reconstruccion.cpp | 5 ++--- modules/sfm/src/reconstruct.cpp | 4 ++-- modules/sfm/src/simple_pipeline.cpp | 12 +++++++----- .../sfm_installation/sfm_installation.markdown | 5 ++--- 7 files changed, 21 insertions(+), 22 deletions(-) diff --git a/modules/sfm/include/opencv2/sfm/reconstruct.hpp b/modules/sfm/include/opencv2/sfm/reconstruct.hpp index 2c1267deb7..d11b622779 100644 --- a/modules/sfm/include/opencv2/sfm/reconstruct.hpp +++ b/modules/sfm/include/opencv2/sfm/reconstruct.hpp @@ -108,7 +108,7 @@ reconstruct(InputArrayOfArrays points2d, OutputArray Rs, OutputArray Ts, InputOu */ CV_EXPORTS void -reconstruct(const std::vector images, OutputArray Ps, OutputArray points3d, +reconstruct(const std::vector images, OutputArray Ps, OutputArray points3d, InputOutputArray K, bool is_projective = false); /** @brief Reconstruct 3d points from 2d images while performing autocalibration. @@ -128,7 +128,7 @@ reconstruct(const std::vector images, OutputArray Ps, OutputArray p */ CV_EXPORTS void -reconstruct(const std::vector images, OutputArray Rs, OutputArray Ts, +reconstruct(const std::vector images, OutputArray Rs, OutputArray Ts, InputOutputArray K, OutputArray points3d, bool is_projective = false); #endif /* CV_DOXYGEN || CERES_FOUND */ diff --git a/modules/sfm/include/opencv2/sfm/simple_pipeline.hpp b/modules/sfm/include/opencv2/sfm/simple_pipeline.hpp index 79e96e5874..d882fa88fa 100644 --- a/modules/sfm/include/opencv2/sfm/simple_pipeline.hpp +++ b/modules/sfm/include/opencv2/sfm/simple_pipeline.hpp @@ -166,8 +166,8 @@ class CV_EXPORTS_W BaseSFM virtual void run(InputArrayOfArrays points2d, InputOutputArray K, OutputArray Rs, OutputArray Ts, OutputArray points3d) = 0; - virtual void run(const std::vector &images) = 0; - virtual void run(const std::vector &images, InputOutputArray K, OutputArray Rs, + virtual void run(const std::vector &images) = 0; + virtual void run(const std::vector &images, InputOutputArray K, OutputArray Rs, OutputArray Ts, OutputArray points3d) = 0; CV_WRAP virtual double getError() const = 0; @@ -219,7 +219,7 @@ class CV_EXPORTS_W SFMLibmvEuclideanReconstruction : public BaseSFM - The images must be ordered as they were an image sequence. Additionally, each frame should be as close as posible to the previous and posterior. - For now DAISY features are used in order to compute the 2d points tracks and it only works for 3-4 images. */ - virtual void run(const std::vector &images) = 0; + virtual void run(const std::vector &images) = 0; /** @brief Calls the pipeline in order to perform Eclidean reconstruction. @param images a vector of string with the images paths. @@ -232,7 +232,7 @@ class CV_EXPORTS_W SFMLibmvEuclideanReconstruction : public BaseSFM - The images must be ordered as they were an image sequence. Additionally, each frame should be as close as posible to the previous and posterior. - For now DAISY features are used in order to compute the 2d points tracks and it only works for 3-4 images. */ - virtual void run(const std::vector &images, InputOutputArray K, OutputArray Rs, + virtual void run(const std::vector &images, InputOutputArray K, OutputArray Rs, OutputArray Ts, OutputArray points3d) = 0; /** @brief Returns the computed reprojection error. diff --git a/modules/sfm/samples/scene_reconstruction.cpp b/modules/sfm/samples/scene_reconstruction.cpp index 3f95667497..95f86d45eb 100644 --- a/modules/sfm/samples/scene_reconstruction.cpp +++ b/modules/sfm/samples/scene_reconstruction.cpp @@ -5,7 +5,6 @@ #include #include -#include using namespace std; using namespace cv; @@ -29,7 +28,7 @@ static void help() { } -int getdir(const string _filename, vector &files) +int getdir(const string _filename, vector &files) { ifstream myfile(_filename.c_str()); if (!myfile.is_open()) { @@ -57,7 +56,7 @@ int main(int argc, char* argv[]) // Parse the image paths - vector images_paths; + vector images_paths; getdir( argv[1], images_paths ); diff --git a/modules/sfm/samples/trajectory_reconstruccion.cpp b/modules/sfm/samples/trajectory_reconstruccion.cpp index 5c3dc70922..487625d816 100644 --- a/modules/sfm/samples/trajectory_reconstruccion.cpp +++ b/modules/sfm/samples/trajectory_reconstruccion.cpp @@ -4,7 +4,6 @@ #include #include -#include using namespace std; using namespace cv; @@ -52,7 +51,7 @@ static void help() { */ void -parser_2D_tracks(const string &_filename, std::vector &points2d ) +parser_2D_tracks(const String &_filename, std::vector &points2d ) { ifstream myfile(_filename.c_str()); @@ -213,7 +212,7 @@ int main(int argc, char** argv) viz::WCube cube_widget(Point3f(0.1,0.1,0.0), Point3f(0.0,0.0,-0.1), true, viz::Color::blue()); cube_widget.setRenderingProperty(viz::LINE_WIDTH, 2.0); - window_est.showWidget("Cube"+string(buffer), cube_widget, point_pose); + window_est.showWidget("Cube"+String(buffer), cube_widget, point_pose); } Affine3d cam_pose = path_est[idx]; diff --git a/modules/sfm/src/reconstruct.cpp b/modules/sfm/src/reconstruct.cpp index 724ef701e8..254678ac95 100644 --- a/modules/sfm/src/reconstruct.cpp +++ b/modules/sfm/src/reconstruct.cpp @@ -188,7 +188,7 @@ namespace sfm void - reconstruct(const std::vector images, OutputArray Ps, OutputArray points3d, + reconstruct(const std::vector images, OutputArray Ps, OutputArray points3d, InputOutputArray K, bool is_projective) { const int nviews = static_cast(images.size()); @@ -232,7 +232,7 @@ namespace sfm void - reconstruct(const std::vector images, OutputArray Rs, OutputArray Ts, + reconstruct(const std::vector images, OutputArray Rs, OutputArray Ts, InputOutputArray K, OutputArray points3d, bool is_projective) { const int nviews = static_cast(images.size()); diff --git a/modules/sfm/src/simple_pipeline.cpp b/modules/sfm/src/simple_pipeline.cpp index 0694057826..e7711aea60 100644 --- a/modules/sfm/src/simple_pipeline.cpp +++ b/modules/sfm/src/simple_pipeline.cpp @@ -116,19 +116,21 @@ parser_2D_tracks( const libmv::Matches &matches, libmv::Tracks &tracks ) */ libmv_Reconstruction *libmv_solveReconstructionImpl( - const std::vector &images, + const std::vector &images, const libmv_CameraIntrinsicsOptions* libmv_camera_intrinsics_options, libmv_ReconstructionOptions* libmv_reconstruction_options) { Ptr edetector = ORB::create(10000); Ptr edescriber = xfeatures2d::DAISY::create(); //Ptr edescriber = xfeatures2d::LATCH::create(64, true, 4); - + std::vector sImages; + for (int i=0;i &images) + virtual void run(const std::vector &images) { // Set libmv logs level libmv_initLogging(""); @@ -217,7 +219,7 @@ class SFMLibmvReconstructionImpl : public T } - virtual void run(const std::vector &images, InputOutputArray K, OutputArray Rs, + virtual void run(const std::vector &images, InputOutputArray K, OutputArray Rs, OutputArray Ts, OutputArray points3d) { // Run the pipeline diff --git a/modules/sfm/tutorials/sfm_installation/sfm_installation.markdown b/modules/sfm/tutorials/sfm_installation/sfm_installation.markdown index 7b7d5df1f9..b450f6e1df 100644 --- a/modules/sfm/tutorials/sfm_installation/sfm_installation.markdown +++ b/modules/sfm/tutorials/sfm_installation/sfm_installation.markdown @@ -7,11 +7,10 @@ Dependencies The Structure from Motion module depends on some open source libraries. - [Eigen](http://eigen.tuxfamily.org) 3.2.2 or later. \b Required - - [GLog](http://code.google.com/p/google-glog) 0.3.1 or later. \b Required - - [GFlags](http://code.google.com/p/gflags). \b Required + - [GLog](https://github.com/google/glog) 0.3.1 or later. \b Required + - [GFlags]( https://github.com/gflags). \b Required - [Ceres Solver](http://ceres-solver.org). Needed by the reconstruction API in order to solve part of the Bundle Adjustment plus the points Intersect. If Ceres Solver is not installed on your system, the reconstruction funcionality will be disabled. \b Recommended -@note The module is only available for Linux/GNU systems. Installation