@@ -118,7 +118,8 @@ parser_2D_tracks( const libmv::Matches &matches, libmv::Tracks &tracks )
118
118
* reconstruction pipeline.
119
119
*/
120
120
121
- static libmv_Reconstruction *libmv_solveReconstructionImpl (
121
+ static
122
+ std::shared_ptr<libmv_Reconstruction> libmv_solveReconstructionImpl (
122
123
const std::vector<String> &images,
123
124
const libmv_CameraIntrinsicsOptions* libmv_camera_intrinsics_options,
124
125
libmv_ReconstructionOptions* libmv_reconstruction_options)
@@ -182,9 +183,10 @@ class SFMLibmvReconstructionImpl : public T
182
183
183
184
// Perform reconstruction
184
185
libmv_reconstruction_ =
185
- * libmv_solveReconstruction (tracks,
186
+ libmv_solveReconstruction (tracks,
186
187
&libmv_camera_intrinsics_options_,
187
188
&libmv_reconstruction_options_);
189
+ CV_Assert (libmv_reconstruction_);
188
190
}
189
191
190
192
virtual void run (InputArrayOfArrays points2d, InputOutputArray K, OutputArray Rs,
@@ -216,9 +218,10 @@ class SFMLibmvReconstructionImpl : public T
216
218
// Perform reconstruction
217
219
218
220
libmv_reconstruction_ =
219
- * libmv_solveReconstructionImpl (images,
221
+ libmv_solveReconstructionImpl (images,
220
222
&libmv_camera_intrinsics_options_,
221
223
&libmv_reconstruction_options_);
224
+ CV_Assert (libmv_reconstruction_);
222
225
}
223
226
224
227
@@ -232,12 +235,12 @@ class SFMLibmvReconstructionImpl : public T
232
235
extractLibmvReconstructionData (K, Rs, Ts, points3d);
233
236
}
234
237
235
- virtual double getError () const { return libmv_reconstruction_. error ; }
238
+ virtual double getError () const { return libmv_reconstruction_-> error ; }
236
239
237
240
virtual void
238
241
getPoints (OutputArray points3d) {
239
242
const size_t n_points =
240
- libmv_reconstruction_. reconstruction .AllPoints ().size ();
243
+ libmv_reconstruction_-> reconstruction .AllPoints ().size ();
241
244
242
245
points3d.create (n_points, 1 , CV_64F);
243
246
@@ -246,22 +249,22 @@ class SFMLibmvReconstructionImpl : public T
246
249
{
247
250
for ( int j = 0 ; j < 3 ; ++j )
248
251
point3d[j] =
249
- libmv_reconstruction_. reconstruction .AllPoints ()[i].X [j];
252
+ libmv_reconstruction_-> reconstruction .AllPoints ()[i].X [j];
250
253
Mat (point3d).copyTo (points3d.getMatRef (i));
251
254
}
252
255
253
256
}
254
257
255
258
virtual cv::Mat getIntrinsics () const {
256
259
Mat K;
257
- eigen2cv (libmv_reconstruction_. intrinsics ->K (), K);
260
+ eigen2cv (libmv_reconstruction_-> intrinsics ->K (), K);
258
261
return K;
259
262
}
260
263
261
264
virtual void
262
265
getCameras (OutputArray Rs, OutputArray Ts) {
263
266
const size_t n_views =
264
- libmv_reconstruction_. reconstruction .AllCameras ().size ();
267
+ libmv_reconstruction_-> reconstruction .AllCameras ().size ();
265
268
266
269
Rs.create (n_views, 1 , CV_64F);
267
270
Ts.create (n_views, 1 , CV_64F);
@@ -270,8 +273,8 @@ class SFMLibmvReconstructionImpl : public T
270
273
Vec3d t;
271
274
for (size_t i = 0 ; i < n_views; ++i)
272
275
{
273
- eigen2cv (libmv_reconstruction_. reconstruction .AllCameras ()[i].R , R);
274
- eigen2cv (libmv_reconstruction_. reconstruction .AllCameras ()[i].t , t);
276
+ eigen2cv (libmv_reconstruction_-> reconstruction .AllCameras ()[i].R , R);
277
+ eigen2cv (libmv_reconstruction_-> reconstruction .AllCameras ()[i].t , t);
275
278
Mat (R).copyTo (Rs.getMatRef (i));
276
279
Mat (t).copyTo (Ts.getMatRef (i));
277
280
}
@@ -300,7 +303,7 @@ class SFMLibmvReconstructionImpl : public T
300
303
getIntrinsics ().copyTo (K.getMat ());
301
304
}
302
305
303
- libmv_Reconstruction libmv_reconstruction_;
306
+ std::shared_ptr< libmv_Reconstruction> libmv_reconstruction_;
304
307
libmv_ReconstructionOptions libmv_reconstruction_options_;
305
308
libmv_CameraIntrinsicsOptions libmv_camera_intrinsics_options_;
306
309
};
0 commit comments