Skip to content

Commit

Permalink
try to solve issue #8748
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentBerger committed May 19, 2017
1 parent 27bf9e2 commit 03f0b94
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions modules/sfm/include/opencv2/sfm/reconstruct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ reconstruct(InputArrayOfArrays points2d, OutputArray Rs, OutputArray Ts, InputOu
*/
CV_EXPORTS
void
reconstruct(const std::vector<std::string> images, OutputArray Ps, OutputArray points3d,
reconstruct(const std::vector<String> images, OutputArray Ps, OutputArray points3d,
InputOutputArray K, bool is_projective = false);

/** @brief Reconstruct 3d points from 2d images while performing autocalibration.
Expand All @@ -128,7 +128,7 @@ reconstruct(const std::vector<std::string> images, OutputArray Ps, OutputArray p
*/
CV_EXPORTS
void
reconstruct(const std::vector<std::string> images, OutputArray Rs, OutputArray Ts,
reconstruct(const std::vector<String> images, OutputArray Rs, OutputArray Ts,
InputOutputArray K, OutputArray points3d, bool is_projective = false);

#endif /* CV_DOXYGEN || CERES_FOUND */
Expand Down
8 changes: 4 additions & 4 deletions modules/sfm/include/opencv2/sfm/simple_pipeline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> &images) = 0;
virtual void run(const std::vector<std::string> &images, InputOutputArray K, OutputArray Rs,
virtual void run(const std::vector<String> &images) = 0;
virtual void run(const std::vector<String> &images, InputOutputArray K, OutputArray Rs,
OutputArray Ts, OutputArray points3d) = 0;

CV_WRAP virtual double getError() const = 0;
Expand Down Expand Up @@ -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<std::string> &images) = 0;
virtual void run(const std::vector<String> &images) = 0;

/** @brief Calls the pipeline in order to perform Eclidean reconstruction.
@param images a vector of string with the images paths.
Expand All @@ -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<std::string> &images, InputOutputArray K, OutputArray Rs,
virtual void run(const std::vector<String> &images, InputOutputArray K, OutputArray Rs,
OutputArray Ts, OutputArray points3d) = 0;

/** @brief Returns the computed reprojection error.
Expand Down
5 changes: 2 additions & 3 deletions modules/sfm/samples/scene_reconstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include <iostream>
#include <fstream>
#include <string>

using namespace std;
using namespace cv;
Expand All @@ -29,7 +28,7 @@ static void help() {
}


int getdir(const string _filename, vector<string> &files)
int getdir(const string _filename, vector<String> &files)
{
ifstream myfile(_filename.c_str());
if (!myfile.is_open()) {
Expand Down Expand Up @@ -57,7 +56,7 @@ int main(int argc, char* argv[])

// Parse the image paths

vector<string> images_paths;
vector<String> images_paths;
getdir( argv[1], images_paths );


Expand Down
5 changes: 2 additions & 3 deletions modules/sfm/samples/trajectory_reconstruccion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include <iostream>
#include <fstream>
#include <string>

using namespace std;
using namespace cv;
Expand Down Expand Up @@ -52,7 +51,7 @@ static void help() {
*/

void
parser_2D_tracks(const string &_filename, std::vector<Mat> &points2d )
parser_2D_tracks(const String &_filename, std::vector<Mat> &points2d )
{
ifstream myfile(_filename.c_str());

Expand Down Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions modules/sfm/src/reconstruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ namespace sfm


void
reconstruct(const std::vector<std::string> images, OutputArray Ps, OutputArray points3d,
reconstruct(const std::vector<cv::String> images, OutputArray Ps, OutputArray points3d,
InputOutputArray K, bool is_projective)
{
const int nviews = static_cast<int>(images.size());
Expand Down Expand Up @@ -232,7 +232,7 @@ namespace sfm


void
reconstruct(const std::vector<std::string> images, OutputArray Rs, OutputArray Ts,
reconstruct(const std::vector<cv::String> images, OutputArray Rs, OutputArray Ts,
InputOutputArray K, OutputArray points3d, bool is_projective)
{
const int nviews = static_cast<int>(images.size());
Expand Down
12 changes: 7 additions & 5 deletions modules/sfm/src/simple_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,21 @@ parser_2D_tracks( const libmv::Matches &matches, libmv::Tracks &tracks )
*/

libmv_Reconstruction *libmv_solveReconstructionImpl(
const std::vector<std::string> &images,
const std::vector<String> &images,
const libmv_CameraIntrinsicsOptions* libmv_camera_intrinsics_options,
libmv_ReconstructionOptions* libmv_reconstruction_options)
{
Ptr<Feature2D> edetector = ORB::create(10000);
Ptr<Feature2D> edescriber = xfeatures2d::DAISY::create();
//Ptr<Feature2D> edescriber = xfeatures2d::LATCH::create(64, true, 4);

std::vector<std::string> sImages;
for (int i=0;i<images.size();i++)
sImages.push_back(images[i].c_str());
cout << "Initialize nViewMatcher ... ";
libmv::correspondence::nRobustViewMatching nViewMatcher(edetector, edescriber);

cout << "OK" << endl << "Performing Cross Matching ... ";
nViewMatcher.computeCrossMatch(images); cout << "OK" << endl;
nViewMatcher.computeCrossMatch(sImages); cout << "OK" << endl;

// Building tracks
libmv::Tracks tracks;
Expand Down Expand Up @@ -196,7 +198,7 @@ class SFMLibmvReconstructionImpl : public T
/* Run the pipeline given a set of images
*/

virtual void run(const std::vector <std::string> &images)
virtual void run(const std::vector <String> &images)
{
// Set libmv logs level
libmv_initLogging("");
Expand All @@ -217,7 +219,7 @@ class SFMLibmvReconstructionImpl : public T
}


virtual void run(const std::vector <string> &images, InputOutputArray K, OutputArray Rs,
virtual void run(const std::vector <String> &images, InputOutputArray K, OutputArray Rs,
OutputArray Ts, OutputArray points3d)
{
// Run the pipeline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 03f0b94

Please sign in to comment.