[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42186] branches/soc-2011-tomato: Camera tracking: progress report clean-up
Sergey Sharybin
sergey.vfx at gmail.com
Sun Nov 27 11:35:00 CET 2011
Revision: 42186
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42186
Author: nazgul
Date: 2011-11-27 10:35:00 +0000 (Sun, 27 Nov 2011)
Log Message:
-----------
Camera tracking: progress report clean-up
Send object which implements ProgressUpdateCallback to complete reconstruction
function rather than sending C-like procedure variable and context.
Modified Paths:
--------------
branches/soc-2011-tomato/extern/libmv/CMakeLists.txt
branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/pipeline.cc
branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/pipeline.h
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
branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h
Added Paths:
-----------
branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/callbacks.cc
branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/callbacks.h
Modified: branches/soc-2011-tomato/extern/libmv/CMakeLists.txt
===================================================================
--- branches/soc-2011-tomato/extern/libmv/CMakeLists.txt 2011-11-27 03:49:09 UTC (rev 42185)
+++ branches/soc-2011-tomato/extern/libmv/CMakeLists.txt 2011-11-27 10:35:00 UTC (rev 42186)
@@ -39,6 +39,7 @@
libmv-capi.cpp
libmv/numeric/numeric.cc
libmv/numeric/poly.cc
+ libmv/simple_pipeline/callbacks.cc
libmv/simple_pipeline/reconstruction.cc
libmv/simple_pipeline/resect.cc
libmv/simple_pipeline/intersect.cc
@@ -83,6 +84,7 @@
libmv/numeric/poly.h
libmv/numeric/function_derivative.h
libmv/numeric/numeric.h
+ libmv/simple_pipeline/callbacks.h
libmv/simple_pipeline/resect.h
libmv/simple_pipeline/reconstruction.h
libmv/simple_pipeline/camera_intrinsics.h
Added: branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/callbacks.cc
===================================================================
--- branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/callbacks.cc (rev 0)
+++ branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/callbacks.cc 2011-11-27 10:35:00 UTC (rev 42186)
@@ -0,0 +1,29 @@
+// Copyright (c) 2011 libmv authors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+#include "libmv/simple_pipeline/callbacks.h"
+
+namespace libmv {
+
+void ProgressUpdateCallback::invoke(double progress, const char* message)
+{
+}
+
+} // namespace libmv
Added: branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/callbacks.h
===================================================================
--- branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/callbacks.h (rev 0)
+++ branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/callbacks.h 2011-11-27 10:35:00 UTC (rev 42186)
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 libmv authors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+#ifndef LIBMV_SIMPLE_PIPELINE_CALLBACKS_H_
+#define LIBMV_SIMPLE_PIPELINE_CALLBACKS_H_
+
+namespace libmv {
+
+class ProgressUpdateCallback {
+ public:
+ virtual void invoke(double progress, const char *message);
+};
+
+} // namespace libmv
+
+#endif // LIBMV_SIMPLE_PIPELINE_MARKERS_H_
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-27 03:49:09 UTC (rev 42185)
+++ branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/pipeline.cc 2011-11-27 10:35:00 UTC (rev 42186)
@@ -118,18 +118,19 @@
} // namespace
-static void CompleteReconstructionLogProress(progress_update_callback update_callback,
- void *update_customdata,
+static void CompleteReconstructionLogProress(ProgressUpdateCallback *update_callback,
double progress,
- const char *step)
+ const char *step = NULL)
{
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);
+
+ update_callback->invoke(progress, message);
}
}
@@ -137,8 +138,7 @@
void InternalCompleteReconstruction(
const Tracks &tracks,
typename PipelineRoutines::Reconstruction *reconstruction,
- progress_update_callback update_callback,
- void *update_customdata) {
+ ProgressUpdateCallback *update_callback = NULL) {
int max_track = tracks.MaxTrack();
int max_image = tracks.MaxImage();
int num_resects = -1;
@@ -167,16 +167,15 @@
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);
+ CompleteReconstructionLogProress(update_callback,
+ (double)tot_resects/(max_image));
PipelineRoutines::Intersect(reconstructed_markers, reconstruction);
num_intersects++;
LG << "Ran Intersect() for track " << track;
}
}
if (num_intersects) {
- CompleteReconstructionLogProress(update_callback, update_customdata,
+ CompleteReconstructionLogProress(update_callback,
(double)tot_resects/(max_image),
"Bundling...");
PipelineRoutines::Bundle(tracks, reconstruction);
@@ -203,9 +202,8 @@
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);
+ CompleteReconstructionLogProress(update_callback,
+ (double)tot_resects/(max_image));
if (PipelineRoutines::Resect(reconstructed_markers, reconstruction, false)) {
num_resects++;
tot_resects++;
@@ -216,7 +214,7 @@
}
}
if (num_resects) {
- CompleteReconstructionLogProress(update_callback, update_customdata,
+ CompleteReconstructionLogProress(update_callback,
(double)tot_resects/(max_image),
"Bundling...");
PipelineRoutines::Bundle(tracks, reconstruction);
@@ -240,9 +238,8 @@
}
}
if (reconstructed_markers.size() >= 5) {
- CompleteReconstructionLogProress(update_callback, update_customdata,
- (double)tot_resects/(max_image),
- NULL);
+ CompleteReconstructionLogProress(update_callback,
+ (double)tot_resects/(max_image));
if (PipelineRoutines::Resect(reconstructed_markers, reconstruction, true)) {
num_resects++;
LG << "Ran Resect() for image " << image;
@@ -252,7 +249,7 @@
}
}
if (num_resects) {
- CompleteReconstructionLogProress(update_callback, update_customdata,
+ CompleteReconstructionLogProress(update_callback,
(double)tot_resects/(max_image),
"Bundling...");
PipelineRoutines::Bundle(tracks, reconstruction);
@@ -329,19 +326,16 @@
void EuclideanCompleteReconstruction(const Tracks &tracks,
EuclideanReconstruction *reconstruction,
- progress_update_callback update_callback,
- void *update_customdata) {
+ ProgressUpdateCallback *update_callback) {
InternalCompleteReconstruction<EuclideanPipelineRoutines>(tracks,
reconstruction,
- update_callback,
- update_customdata);
+ update_callback);
}
void ProjectiveCompleteReconstruction(const Tracks &tracks,
ProjectiveReconstruction *reconstruction) {
InternalCompleteReconstruction<ProjectivePipelineRoutines>(tracks,
- reconstruction,
- NULL, NULL);
+ reconstruction);
}
void InvertIntrinsicsForTracks(const Tracks &raw_tracks,
Modified: branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/pipeline.h
===================================================================
--- branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/pipeline.h 2011-11-27 03:49:09 UTC (rev 42185)
+++ branches/soc-2011-tomato/extern/libmv/libmv/simple_pipeline/pipeline.h 2011-11-27 10:35:00 UTC (rev 42186)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list