Add panels for the new planar tracker
authorKeir Mierle <mierle@gmail.com>
Thu, 17 May 2012 17:09:51 +0000 (17:09 +0000)
committerKeir Mierle <mierle@gmail.com>
Thu, 17 May 2012 17:09:51 +0000 (17:09 +0000)
This replaces the old style tracker configuration panel with the
new planar tracking panel. From a users perspective, this means:

- The old "tracking algorithm" picker is gone. There is only 1
  algorithm now. We may revisit this later, but I would much
  prefer to have only 1 algorithm. So far no optimization work
  has been done so the speed is not there yet.

- There is now a dropdown to select the motion model. Choices:

  * Translation
  * Translation, rotation
  * Translation, scale
  * Translation, rotation, scale
  * Affine (Not implemented yet)
  * Perspective

  The most stable is the "translation" parameterization. The
  others work but still require some tweaking.

- The old "Hybrid" mode is gone; instead there is a toggle to
  enable or disable translation-only tracker initialization. This
  is the equivalent of the hyrbid mode before, but rewritten to work
  with the new planar tracking modes.

- The pyramid levels setting is gone. At a future date, the planar
  tracker will decide to use pyramids or not automatically. The
  pyramid setting was ultimately a mistake; with the brute force
  initialization it is unnecessary.

extern/libmv/libmv-capi.cpp
extern/libmv/libmv-capi.h
extern/libmv/libmv/tracking/track_region.cc
release/scripts/startup/bl_ui/space_clip.py
source/blender/blenkernel/BKE_tracking.h
source/blender/blenkernel/intern/tracking.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/space_clip/clip_draw.c
source/blender/makesdna/DNA_tracking_types.h
source/blender/makesrna/intern/rna_tracking.c

