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
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-11-07 16:55:18 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-11-07 16:55:18 +0400
commit27d42c63d9b507b1771ed5a7923c389c719b877b (patch)
tree8dd4ca61e197a7053633f62b4a5d8091957724c4 /source/blender/makesdna/DNA_tracking_types.h
parente122dc0748f6a4d77b236e26beba93e2a9a36bf0 (diff)
Camera tracking integration
=========================== Commiting camera tracking integration gsoc project into trunk. This commit includes: - Bundled version of libmv library (with some changes against official repo, re-sync with libmv repo a bit later) - New datatype ID called MovieClip which is optimized to work with movie clips (both of movie files and image sequences) and doing camera/motion tracking operations. - New editor called Clip Editor which is currently used for motion/tracking stuff only, but which can be easily extended to work with masks too. This editor supports: * Loading movie files/image sequences * Build proxies with different size for loaded movie clip, also supports building undistorted proxies to increase speed of playback in undistorted mode. * Manual lens distortion mode calibration using grid and grease pencil * Supervised 2D tracking using two different algorithms KLT and SAD. * Basic algorithm for feature detection * Camera motion solving. scene orientation - New constraints to "link" scene objects with solved motions from clip: * Follow Track (make object follow 2D motion of track with given name or parent object to reconstructed 3D position of track) * Camera Solver to make camera moving in the same way as reconstructed camera This commit NOT includes changes from tomato branch: - New nodes (they'll be commited as separated patch) - Automatic image offset guessing for image input node and image editor (need to do more tests and gather more feedback) - Code cleanup in libmv-capi. It's not so critical cleanup, just increasing readability and understanadability of code. Better to make this chaneg when Keir will finish his current patch. More details about this project can be found on this page: http://wiki.blender.org/index.php/User:Nazg-gul/GSoC-2011 Further development of small features would be done in trunk, bigger/experimental features would first be implemented in tomato branch.
Diffstat (limited to 'source/blender/makesdna/DNA_tracking_types.h')
-rw-r--r--source/blender/makesdna/DNA_tracking_types.h217
1 files changed, 217 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
new file mode 100644
index 00000000000..b359ea3544d
--- /dev/null
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -0,0 +1,217 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Blender Foundation,
+ * Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef DNA_TRACKING_TYPES_H
+#define DNA_TRACKING_TYPES_H
+
+/** \file DNA_tracking_types.h
+ * \ingroup DNA
+ * \since may-2011
+ * \author Sergey Sharybin
+ */
+
+#include "DNA_listBase.h"
+
+/* match-moving data */
+
+struct ImBuf;
+struct MovieReconstructedCamera;
+struct MovieTrackingCamera;
+struct MovieTrackingBundle;
+struct MovieTrackingMarker;
+struct MovieTrackingTrack;
+struct MovieTracking;
+
+typedef struct MovieReconstructedCamera {
+ int framenr;
+ float error;
+ float mat[4][4];
+} MovieReconstructedCamera;
+
+typedef struct MovieTrackingCamera {
+ void *intrinsics; /* intrinsics handle */
+
+ float sensor_width; /* width of CCD sensor */
+ float pixel_aspect; /* pixel aspect ratio */
+ float pad;
+ float focal; /* focal length */
+ short units; /* units of focal length user is working with */
+ short pad1;
+ float principal[2]; /* principal point */
+ float k1, k2, k3; /* radial distortion */
+} MovieTrackingCamera;
+
+typedef struct MovieTrackingMarker {
+ float pos[2]; /* 2d position of marker on frame (in unified 0..1 space) */
+ int framenr; /* number of frame marker is associated with */
+ int flag; /* Marker's flag (alive, ...) */
+} MovieTrackingMarker;
+
+typedef struct MovieTrackingTrack {
+ struct MovieTrackingTrack *next, *prev;
+
+ char name[24];
+
+ /* ** setings ** */
+ float pat_min[2], pat_max[2]; /* positions of left-bottom and right-top corners of pattern (in unified 0..1 space) */
+ float search_min[2], search_max[2]; /* positions of left-bottom and right-top corners of search area (in unified 0..1 space) */
+ float offset[2]; /* offset to "parenting" point */
+
+ /* ** track ** */
+ int markersnr; /* count of markers in track */
+ int last_marker; /* most recently used marker */
+ MovieTrackingMarker *markers; /* markers in track */
+
+ /* ** reconstruction data ** */
+ float bundle_pos[3]; /* reconstructed position */
+ float error; /* average track reprojection error */
+
+ int pad;
+
+ /* ** UI editing ** */
+ int flag, pat_flag, search_flag; /* flags (selection, ...) */
+ short transflag; /* transform flags */
+ char pad3[2];
+ float color[3]; /* custom color for track */
+
+ /* tracking algorithm to use; can be KLT or SAD */
+ short tracker;
+ char pad4[2];
+
+ /* ** SAD tracker settings ** */
+ float minimum_correlation; /* minimal correlation which is still treated as successful tracking */
+
+ /* ** KLT tracker settings ** */
+ int pyramid_levels; /* number of pyramid levels to use for KLT tracking */
+ char pad5[4];
+} MovieTrackingTrack;
+
+typedef struct MovieTrackingSettings {
+ /* ** common tracker settings ** */
+ short speed; /* speed of tracking */
+ short frames_limit; /* number of frames to be tarcked during single tracking session (if TRACKING_FRAMES_LIMIT is set) */
+ short margin; /* margin from frame boundaries */
+ char pad[2];
+
+ int adjframes; /* re-adjust every N frames */
+
+ /* ** reconstruction settings ** */
+ int keyframe1, keyframe2; /* two keyframes for reconstrution initialization */
+
+ /* ** tool settings ** */
+
+ /* set scale */
+ float dist; /* distance between two bundles used for scene scaling */
+
+ /* cleanup */
+ int clean_frames, clean_action;
+ float clean_error;
+} MovieTrackingSettings;
+
+typedef struct MovieTrackingStabilization {
+ int flag;
+ int tot_track, act_track; /* total number and index of active track in list */
+
+ /* 2d stabilization */
+ float maxscale; /* max auto-scale factor */
+ MovieTrackingTrack *rot_track; /* track used to stabilize rotation */
+
+ float locinf, scaleinf, rotinf; /* influence on location, scale and rotation */
+
+ /* some pre-computing run-time variables */
+ int ok, pad; /* are precomputed values and scaled buf relevant? */
+ float scale; /* autoscale factor */
+
+ struct ImBuf *scaleibuf; /* currently scaled ibuf */
+} MovieTrackingStabilization;
+
+typedef struct MovieTrackingReconstruction {
+ int flag;
+
+ float error; /* average error of reconstruction */
+
+ int last_camera; /* most recently used camera */
+ int camnr; /* number of reconstructed cameras */
+ struct MovieReconstructedCamera *cameras; /* reconstructed cameras */
+} MovieTrackingReconstruction;
+
+typedef struct MovieTracking {
+ MovieTrackingSettings settings; /* different tracking-related settings */
+ char pad2[4];
+
+ MovieTrackingCamera camera; /* camera intrinsics */
+ ListBase tracks; /* all tracks */
+ MovieTrackingReconstruction reconstruction; /* reconstruction data */
+ MovieTrackingStabilization stabilization; /* stabilization data */
+ MovieTrackingTrack *act_track; /* active track */
+} MovieTracking;
+
+/* MovieTrackingCamera->units */
+enum {
+ CAMERA_UNITS_PX = 0,
+ CAMERA_UNITS_MM
+};
+
+/* MovieTrackingMarker->flag */
+#define MARKER_DISABLED (1<<0)
+#define MARKER_TRACKED (1<<1)
+#define MARKER_GRAPH_SEL (1<<2)
+
+/* MovieTrackingTrack->flag */
+#define TRACK_HAS_BUNDLE (1<<1)
+#define TRACK_DISABLE_RED (1<<2)
+#define TRACK_DISABLE_GREEN (1<<3)
+#define TRACK_DISABLE_BLUE (1<<4)
+#define TRACK_HIDDEN (1<<5)
+#define TRACK_LOCKED (1<<6)
+#define TRACK_CUSTOMCOLOR (1<<7)
+#define TRACK_USE_2D_STAB (1<<8)
+
+/* MovieTrackingSettings->tracker */
+#define TRACKER_KLT 0
+#define TRACKER_SAD 1
+
+/* MovieTrackingSettings->speed */
+#define TRACKING_SPEED_FASTEST 0
+#define TRACKING_SPEED_REALTIME 1
+#define TRACKING_SPEED_HALF 2
+#define TRACKING_SPEED_QUARTER 4
+#define TRACKING_SPEED_DOUBLE 5
+
+/* MovieTrackingStrabilization->flag */
+#define TRACKING_2D_STABILIZATION (1<<0)
+#define TRACKING_AUTOSCALE (1<<1)
+
+/* MovieTrackingReconstruction->flag */
+#define TRACKING_RECONSTRUCTED (1<<0)
+
+#define TRACKING_CLEAN_SELECT 0
+#define TRACKING_CLEAN_DELETE_TRACK 1
+#define TRACKING_CLEAN_DELETE_SEGMENT 2
+
+#endif