[Bf-blender-cvs] [5ef5fff] soc-2016-multiview: The pipeline can run now, but the reconstruction error is huge

Tianwei Shen noreply at git.blender.org
Wed Jun 29 17:46:47 CEST 2016


Commit: 5ef5fff336550aed96c0aa99ee694760d0b71fd3
Author: Tianwei Shen
Date:   Wed Jun 29 23:46:23 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rB5ef5fff336550aed96c0aa99ee694760d0b71fd3

The pipeline can run now, but the reconstruction error is huge

===================================================================

M	intern/libmv/libmv/autotrack/pipeline.cc
M	source/blender/blenloader/intern/writefile.c

===================================================================

diff --git a/intern/libmv/libmv/autotrack/pipeline.cc b/intern/libmv/libmv/autotrack/pipeline.cc
index 7bd99e4..2f976fa 100644
--- a/intern/libmv/libmv/autotrack/pipeline.cc
+++ b/intern/libmv/libmv/autotrack/pipeline.cc
@@ -325,6 +325,7 @@ void EuclideanScaleToUnity(Reconstruction *reconstruction) {
   int clip_num = reconstruction->GetClipNum();
   const vector<vector<CameraPose> >& all_cameras = reconstruction->camera_poses();
 
+  LG << "[EuclideanScaleToUnity] camera number: " << clip_num << '\n';
   // Calculate center of the mass of all cameras.
   int total_valid_cameras = 0;
   Vec3 cameras_mass_center = Vec3::Zero();
@@ -337,6 +338,7 @@ void EuclideanScaleToUnity(Reconstruction *reconstruction) {
     }
   }
   cameras_mass_center /= total_valid_cameras;
+  LG << "[EuclideanScaleToUnity] camera number: " << total_valid_cameras << '\n';
 
   // Find the most distant camera from the mass center.
   double max_distance = 0.0;
@@ -359,9 +361,12 @@ void EuclideanScaleToUnity(Reconstruction *reconstruction) {
   // Rescale cameras positions.
   for(int i = 0; i < clip_num; i++) {
     for (int j = 0; j < all_cameras[i].size(); ++j) {
-      int image = all_cameras[i][j].frame;
-      CameraPose *camera = reconstruction->CameraPoseForFrame(i, image);
-      camera->t = camera->t * scale_factor;
+      int frame = all_cameras[i][j].frame;
+      CameraPose *camera = reconstruction->CameraPoseForFrame(i, frame);
+	  if (camera != NULL)
+        camera->t = camera->t * scale_factor;
+      else
+        LG << "[EuclideanScaleToUnity] invalid camera: " << i << " " << frame << "\n";
     }
   }
 
@@ -370,7 +375,10 @@ void EuclideanScaleToUnity(Reconstruction *reconstruction) {
   for (int i = 0; i < all_points.size(); ++i) {
     int track = all_points[i].track;
     Point *point = reconstruction->PointForTrack(track);
-    point->X = point->X * scale_factor;
+    if(point != NULL)
+      point->X = point->X * scale_factor;
+    else
+      LG << "[EuclideanScaleToUnity] invalid point: " << i << "\n";
   }
 }
 
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 61fdad2..4badb55 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -3467,7 +3467,7 @@ static void write_movieCorrespondences(WriteData *wd, ListBase *correspondence_b
 {
 	MovieTrackingCorrespondence *corr;
 	for (corr = correspondence_base->first; corr != NULL; corr = corr->next) {
-		writestruct(wd, DATA, "MovieTrackingCorrespondence", 1, corr);
+		writestruct(wd, DATA, MovieTrackingCorrespondence, 1, corr);
 	}
 }




More information about the Bf-blender-cvs mailing list