diff --git a/modules/sfm/include/opencv2/sfm/reconstruct.hpp b/modules/sfm/include/opencv2/sfm/reconstruct.hpp index 2c1267deb..d11b62277 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 79e96e587..d882fa88f 100644 --- a/modules/sfm/include/opencv2/sfm/simple_pipeline.hpp +++ b/modules/sfm/include/opencv2/sfm/simple_pipeline.hpp @@ -166,8 +166,8 @@ public: 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 @@ public: - 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 @@ public: - 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 3f9566749..95f86d45e 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 5c3dc7092..487625d81 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 724ef701e..254678ac9 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 069405782..e7711aea6 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 @@ public: } - 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 7b7d5df1f..b450f6e1d 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