index 8894930f3b927249e67c006b80bd8aaf396fb0b5..482a4c98245fee7e452fc99d6ee6ca689d5b507a 100644 (file)
@@ -380,6 +380,7 @@ int libmv_trackRegion(const struct libmv_trackRegionOptions *options,
        track_region_options.sigma = options->sigma;
        track_region_options.num_extra_points = 1;
        track_region_options.image1_mask = NULL;
+       track_region_options.use_brute_initialization = options->use_brute;
 
        /* Convert from raw float buffers to libmv's FloatImage. */
        libmv::FloatImage old_patch, new_patch;
index d3f02f99e517ad0328147ac3e03607534a22b30b..9fedb9b968311070844f3534d43c40561d33d7da 100644 (file)
@@ -54,6 +54,7 @@ void libmv_regionTrackerDestroy(struct libmv_RegionTracker *libmv_tracker);
 struct libmv_trackRegionOptions {
   int motion_model;
   int num_iterations;
+  int use_brute;
   double minimum_correlation;
   double sigma;
 };
index 0dac56aeff70908e11d19d670765410307a5fb0c..22c86a7f5b948f5686e067cf3f22b11a0882cb36 100644 (file)
@@ -499,7 +499,7 @@ struct TranslationRotationWarp {
                             q2.CornerRelativeToCentroid(i).transpose();
     }
     Mat2 R = OrthogonalProcrustes(correlation_matrix);
-    parameters[2] = acos(R(0, 0));
+    parameters[2] = atan2(R(1, 0), R(0, 0));
 
     std::cout << "correlation_matrix:\n" << correlation_matrix << "\n";
     std::cout << "R:\n" << R << "\n";
@@ -575,7 +575,7 @@ struct TranslationRotationScaleWarp {
     std::cout << "correlation_matrix:\n" << correlation_matrix << "\n";
     Mat2 R = OrthogonalProcrustes(correlation_matrix);
     std::cout << "R:\n" << R << "\n";
-    parameters[3] = acos(R(0, 0));
+    parameters[3] = atan2(R(1, 0), R(0, 0));
     std::cout << "theta:" << parameters[3] << "\n";
   }
 
@@ -949,6 +949,7 @@ void TemplatedTrackRegion(const FloatImage &image1,
 
   // TODO(keir): Consider removing these options before committing.
   solver_options.numeric_derivative_relative_step_size = 1e-3;
+  solver_options.check_gradients = false;
   solver_options.gradient_check_relative_precision = 1e-10;
   solver_options.minimizer_progress_to_stdout = false;
 
index 358c534a3a74f7256810eba55caee255344e5e81..c17266cf303ac4e328518f0b9038bf5ddcc3d1f3 100644 (file)
@@ -187,10 +187,8 @@ class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
             sub.prop(settings, "default_search_size")
 
             col.label(text="Tracker:")
-            col.prop(settings, "default_tracker", text="")
-
-            if settings.default_tracker == 'KLT':
-                col.prop(settings, "default_pyramid_levels")
+            col.prop(settings, "default_motion_model")
+            col.prop(settings, "default_use_brute")
             col.prop(settings, "default_correlation_min")
 
             col.separator()
@@ -488,10 +486,8 @@ class CLIP_PT_track_settings(CLIP_PT_tracking_panel, Panel):
 
         active = clip.tracking.tracks.active
         if active:
-            col.prop(active, "tracker")
-
-            if active.tracker == 'KLT':
-                col.prop(active, "pyramid_levels")
+            col.prop(active, "motion_model")
+            col.prop(active, "use_brute")
             col.prop(active, "correlation_min")
 
             col.separator()
index 6ff1a6e829886dd0190cc14231ea2ab84a18301f..4b94fcb72600e9eeef4ab43b03546ef443023b3c 100644 (file)
@@ -190,7 +190,6 @@ void BKE_tracking_dopesheet_update(struct MovieTracking *tracking, int sort_meth
 #define CLAMP_PAT_POS          2
 #define CLAMP_SEARCH_DIM       3
 #define CLAMP_SEARCH_POS       4
-#define CLAMP_PYRAMID_LEVELS   5
 
 #define TRACK_AREA_NONE                -1
 #define TRACK_AREA_POINT       1
index 151881edb343af40200fd5b87ac3ed879f9d0722..1956492fce919424d0defc431405a35d7f78d2f7 100644 (file)
@@ -156,11 +156,10 @@ void BKE_tracking_init_settings(MovieTracking *tracking)
        tracking->camera.pixel_aspect = 1.0f;
        tracking->camera.units = CAMERA_UNITS_MM;
 
-       tracking->settings.default_tracker = TRACKER_HYBRID;
+       tracking->settings.default_motion_model = TRACK_MOTION_MODEL_TRANSLATION;
        tracking->settings.default_minimum_correlation = 0.75;
        tracking->settings.default_pattern_size = 11;
        tracking->settings.default_search_size = 61;
-       tracking->settings.default_pyramid_levels = 2;
        tracking->settings.keyframe1 = 1;
        tracking->settings.keyframe2 = 30;
        tracking->settings.dist = 1;
@@ -179,11 +178,6 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
        int a;
        float pat_min[2], pat_max[2];
        float eff_pat_min[2], eff_pat_max[2];
-       float max_pyramid_level_factor = 1.0;
-
-       if (track->tracker == TRACKER_KLT) {
-               max_pyramid_level_factor = 1 << (track->pyramid_levels - 1);
-       }
 
        /* XXX: currently search area is global, pattern size is per-marker, so we'll need to
         *      find maximal size of pattern to clamp search size nicely
@@ -199,13 +193,8 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
                DO_MINMAX2(cur_pat_max, pat_min, pat_max);
        }
 
-       /* compute the effective pattern size, which differs from the fine resolution
-        * pattern size for the pyramid KLT tracker
-        */
-       for (a = 0; a < 2; a++) {
-               eff_pat_min[a] = max_pyramid_level_factor * pat_min[a];
-               eff_pat_max[a] = max_pyramid_level_factor * pat_max[a];
-       }
+       copy_v2_v2(eff_pat_min, pat_min);
+       copy_v2_v2(eff_pat_max, pat_max);
 
        if (event == CLAMP_PAT_DIM) {
                for (a = 0; a < 2; a++) {
@@ -260,19 +249,12 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
                        }
                }
        }
-       else if (event == CLAMP_PYRAMID_LEVELS || (event == CLAMP_SEARCH_DIM && track->tracker == TRACKER_KLT)) {
+       else if (event == CLAMP_SEARCH_DIM) {
                float dim[2];
                sub_v2_v2v2(dim, pat_max, pat_min);
-               {
-                       float search_ratio = 2.3f * max_pyramid_level_factor;
-
-                       /* resize the search area to something sensible based
-                        * on the number of pyramid levels
-                        */
-                       for (a = 0; a < 2; a++) {
-                               track->search_min[a] = search_ratio * pat_min[a];
-                               track->search_max[a] = search_ratio * pat_max[a];
-                       }
+               for (a = 0; a < 2; a++) {
+                       track->search_min[a] = pat_min[a];
+                       track->search_max[a] = pat_max[a];
                }
        }
 }
@@ -320,13 +302,13 @@ MovieTrackingTrack *BKE_tracking_add_track(MovieTracking *tracking, ListBase *tr
        track = MEM_callocN(sizeof(MovieTrackingTrack), "add_marker_exec track");
        strcpy(track->name, "Track");
 
-       track->tracker = settings->default_tracker;
-       track->pyramid_levels = settings->default_pyramid_levels;
+       track->motion_model = settings->default_motion_model;
        track->minimum_correlation = settings->default_minimum_correlation;
        track->margin = settings->default_margin;
        track->pattern_match = settings->default_pattern_match;
        track->frames_limit = settings->default_frames_limit;
        track->flag = settings->default_flag;
+       track->algorithm_flag = settings->default_algorithm_flag;
 
        memset(&marker, 0, sizeof(marker));
        marker.pos[0] = x;
@@ -347,9 +329,6 @@ MovieTrackingTrack *BKE_tracking_add_track(MovieTracking *tracking, ListBase *tr
 
        BKE_tracking_insert_marker(track, &marker);
 
-       if (track->tracker == TRACKER_KLT)
-               BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
-
        BLI_addtail(tracksbase, track);
        BKE_track_unique_name(tracksbase, track);
 
@@ -1754,8 +1733,9 @@ int BKE_tracking_next(MovieTrackingContext *context)
                                patch_new = get_search_floatbuf(destination_ibuf, track, marker, &width, &height);
 
                                /* Configure the tracker */
-                               options.motion_model = 0;
-                               options.num_iterations = 10;
+                               options.motion_model = track->motion_model;
+                               options.use_brute = ((track->algorithm_flag & TRACK_ALGORITHM_FLAG_USE_BRUTE) == 0);
+                               options.num_iterations = 50;
                                options.minimum_correlation = track->minimum_correlation;
                                options.sigma = 0.9;
 
index 3e3d24d7281c25eda43133046fd222d1645045de..bb944eaf4295f1d9bef90c737ee16c8d7335bd6f 100644 (file)
@@ -7122,9 +7122,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
                                track= clip->tracking.tracks.first;
                                while (track) {
-                                       if (track->pyramid_levels==0)
-                                               track->pyramid_levels= 2;
-
                                        if (track->minimum_correlation==0.0f)
                                                track->minimum_correlation= 0.75f;
 
@@ -7146,9 +7143,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                for (clip= main->movieclip.first; clip; clip= clip->id.next) {
                        MovieTrackingSettings *settings= &clip->tracking.settings;
 
-                       if (settings->default_pyramid_levels==0) {
-                               settings->default_tracker= TRACKER_KLT;
-                               settings->default_pyramid_levels= 2;
+                       if (settings->default_pattern_size == 0.0f) {
+                               settings->default_motion_model= TRACK_MOTION_MODEL_TRANSLATION;
                                settings->default_minimum_correlation= 0.75;
                                settings->default_pattern_size= 11;
                                settings->default_search_size= 51;
index aa9af704280e92e720a43ef4cb88d72efd2e6b18..a06da28932698527dde2fc665a1d7fa95c33c866 100644 (file)
@@ -668,51 +668,6 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
                glEnd();
        }
 
-       /* pyramid */
-       if (sel && TRACK_VIEW_SELECTED(sc, track) &&
-           (track->tracker == TRACKER_KLT) &&
-               (marker->flag & MARKER_DISABLED) == 0)
-       {
-               if (track->flag & TRACK_LOCKED) {
-                       if (act)
-                               UI_ThemeColor(TH_ACT_MARKER);
-                       else if (track->pat_flag & SELECT)
-                               UI_ThemeColorShade(TH_LOCK_MARKER, 64);
-                       else UI_ThemeColor(TH_LOCK_MARKER);
-               }
-               else if (marker->flag & MARKER_DISABLED) {
-                       if (act)
-                               UI_ThemeColor(TH_ACT_MARKER);
-                       else if (track->pat_flag & SELECT)
-                               UI_ThemeColorShade(TH_DIS_MARKER, 128);
-                       else UI_ThemeColor(TH_DIS_MARKER);
-               }
-               else {
-                       if (track->pat_flag & SELECT)
-                               glColor3fv(scol);
-                       else
-                               glColor3fv(col);
-               }
-
-               {
-                       int i = 0;
-                       glPushMatrix();
-                       glEnable(GL_LINE_STIPPLE);
-                       for (i = 1; i < track->pyramid_levels; ++i) {
-                               glScalef(2.0f, 2.0f, 1.0);
-                       }
-                       /* only draw a pattern for the coarsest level */
-                       glBegin(GL_LINE_LOOP);
-                               glVertex2fv(marker->pattern_corners[0]);
-                               glVertex2fv(marker->pattern_corners[1]);
-                               glVertex2fv(marker->pattern_corners[2]);
-                               glVertex2fv(marker->pattern_corners[3]);
-                       glEnd();
-                       glDisable(GL_LINE_STIPPLE);
-                       glPopMatrix();
-               }
-       }
-
        if (tiny)
                glDisable(GL_LINE_STIPPLE);
 
index 6f2e017b1f11367eeef4641bed05ae2bbf839369..f15bf4ba8d8ec4d1df2d3233c839c187df7e3c02 100644 (file)
@@ -118,17 +118,14 @@ typedef struct MovieTrackingTrack {
        int flag, pat_flag, search_flag;        /* flags (selection, ...) */
        float color[3];                                         /* custom color for track */
 
-       /* tracking algorithm to use; can be KLT or SAD */
+       /* ** control how tracking happens */
        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 */
        short pattern_match;    /* re-adjust every N frames */
 
-       short tracker;                  /* tracking algorithm used for this track */
-
-       /* ** KLT tracker settings ** */
-       short pyramid_levels, pad2;             /* number of pyramid levels to use for KLT tracking */
-
-       /* ** SAD tracker settings ** */
+       /* tracking parameters */
+       short motion_model;     /* model of the motion for this track */
+       int algorithm_flag;    /* flags for the tracking algorithm (use brute, use esm, use pyramid, etc */
        float minimum_correlation;                      /* minimal correlation which is still treated as successful tracking */
 
        struct bGPdata *gpd;            /* grease-pencil data */
@@ -138,15 +135,15 @@ typedef struct MovieTrackingSettings {
        int flag;
 
        /* ** default tracker settings */
-       short default_tracker;                          /* tracking algorithm used by default */
-       short default_pyramid_levels;           /* number of pyramid levels to use for KLT tracking */
-       float default_minimum_correlation;      /* minimal correlation which is still treated as successful tracking */
-       short default_pattern_size;                     /* size of pattern area for new tracks */
-       short default_search_size;                      /* size of search area for new tracks */
-       short default_frames_limit;                     /* number of frames to be tarcked during single tracking session (if TRACKING_FRAMES_LIMIT is set) */
-       short default_margin;                           /* margin from frame boundaries */
-       short default_pattern_match;            /* re-adjust every N frames */
-       short default_flag;                                     /* default flags like color channels used by default */
+       short default_motion_model;         /* model of the motion for this track */
+       short default_algorithm_flag;       /* flags for the tracking algorithm (use brute, use esm, use pyramid, etc */
+       float default_minimum_correlation;  /* minimal correlation which is still treated as successful tracking */
+       short default_pattern_size;         /* size of pattern area for new tracks */
+       short default_search_size;          /* size of search area for new tracks */
+       short default_frames_limit;         /* number of frames to be tarcked during single tracking session (if TRACKING_FRAMES_LIMIT is set) */
+       short default_margin;               /* margin from frame boundaries */
+       short default_pattern_match;        /* re-adjust every N frames */
+       short default_flag;                 /* default flags like color channels used by default */
 
        short motion_flag;              /* flags describes motion type */
 
@@ -280,10 +277,16 @@ enum {
 #define TRACK_PREVIEW_GRAYSCALE        (1<<9)
 #define TRACK_DOPE_SEL         (1<<10)
 
-/* MovieTrackingTrack->tracker */
-#define TRACKER_KLT            0
-#define TRACKER_SAD            1
-#define TRACKER_HYBRID         2
+/* MovieTrackingTrack->motion_model */
+#define TRACK_MOTION_MODEL_TRANSLATION                 0
+#define TRACK_MOTION_MODEL_TRANSLATION_ROTATION        1
+#define TRACK_MOTION_MODEL_TRANSLATION_SCALE           2
+#define TRACK_MOTION_MODEL_TRANSLATION_ROTATION_SCALE  3
+#define TRACK_MOTION_MODEL_AFFINE                      4
+#define TRACK_MOTION_MODEL_HOMOGRAPHY                  5
+
+/* MovieTrackingTrack->algorithm_flag */
+#define TRACK_ALGORITHM_FLAG_USE_BRUTE 0
 
 /* MovieTrackingTrack->adjframes */
 #define TRACK_MATCH_KEYFRAME           0
index 9f5dc75506b4fe25948e238b903fc41d04188c23..34dd471e9c1056e3e465eb4b107d8a8318a15518 100644 (file)
@@ -59,20 +59,6 @@ static char *rna_tracking_path(PointerRNA *UNUSED(ptr))
        return BLI_sprintfN("tracking");
 }
 
-static void rna_tracking_defaultSettings_levelsUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
-{
-       MovieClip *clip = (MovieClip*)ptr->id.data;
-       MovieTracking *tracking = &clip->tracking;
-       MovieTrackingSettings *settings = &tracking->settings;
-
-       if (settings->default_tracker == TRACKER_KLT) {
-               int max_pyramid_level_factor = 1 << (settings->default_pyramid_levels - 1);
-               float search_ratio = 2.3f * max_pyramid_level_factor;
-
-               settings->default_search_size = settings->default_pattern_size*search_ratio;
-       }
-}
-
 static void rna_tracking_defaultSettings_patternUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
        MovieClip *clip = (MovieClip*)ptr->id.data;
@@ -223,23 +209,6 @@ static void rna_tracking_trackerSearch_update(Main *UNUSED(bmain), Scene *UNUSED
        BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
 }
 
-static void rna_tracking_trackerAlgorithm_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
-{
-       MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
-
-       if (track->tracker == TRACKER_KLT)
-               BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
-       else
-               BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
-}
-
-static void rna_tracking_trackerPyramid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
-{
-       MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
-
-       BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
-}
-
 static char *rna_trackingCamera_path(PointerRNA *UNUSED(ptr))
 {
        return BLI_sprintfN("tracking.camera");
@@ -484,11 +453,19 @@ void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int framenr)
 
 #else
 
-static EnumPropertyItem tracker_items[] = {
-       {TRACKER_KLT, "KLT", 0, "KLT",
-                     "Kanade–Lucas–Tomasi tracker which works with most of video clips, a bit slower than SAD"},
-       {TRACKER_SAD, "SAD", 0, "SAD", "Sum of Absolute Differences tracker which can be used when KLT tracker fails"},
-       {TRACKER_HYBRID, "Hybrid", 0, "Hybrid", "A hybrid tracker that uses SAD for rough tracking, KLT for refinement."},
+static EnumPropertyItem tracker_motion_model[] = {
+       {TRACK_MOTION_MODEL_HOMOGRAPHY, "Perspective", 0, "Perspective",
+                     "Search for markers that are perspectively deformed (homography) between frames."},
+       {TRACK_MOTION_MODEL_AFFINE, "Affine", 0, "Affine",
+                     "Search for markers that are affine-deformed (t, r, k, and skew) between frames."},
+       {TRACK_MOTION_MODEL_TRANSLATION_ROTATION_SCALE, "LocRotScale", 0, "LocRotScale",
+                     "Search for markers that are translated, rotated, and scaled between frames."},
+       {TRACK_MOTION_MODEL_TRANSLATION_SCALE, "LocScale", 0, "LocScale",
+                     "Search for markers that are translated and scaled between frames."},
+       {TRACK_MOTION_MODEL_TRANSLATION_ROTATION, "LocRot", 0, "LocRot",
+                     "Search for markers that are translated and rotated between frames."},
+       {TRACK_MOTION_MODEL_TRANSLATION, "Loc", 0, "Loc",
+                     "Search for markers that are translated between frames."},
        {0, NULL, 0, NULL, NULL}};
 
 static EnumPropertyItem pattern_match_items[] = {
@@ -635,33 +612,29 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
        RNA_def_property_range(prop, 0, 300);
        RNA_def_property_ui_text(prop, "Margin", "Default distance from image boudary at which marker stops tracking");
 
-       /* tracking algorithm */
-       prop = RNA_def_property(srna, "default_tracker", PROP_ENUM, PROP_NONE);
+       /* tracking motion model */
+       prop = RNA_def_property(srna, "default_motion_model", PROP_ENUM, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_enum_items(prop, tracker_items);
-       RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_levelsUpdate");
-       RNA_def_property_ui_text(prop, "Tracker", "Default tracking algorithm to use");
+       RNA_def_property_enum_items(prop, tracker_motion_model);
+       RNA_def_property_ui_text(prop, "Motion model", "Default motion model to use for tracking");
 
-       /* pyramid level for pyramid klt tracking */
-       prop = RNA_def_property(srna, "default_pyramid_levels", PROP_INT, PROP_NONE);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_int_sdna(prop, NULL, "default_pyramid_levels");
-       RNA_def_property_range(prop, 1, 16);
-       RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_levelsUpdate");
-       RNA_def_property_ui_text(prop, "Pyramid levels", "Default number of pyramid levels (increase on blurry footage)");
+       /* use_brute */
+       prop = RNA_def_property(srna, "default_use_brute", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "default_algorithm_flag", TRACK_ALGORITHM_FLAG_USE_BRUTE);
+       RNA_def_property_ui_text(prop, "Translation-only initialization", "Use a brute-force translation-only initialization when tracking");
+       RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
-       /* minmal correlation - only used for SAD tracker */
+       /* minmal correlation */
        prop = RNA_def_property(srna, "default_correlation_min", PROP_FLOAT, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
        RNA_def_property_float_sdna(prop, NULL, "default_minimum_correlation");
-       RNA_def_property_range(prop, -1.0f, 1.0f);
-       RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.05, 3);
        RNA_def_property_ui_text(prop, "Correlation",
-                                "Default minimal value of correlation between matched pattern and reference "
-                                "which is still treated as successful tracking");
+                                "Default minimum value of correlation between matched pattern and reference "
+                                "that is still treated as successful tracking");
 
        /* default pattern size */
        prop = RNA_def_property(srna, "default_pattern_size", PROP_INT, PROP_NONE);
@@ -886,25 +859,7 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
        RNA_def_struct_name_property(srna, prop);
 
        /* Pattern */
-       prop = RNA_def_property(srna, "pattern_min", PROP_FLOAT, PROP_TRANSLATION);
-       RNA_def_property_array(prop, 2);
-       RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
-       RNA_def_property_float_sdna(prop, NULL, "pat_min");
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_ui_text(prop, "Pattern Min",
-                                "Left-bottom corner of pattern area in normalized coordinates relative "
-                                "to marker position");
-       RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update");
-
-       prop = RNA_def_property(srna, "pattern_max", PROP_FLOAT, PROP_TRANSLATION);
-       RNA_def_property_array(prop, 2);
-       RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
-       RNA_def_property_float_sdna(prop, NULL, "pat_max");
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_ui_text(prop, "Pattern Max",
-                                "Right-bottom corner of pattern area in normalized coordinates relative "
-                                "to marker position");
-       RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update");
+       /* XXX The four pattern corners are not exported to rna yet */
 
        /* Search */
        prop = RNA_def_property(srna, "search_min", PROP_FLOAT, PROP_TRANSLATION);
@@ -952,32 +907,29 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
        RNA_def_property_range(prop, 0, 300);
        RNA_def_property_ui_text(prop, "Margin", "Distance from image boudary at which marker stops tracking");
 
-       /* tracking algorithm */
-       prop = RNA_def_property(srna, "tracker", PROP_ENUM, PROP_NONE);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_enum_items(prop, tracker_items);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_ui_text(prop, "Tracker", "Tracking algorithm to use");
-       RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerAlgorithm_update");
-
-       /* pyramid level for pyramid klt tracking */
-       prop = RNA_def_property(srna, "pyramid_levels", PROP_INT, PROP_NONE);
+       /* tracking motion model */
+       prop = RNA_def_property(srna, "motion_model", PROP_ENUM, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_int_sdna(prop, NULL, "pyramid_levels");
+       RNA_def_property_enum_items(prop, tracker_motion_model);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_range(prop, 1, 16);
-       RNA_def_property_ui_text(prop, "Pyramid levels", "Number of pyramid levels (increase on blurry footage)");
-       RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPyramid_update");
+       RNA_def_property_ui_text(prop, "Motion model", "Default motion model to use for tracking");
 
-       /* minmal correlation - only used for SAD tracker */
+       /* minimum correlation */
        prop = RNA_def_property(srna, "correlation_min", PROP_FLOAT, PROP_NONE);
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
        RNA_def_property_float_sdna(prop, NULL, "minimum_correlation");
-       RNA_def_property_range(prop, -1.0f, 1.0f);
-       RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
+       RNA_def_property_range(prop, 0.0f, 1.0f);
+       RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.05, 3);
        RNA_def_property_ui_text(prop, "Correlation",
                                 "Minimal value of correlation between matched pattern and reference "
-                                "which is still treated as successful tracking");
+                                "that is still treated as successful tracking");
+
+       /* use_brute */
+       prop = RNA_def_property(srna, "use_brute", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "algorithm_flag", TRACK_ALGORITHM_FLAG_USE_BRUTE);
+       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+       RNA_def_property_ui_text(prop, "Translation-only initialization", "Use a brute-force translation only pre-track before refinement");
+       RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
        /* markers */
        prop = RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);