Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/extern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-10-19 16:46:30 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-10-19 16:46:30 +0400
commit3d3a449d950af7c68f35eff86b7052c2e468c869 (patch)
tree3f7cb00c9ca13c32dfac2b6b742d2325c8226ca1 /extern
parent2cd4e3772e70f5d2e8573b8e0c5dfdad97e0ba00 (diff)
Camera tracking integration
=========================== Initial implementation of graph view for movie tracking data. Used the same UI-side approach as preview region for sequencer: create region for graph-related information inside clip editor. It's easier and nicer than trying to hack graph editor which is currently designed to work with AnimData only. Trying to make it more abstract to deal with any kind of data doesn't seem be real benefit for now. Currently supported displaying per-frame average error and selected tracks' movement speed (pixels per frame). Additional changes: - Collect per-frame average error after solving. - Split space clip drawing code into different files. - Added per-frame average solving error.
Diffstat (limited to 'extern')
-rw-r--r--extern/libmv/libmv-capi.cpp31
-rw-r--r--extern/libmv/libmv-capi.h1
2 files changed, 32 insertions, 0 deletions
diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cpp
index 863e16515df..8a56135a8f6 100644
--- a/extern/libmv/libmv-capi.cpp
+++ b/extern/libmv/libmv-capi.cpp
@@ -457,6 +457,37 @@ double libmv_reporojectionErrorForTrack(libmv_Reconstruction *libmv_reconstructi
return total_error / num_reprojected;
}
+double libmv_reporojectionErrorForImage(libmv_Reconstruction *libmv_reconstruction, int image)
+{
+ libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction;
+ libmv::CameraIntrinsics *intrinsics = &libmv_reconstruction->intrinsics;
+ libmv::vector<libmv::Marker> markers = libmv_reconstruction->tracks.MarkersInImage(image);
+ const libmv::EuclideanCamera *camera = reconstruction->CameraForImage(image);
+ int num_reprojected = 0;
+ double total_error = 0.0;
+
+ if (!camera)
+ return 0;
+
+ for (int i = 0; i < markers.size(); ++i) {
+ const libmv::EuclideanPoint *point = reconstruction->PointForTrack(markers[i].track);
+
+ if (!point) {
+ continue;
+ }
+
+ num_reprojected++;
+
+ libmv::Marker reprojected_marker = ProjectMarker(*point, *camera, *intrinsics);
+ double ex = reprojected_marker.x - markers[i].x;
+ double ey = reprojected_marker.y - markers[i].y;
+
+ total_error += sqrt(ex*ex + ey*ey);
+ }
+
+ return total_error / num_reprojected;
+}
+
int libmv_reporojectionCameraForImage(libmv_Reconstruction *libmv_reconstruction, int image, double mat[4][4])
{
libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction;
diff --git a/extern/libmv/libmv-capi.h b/extern/libmv/libmv-capi.h
index d77e9ac62fa..e48b5526152 100644
--- a/extern/libmv/libmv-capi.h
+++ b/extern/libmv/libmv-capi.h
@@ -67,6 +67,7 @@ struct libmv_Reconstruction *libmv_solveReconstruction(struct libmv_Tracks *trac
double focal_length, double principal_x, double principal_y, double k1, double k2, double k3);
int libmv_reporojectionPointForTrack(struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]);
double libmv_reporojectionErrorForTrack(struct libmv_Reconstruction *libmv_reconstruction, int track);
+double libmv_reporojectionErrorForImage(struct libmv_Reconstruction *libmv_reconstruction, int image);
int libmv_reporojectionCameraForImage(struct libmv_Reconstruction *libmv_reconstruction, int image, double mat[4][4]);
double libmv_reprojectionError(struct libmv_Reconstruction *libmv_reconstruction);
void libmv_destroyReconstruction(struct libmv_Reconstruction *libmv_reconstruction);