[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42161] branches/soc-2011-tomato: Camera tracking: cleaned progress reporting stuff and made a bit more verbose
Sergey Sharybin
sergey.vfx at gmail.com
Fri Nov 25 16:43:38 CET 2011
Revision: 42161
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42161
Author: nazgul
Date: 2011-11-25 15:43:38 +0000 (Fri, 25 Nov 2011)
Log Message:
-----------
Camera tracking: cleaned progress reporting stuff and made a bit more verbose
Modified Paths:
--------------
branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/pipeline.cc
branches/soc-2011-tomato/extern/libmv/libmv-capi.cpp
branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
Modified: branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/pipeline.cc
===================================================================
--- branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/pipeline.cc 2011-11-25 15:32:23 UTC (rev 42160)
+++ branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/pipeline.cc 2011-11-25 15:43:38 UTC (rev 42161)
@@ -118,6 +118,21 @@
} // namespace
+static void CompleteReconstructionLogProress(progress_update_callback update_callback,
+ void *update_customdata,
+ double progress,
+ const char *step)
+{
+ if(update_callback) {
+ char message[256];
+ if(step)
+ snprintf(message, sizeof(message), "Completing solution %d%% | %s", (int)(progress*100), step);
+ else
+ snprintf(message, sizeof(message), "Completing solution %d%%", (int)(progress*100));
+ update_callback(update_customdata, progress, message);
+ }
+}
+
template<typename PipelineRoutines>
void InternalCompleteReconstruction(
const Tracks &tracks,
@@ -152,12 +167,18 @@
LG << "Got " << reconstructed_markers.size()
<< " reconstructed markers for track " << track;
if (reconstructed_markers.size() >= 2) {
+ CompleteReconstructionLogProress(update_callback, update_customdata,
+ (double)tot_resects/(max_image),
+ NULL);
PipelineRoutines::Intersect(reconstructed_markers, reconstruction);
num_intersects++;
LG << "Ran Intersect() for track " << track;
}
}
if (num_intersects) {
+ CompleteReconstructionLogProress(update_callback, update_customdata,
+ (double)tot_resects/(max_image),
+ "Bundling...");
PipelineRoutines::Bundle(tracks, reconstruction);
LG << "Ran Bundle() after intersections.";
}
@@ -182,11 +203,12 @@
LG << "Got " << reconstructed_markers.size()
<< " reconstructed markers for image " << image;
if (reconstructed_markers.size() >= 5) {
+ CompleteReconstructionLogProress(update_callback, update_customdata,
+ (double)tot_resects/(max_image),
+ NULL);
if (PipelineRoutines::Resect(reconstructed_markers, reconstruction, false)) {
num_resects++;
tot_resects++;
- if(update_callback)
- update_callback(update_customdata, (float)tot_resects/(max_image), "Completing solution");
LG << "Ran Resect() for image " << image;
} else {
LG << "Failed Resect() for image " << image;
@@ -194,6 +216,9 @@
}
}
if (num_resects) {
+ CompleteReconstructionLogProress(update_callback, update_customdata,
+ (double)tot_resects/(max_image),
+ "Bundling...");
PipelineRoutines::Bundle(tracks, reconstruction);
}
LG << "Did " << num_resects << " resects.";
@@ -215,17 +240,21 @@
}
}
if (reconstructed_markers.size() >= 5) {
+ CompleteReconstructionLogProress(update_callback, update_customdata,
+ (double)tot_resects/(max_image),
+ NULL);
if (PipelineRoutines::Resect(reconstructed_markers, reconstruction, true)) {
num_resects++;
LG << "Ran Resect() for image " << image;
- if(update_callback)
- update_callback(update_customdata, (float)tot_resects/(max_image), "Completing solution");
} else {
LG << "Failed Resect() for image " << image;
}
}
}
if (num_resects) {
+ CompleteReconstructionLogProress(update_callback, update_customdata,
+ (double)tot_resects/(max_image),
+ "Bundling...");
PipelineRoutines::Bundle(tracks, reconstruction);
}
}
@@ -253,7 +282,7 @@
PipelineRoutines::ProjectMarker(*point, *camera, intrinsics);
double ex = reprojected_marker.x - markers[i].x;
double ey = reprojected_marker.y - markers[i].y;
-
+#if 0
const int N = 100;
char line[N];
snprintf(line, N,
@@ -271,6 +300,7 @@
ex,
ey,
sqrt(ex*ex + ey*ey));
+#endif
total_error += sqrt(ex*ex + ey*ey);
}
LG << "Skipped " << num_skipped << " markers.";
Modified: branches/soc-2011-tomato/extern/libmv/libmv-capi.cpp
===================================================================
--- branches/soc-2011-tomato/extern/libmv/libmv-capi.cpp 2011-11-25 15:32:23 UTC (rev 42160)
+++ branches/soc-2011-tomato/extern/libmv/libmv-capi.cpp 2011-11-25 15:43:38 UTC (rev 42161)
@@ -385,7 +385,8 @@
normalized_tracks.MarkersForTracksInBothImages(keyframe1, keyframe2);
LG << "number of markers for init: " << keyframe_markers.size();
- progress_update_callback(callback_customdata, 0, "Initial reconstruction");
+ if(progress_update_callback)
+ progress_update_callback(callback_customdata, 0, "Initial reconstruction");
libmv::EuclideanReconstructTwoFrames(keyframe_markers, reconstruction);
libmv::EuclideanBundle(normalized_tracks, reconstruction);
@@ -408,11 +409,11 @@
libmv_refine_flags |= libmv::BUNDLE_RADIAL_K2;
}
- progress_update_callback(callback_customdata, 0, "Refining solution");
+ progress_update_callback(callback_customdata, 1.0, "Refining solution");
libmv::EuclideanBundleCommonIntrinsics(*(libmv::Tracks *)tracks, libmv_refine_flags, reconstruction, intrinsics);
}
- progress_update_callback(callback_customdata, 0, "Finishing solution");
+ progress_update_callback(callback_customdata, 1.0, "Finishing solution");
libmv_reconstruction->tracks = *(libmv::Tracks *)tracks;
libmv_reconstruction->error = libmv::EuclideanReprojectionError(*(libmv::Tracks *)tracks, *reconstruction, *intrinsics);
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c 2011-11-25 15:32:23 UTC (rev 42160)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c 2011-11-25 15:43:38 UTC (rev 42161)
@@ -1328,6 +1328,7 @@
short *stop;
short *do_update;
float *progress;
+ float stats_progress;
char *stats_message;
int message_size;
} ReconstructProgressData;
@@ -1627,11 +1628,8 @@
*progressdata->do_update= 1;
}
- if(progress) {
- BLI_snprintf(progressdata->stats_message, progressdata->message_size, "%s | %d%%", message, (int)(progress*100));
- } else {
- BLI_strncpy(progressdata->stats_message, message, progressdata->message_size);
- }
+ BLI_snprintf(progressdata->stats_message, progressdata->message_size, "Solving camera | %s", message);
+ progressdata->stats_progress= progress;
}
#if 0
Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c 2011-11-25 15:32:23 UTC (rev 42160)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c 2011-11-25 15:43:38 UTC (rev 42161)
@@ -1518,6 +1518,8 @@
ReportList *reports;
char stats_message[256];
+ float *stats_progress;
+
struct MovieReconstructContext *context;
} SolveCameraJob;
@@ -1555,12 +1557,17 @@
MovieTracking *tracking= &scj->clip->tracking;
BLI_strncpy(tracking->stats->message, scj->stats_message, sizeof(tracking->stats->message));
+
+ if(scj->stats_progress)
+ tracking->stats->progress= *scj->stats_progress;
}
static void solve_camera_startjob(void *scv, short *stop, short *do_update, float *progress)
{
SolveCameraJob *scj= (SolveCameraJob *)scv;
+ scj->stats_progress= progress;
+
BKE_tracking_solve_reconstruction(scj->context, stop, do_update, progress,
scj->stats_message, sizeof(scj->stats_message));
}
@@ -1665,7 +1672,7 @@
return OPERATOR_CANCELLED;
}
- BLI_strncpy(tracking->stats->message, "Preparing solve", sizeof(tracking->stats->message));
+ BLI_strncpy(tracking->stats->message, "Solving camera | Preparing solve", sizeof(tracking->stats->message));
/* hide reconstruction statistics from previous solve */
clip->tracking.reconstruction.flag&= ~TRACKING_RECONSTRUCTED;
@@ -1674,7 +1681,7 @@
/* setup job */
steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera", WM_JOB_PROGRESS);
WM_jobs_customdata(steve, scj, solve_camera_freejob);
- WM_jobs_timer(steve, 0.2, NC_MOVIECLIP|NA_EVALUATED, 0);
+ WM_jobs_timer(steve, 0.1, NC_MOVIECLIP|NA_EVALUATED, 0);
WM_jobs_callbacks(steve, solve_camera_startjob, NULL, solve_camera_updatejob, NULL);
G.afbreek= 0;
More information about the Bf-blender-cvs
mailing list