Skip to content

Commit 5e4d9b0

Browse files
committed
Merge pull request #1172 from LaurentBerger:sfmstring
2 parents 941a33a + 03f0b94 commit 5e4d9b0

File tree

7 files changed

+21
-22
lines changed

7 files changed

+21
-22
lines changed

modules/sfm/include/opencv2/sfm/reconstruct.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ reconstruct(InputArrayOfArrays points2d, OutputArray Rs, OutputArray Ts, InputOu
108108
*/
109109
CV_EXPORTS
110110
void
111-
reconstruct(const std::vector<std::string> images, OutputArray Ps, OutputArray points3d,
111+
reconstruct(const std::vector<String> images, OutputArray Ps, OutputArray points3d,
112112
InputOutputArray K, bool is_projective = false);
113113

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

134134
#endif /* CV_DOXYGEN || CERES_FOUND */

modules/sfm/include/opencv2/sfm/simple_pipeline.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ class CV_EXPORTS_W BaseSFM
166166
virtual void run(InputArrayOfArrays points2d, InputOutputArray K, OutputArray Rs,
167167
OutputArray Ts, OutputArray points3d) = 0;
168168

169-
virtual void run(const std::vector<std::string> &images) = 0;
170-
virtual void run(const std::vector<std::string> &images, InputOutputArray K, OutputArray Rs,
169+
virtual void run(const std::vector<String> &images) = 0;
170+
virtual void run(const std::vector<String> &images, InputOutputArray K, OutputArray Rs,
171171
OutputArray Ts, OutputArray points3d) = 0;
172172

173173
CV_WRAP virtual double getError() const = 0;
@@ -219,7 +219,7 @@ class CV_EXPORTS_W SFMLibmvEuclideanReconstruction : public BaseSFM
219219
- 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.
220220
- For now DAISY features are used in order to compute the 2d points tracks and it only works for 3-4 images.
221221
*/
222-
virtual void run(const std::vector<std::string> &images) = 0;
222+
virtual void run(const std::vector<String> &images) = 0;
223223

224224
/** @brief Calls the pipeline in order to perform Eclidean reconstruction.
225225
@param images a vector of string with the images paths.
@@ -232,7 +232,7 @@ class CV_EXPORTS_W SFMLibmvEuclideanReconstruction : public BaseSFM
232232
- 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.
233233
- For now DAISY features are used in order to compute the 2d points tracks and it only works for 3-4 images.
234234
*/
235-
virtual void run(const std::vector<std::string> &images, InputOutputArray K, OutputArray Rs,
235+
virtual void run(const std::vector<String> &images, InputOutputArray K, OutputArray Rs,
236236
OutputArray Ts, OutputArray points3d) = 0;
237237

238238
/** @brief Returns the computed reprojection error.

modules/sfm/samples/scene_reconstruction.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include <iostream>
77
#include <fstream>
8-
#include <string>
98

109
using namespace std;
1110
using namespace cv;
@@ -29,7 +28,7 @@ static void help() {
2928
}
3029

3130

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

5857
// Parse the image paths
5958

60-
vector<string> images_paths;
59+
vector<String> images_paths;
6160
getdir( argv[1], images_paths );
6261

6362

modules/sfm/samples/trajectory_reconstruccion.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include <iostream>
66
#include <fstream>
7-
#include <string>
87

98
using namespace std;
109
using namespace cv;
@@ -52,7 +51,7 @@ static void help() {
5251
*/
5352

5453
void
55-
parser_2D_tracks(const string &_filename, std::vector<Mat> &points2d )
54+
parser_2D_tracks(const String &_filename, std::vector<Mat> &points2d )
5655
{
5756
ifstream myfile(_filename.c_str());
5857

@@ -213,7 +212,7 @@ int main(int argc, char** argv)
213212

214213
viz::WCube cube_widget(Point3f(0.1,0.1,0.0), Point3f(0.0,0.0,-0.1), true, viz::Color::blue());
215214
cube_widget.setRenderingProperty(viz::LINE_WIDTH, 2.0);
216-
window_est.showWidget("Cube"+string(buffer), cube_widget, point_pose);
215+
window_est.showWidget("Cube"+String(buffer), cube_widget, point_pose);
217216
}
218217

219218
Affine3d cam_pose = path_est[idx];

modules/sfm/src/reconstruct.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ namespace sfm
188188

189189

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

233233

234234
void
235-
reconstruct(const std::vector<std::string> images, OutputArray Rs, OutputArray Ts,
235+
reconstruct(const std::vector<cv::String> images, OutputArray Rs, OutputArray Ts,
236236
InputOutputArray K, OutputArray points3d, bool is_projective)
237237
{
238238
const int nviews = static_cast<int>(images.size());

modules/sfm/src/simple_pipeline.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,21 @@ parser_2D_tracks( const libmv::Matches &matches, libmv::Tracks &tracks )
116116
*/
117117

118118
libmv_Reconstruction *libmv_solveReconstructionImpl(
119-
const std::vector<std::string> &images,
119+
const std::vector<String> &images,
120120
const libmv_CameraIntrinsicsOptions* libmv_camera_intrinsics_options,
121121
libmv_ReconstructionOptions* libmv_reconstruction_options)
122122
{
123123
Ptr<Feature2D> edetector = ORB::create(10000);
124124
Ptr<Feature2D> edescriber = xfeatures2d::DAISY::create();
125125
//Ptr<Feature2D> edescriber = xfeatures2d::LATCH::create(64, true, 4);
126-
126+
std::vector<std::string> sImages;
127+
for (int i=0;i<images.size();i++)
128+
sImages.push_back(images[i].c_str());
127129
cout << "Initialize nViewMatcher ... ";
128130
libmv::correspondence::nRobustViewMatching nViewMatcher(edetector, edescriber);
129131

130132
cout << "OK" << endl << "Performing Cross Matching ... ";
131-
nViewMatcher.computeCrossMatch(images); cout << "OK" << endl;
133+
nViewMatcher.computeCrossMatch(sImages); cout << "OK" << endl;
132134

133135
// Building tracks
134136
libmv::Tracks tracks;
@@ -196,7 +198,7 @@ class SFMLibmvReconstructionImpl : public T
196198
/* Run the pipeline given a set of images
197199
*/
198200

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

219221

220-
virtual void run(const std::vector <string> &images, InputOutputArray K, OutputArray Rs,
222+
virtual void run(const std::vector <String> &images, InputOutputArray K, OutputArray Rs,
221223
OutputArray Ts, OutputArray points3d)
222224
{
223225
// Run the pipeline

modules/sfm/tutorials/sfm_installation/sfm_installation.markdown

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ Dependencies
77
The Structure from Motion module depends on some open source libraries.
88

99
- [Eigen](http://eigen.tuxfamily.org) 3.2.2 or later. \b Required
10-
- [GLog](http://code.google.com/p/google-glog) 0.3.1 or later. \b Required
11-
- [GFlags](http://code.google.com/p/gflags). \b Required
10+
- [GLog](https://github.com/google/glog) 0.3.1 or later. \b Required
11+
- [GFlags]( https://github.com/gflags). \b Required
1212
- [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
1313

14-
@note The module is only available for Linux/GNU systems.
1514

1615

1716
Installation

0 commit comments

Comments
 (0)