[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44184] trunk/blender: Camera tracking: configurable filter type for 2d stabilization
Sergey Sharybin
sergey.vfx at gmail.com
Fri Feb 17 09:27:20 CET 2012
Revision: 44184
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44184
Author: nazgul
Date: 2012-02-17 08:27:19 +0000 (Fri, 17 Feb 2012)
Log Message:
-----------
Camera tracking: configurable filter type for 2d stabilization
--
svn merge -r44151:44152 ^/branches/soc-2011-tomato
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44151
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/space_clip.py
trunk/blender/source/blender/blenkernel/intern/movieclip.c
trunk/blender/source/blender/blenkernel/intern/tracking.c
trunk/blender/source/blender/makesdna/DNA_tracking_types.h
trunk/blender/source/blender/makesrna/intern/rna_tracking.c
Property Changed:
----------------
trunk/blender/
trunk/blender/source/blender/editors/space_outliner/
Property changes on: trunk/blender
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151
+ /branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152
Modified: trunk/blender/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_clip.py 2012-02-17 08:23:42 UTC (rev 44183)
+++ trunk/blender/release/scripts/startup/bl_ui/space_clip.py 2012-02-17 08:27:19 UTC (rev 44184)
@@ -684,7 +684,9 @@
row.active = stab.rotation_track is not None
row.prop(stab, "influence_rotation")
+ layout.prop(stab, "filter_type")
+
class CLIP_PT_marker(Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'UI'
Modified: trunk/blender/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/movieclip.c 2012-02-17 08:23:42 UTC (rev 44183)
+++ trunk/blender/source/blender/blenkernel/intern/movieclip.c 2012-02-17 08:27:19 UTC (rev 44184)
@@ -280,7 +280,7 @@
int postprocess_flag;
float loc[2], scale, angle, aspect;
- int proxy;
+ int proxy, filter;
short render_flag;
} stabilized;
} MovieClipCache;
@@ -706,6 +706,7 @@
static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int framenr, int postprocess_flag)
{
MovieClipCache *cache = clip->cache;
+ MovieTracking *tracking = &clip->tracking;
ImBuf *stableibuf;
float tloc[2], tscale, tangle;
short proxy = IMB_PROXY_NONE;
@@ -728,9 +729,12 @@
return NULL;
/* stabilization also depends on pixel aspect ratio */
- if(cache->stabilized.aspect != clip->tracking.camera.pixel_aspect)
+ if(cache->stabilized.aspect != tracking->camera.pixel_aspect)
return NULL;
+ if(cache->stabilized.filter != tracking->stabilization.filter)
+ return NULL;
+
stableibuf = cache->stabilized.ibuf;
BKE_tracking_stabilization_data(&clip->tracking, framenr, stableibuf->x, stableibuf->y, tloc, &tscale, &tangle);
@@ -752,6 +756,7 @@
int framenr, int postprocess_flag)
{
MovieClipCache *cache = clip->cache;
+ MovieTracking *tracking = &clip->tracking;
ImBuf *stableibuf;
float tloc[2], tscale, tangle;
@@ -767,7 +772,8 @@
cache->stabilized.scale = tscale;
cache->stabilized.angle = tangle;
cache->stabilized.framenr = framenr;
- cache->stabilized.aspect = clip->tracking.camera.pixel_aspect;
+ cache->stabilized.aspect = tracking->camera.pixel_aspect;
+ cache->stabilized.filter = tracking->stabilization.filter;
if(clip->flag&MCLIP_USE_PROXY) {
cache->stabilized.proxy= rendersize_to_proxy(user, clip->flag);
Modified: trunk/blender/source/blender/blenkernel/intern/tracking.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/tracking.c 2012-02-17 08:23:42 UTC (rev 44183)
+++ trunk/blender/source/blender/blenkernel/intern/tracking.c 2012-02-17 08:27:19 UTC (rev 44184)
@@ -2688,19 +2688,26 @@
IMB_rectcpy(tmpibuf, ibuf, tloc[0]-(tscale-1.0f)*width/2.0f, tloc[1]-(tscale-1.0f)*height/2.0f, 0, 0, ibuf->x, ibuf->y);
} else {
float mat[4][4];
- int i, j;
+ int i, j, filter= tracking->stabilization.filter;
+ void (*interpolation) (struct ImBuf*, struct ImBuf*, float, float, int, int) = NULL;
BKE_tracking_stabdata_to_mat4(ibuf->x, ibuf->y, aspect, tloc, tscale, tangle, mat);
invert_m4(mat);
+ if(filter == TRACKING_FILTER_NEAREAST)
+ interpolation = neareast_interpolation;
+ else if(filter == TRACKING_FILTER_BILINEAR)
+ interpolation = bilinear_interpolation;
+ else if(filter == TRACKING_FILTER_BICUBIC)
+ interpolation = bicubic_interpolation;
+
for(j=0; j<tmpibuf->y; j++) {
for(i=0; i<tmpibuf->x;i++) {
float vec[3]= {i, j, 0};
mul_v3_m4v3(vec, mat, vec);
- /* TODO: add selector for interpolation method */
- neareast_interpolation(ibuf, tmpibuf, vec[0], vec[1], i, j);
+ interpolation(ibuf, tmpibuf, vec[0], vec[1], i, j);
}
}
}
Property changes on: trunk/blender/source/blender/editors/space_outliner
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/branches/soc-2011-tomato/source/blender/editors/space_outliner:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151
+ /branches/soc-2011-cucumber/source/blender/editors/space_outliner:38968,38970,38973,39045,40845
/branches/soc-2011-pepper/source/blender/editors/space_outliner:36831-38987
/branches/soc-2011-tomato/source/blender/editors/space_outliner:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152
Modified: trunk/blender/source/blender/makesdna/DNA_tracking_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_tracking_types.h 2012-02-17 08:23:42 UTC (rev 44183)
+++ trunk/blender/source/blender/makesdna/DNA_tracking_types.h 2012-02-17 08:27:19 UTC (rev 44184)
@@ -159,8 +159,10 @@
float locinf, scaleinf, rotinf; /* influence on location, scale and rotation */
+ int filter; /* filter used for pixel interpolation */
+
/* some pre-computing run-time variables */
- int ok, pad; /* are precomputed values and scaled buf relevant? */
+ int ok; /* are precomputed values and scaled buf relevant? */
float scale; /* autoscale factor */
struct ImBuf *scaleibuf; /* currently scaled ibuf */
@@ -258,6 +260,11 @@
#define TRACKING_AUTOSCALE (1<<1)
#define TRACKING_STABILIZE_ROTATION (1<<2)
+/* MovieTrackingStrabilization->filter */
+#define TRACKING_FILTER_NEAREAST 0
+#define TRACKING_FILTER_BILINEAR 1
+#define TRACKING_FILTER_BICUBIC 2
+
/* MovieTrackingReconstruction->flag */
#define TRACKING_RECONSTRUCTED (1<<0)
Modified: trunk/blender/source/blender/makesrna/intern/rna_tracking.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_tracking.c 2012-02-17 08:23:42 UTC (rev 44183)
+++ trunk/blender/source/blender/makesrna/intern/rna_tracking.c 2012-02-17 08:27:19 UTC (rev 44184)
@@ -1064,6 +1064,12 @@
StructRNA *srna;
PropertyRNA *prop;
+ static EnumPropertyItem filter_items[] = {
+ {TRACKING_FILTER_NEAREAST, "NEAREST", 0, "Nearest", ""},
+ {TRACKING_FILTER_BILINEAR, "BILINEAR", 0, "Bilinear", ""},
+ {TRACKING_FILTER_BICUBIC, "BICUBIC", 0, "Bicubic", ""},
+ {0, NULL, 0, NULL, NULL}};
+
srna= RNA_def_struct(brna, "MovieTrackingStabilization", NULL);
RNA_def_struct_path_func(srna, "rna_trackingStabilization_path");
RNA_def_struct_ui_text(srna, "Movie tracking stabilization data", "Match-moving stabilization data for tracking");
@@ -1137,6 +1143,13 @@
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Rotation Influence", "Influence of stabilization algorithm on footage rotation");
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* filter */
+ prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "filter");
+ RNA_def_property_enum_items(prop, filter_items);
+ RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization");
+ RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
}
static void rna_def_reconstructedCamera(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list