diff options
author | Ichthyostega <prg@ichthyostega.de> | 2016-08-16 11:32:55 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-08-16 14:30:40 +0300 |
commit | b1677201f9af7a3e5f5254817179f12384fbdc44 (patch) | |
tree | 61ddd140a32b23ae6cf413e2bd8cb508717df659 /release/scripts/startup/bl_ui/space_clip.py | |
parent | c00b2d89911e20c8ace12a9256c689e9f43cc63b (diff) |
Rework 2D stabilizator
See this page for motivation and description of concepts:
https://github.com/Ichthyostega/blender/wiki
See this video for UI explanation and demonstration of usage
http://vimeo.com/blenderHack/stabilizerdemo
This proposal attempts to improve usability of Blender's image stabilization
feature for real-world footage esp. with moving and panning camera. It builds
upon the feature tracking to get a measurement of 2D image movement.
- Use a weighted average of movement contributions (instead of a median).
- Allow for rotation compensation and zoom (image scale) compensation.
- Allow to pick a different set of tracks for translation and for
rotation/zoom.
- Treat translation / rotation / zoom contributions systematically in a
similar way.
- Improve handling of partial tracking data with gaps and varying
start / end points.
- Have a user definable anchor frame and interpolate / extrapolate data to
avoid jumping back to "neutral" position when no tracking data is available.
- Support for travelling and panning shots by including an //intended//
position/rotation/zoom ("target position"). The idea is for these parameters
to be //animated// by the user, in order to supply an smooth, intended
camera movement. This way, we can keep the image content roughly in frame
even when moving completely away from the initial view.
A known shortcoming is that the pivot point for rotation compensation is set to
the translation compensated image center. This can produce spurious rotation on
travelling shots, which needs to be compensated manually (by animating the
target rotation parameter). There are several possible ways to address that
problem, yet all of them are considered beyond the scope of this improvement
proposal for now.
Own modifications:
- Restrict line length, it's really handy for split-view editing
- In motion tracking we prefer fully human-readable comments, meaning we
don't use doxygen with it's weird markup and comments are supposed to
start with capital and end with a full stop,
- Add explicit comparison of pointer to NULL.
Reviewers: sergey
Subscribers: kusi, kdawg, forest-house, mardy, Samoth, plasmasolutions, willolis, sebastian_k, hype, enetheru, sunboy, jta, leon_cheung
Maniphest Tasks: T49036
Differential Revision: https://developer.blender.org/D583
Diffstat (limited to 'release/scripts/startup/bl_ui/space_clip.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_clip.py | 92 |
1 files changed, 69 insertions, 23 deletions
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index 799f1e20dc6..9b1c0a16603 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -621,6 +621,7 @@ class CLIP_PT_track(CLIP_PT_tracking_panel, Panel): text="", toggle=True, icon='IMAGE_ALPHA') layout.prop(act_track, "weight") + layout.prop(act_track, "weight_stab") if act_track.has_bundle: label_text = "Average Error: %.4f" % (act_track.average_error) @@ -907,44 +908,80 @@ class CLIP_PT_stabilization(CLIP_PT_reconstruction_panel, Panel): self.layout.prop(stab, "use_2d_stabilization", text="") def draw(self, context): - layout = self.layout - tracking = context.space_data.clip.tracking stab = tracking.stabilization + layout = self.layout layout.active = stab.use_2d_stabilization - row = layout.row() - row.template_list("UI_UL_list", "stabilization_tracks", stab, "tracks", - stab, "active_track_index", rows=2) + layout.prop(stab, "anchor_frame") - sub = row.column(align=True) + box = layout.box() + row = box.row(align=True) + row.prop(stab, "show_tracks_expanded", text="", emboss=False) + + if not stab.show_tracks_expanded: + row.label(text="Tracks For Stabilization") + else: + row.label(text="Tracks For Location") + row = box.row() + row.template_list("UI_UL_list", "stabilization_tracks", stab, "tracks", + stab, "active_track_index", rows=2) - sub.operator("clip.stabilize_2d_add", icon='ZOOMIN', text="") - sub.operator("clip.stabilize_2d_remove", icon='ZOOMOUT', text="") + sub = row.column(align=True) - sub.menu('CLIP_MT_stabilize_2d_specials', text="", - icon='DOWNARROW_HLT') + sub.operator("clip.stabilize_2d_add", icon='ZOOMIN', text="") + sub.operator("clip.stabilize_2d_remove", icon='ZOOMOUT', text="") - layout.prop(stab, "influence_location") + sub.menu('CLIP_MT_stabilize_2d_specials', text="", + icon='DOWNARROW_HLT') - layout.prop(stab, "use_autoscale") - col = layout.column() - col.active = stab.use_autoscale - col.prop(stab, "scale_max") - col.prop(stab, "influence_scale") + row = box.row() + row.label(text="Tracks For Rotation / Scale") + row = box.row() + row.active = stab.use_stabilize_rotation + row.template_list("UI_UL_list", "stabilization_rotation_tracks", stab, "rotation_tracks", + stab, "active_rotation_track_index", rows=2) + + sub = row.column(align=True) + + sub.operator("clip.stabilize_2d_rotation_add", icon='ZOOMIN', text="") + sub.operator("clip.stabilize_2d_rotation_remove", icon='ZOOMOUT', text="") + + sub.menu('CLIP_MT_stabilize_2d_rotation_specials', text="", + icon='DOWNARROW_HLT') layout.prop(stab, "use_stabilize_rotation") - col = layout.column() - col.active = stab.use_stabilize_rotation + row = layout.row() + row.active = stab.use_stabilize_rotation + row.prop(stab, "use_stabilize_scale") + if stab.use_autoscale: + row = layout.row(align=True) + row.prop(stab, "use_autoscale") + row.prop(stab, "scale_max", text="Max") + else: + layout.prop(stab, "use_autoscale") - row = col.row(align=True) - row.prop_search(stab, "rotation_track", tracking, "tracks", text="") - row.operator("clip.stabilize_2d_set_rotation", text="", icon='ZOOMIN') + layout.separator() + layout.label(text="Expected Position") + layout.prop(stab, "target_pos", text="") + layout.prop(stab, "target_rot") + if stab.use_autoscale: + layout.label(text="Auto Scale Factor: %5.3f" % (1.0 / stab.target_zoom)) + else: + layout.prop(stab, "target_zoom") + layout.separator() + row = layout.row() + row.active = 0 < len(stab.tracks.values()) + row.prop(stab, "influence_location") + + col = layout.column() + col.active = stab.use_stabilize_rotation and 0 < len(stab.rotation_tracks.values()) row = col.row() - row.active = stab.rotation_track is not None row.prop(stab, "influence_rotation") + row = col.row() + row.prop(stab, "influence_scale") layout.prop(stab, "filter_type") @@ -1434,7 +1471,7 @@ class CLIP_MT_track_color_specials(Menu): class CLIP_MT_stabilize_2d_specials(Menu): - bl_label = "Track Color Specials" + bl_label = "Translation Track Specials" def draw(self, context): layout = self.layout @@ -1442,5 +1479,14 @@ class CLIP_MT_stabilize_2d_specials(Menu): layout.operator("clip.stabilize_2d_select") +class CLIP_MT_stabilize_2d_rotation_specials(Menu): + bl_label = "Rotation Track Specials" + + def draw(self, context): + layout = self.layout + + layout.operator("clip.stabilize_2d_rotation_select") + + if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) |