Hi,
In a similar approach to the motion_est filter, here is a patch to retrieve
the motion information from the autotrack_rectangle filter.
This allows us to track an object motion in the "motion_vector_list" and later
use this information in Kdenlive for example to make a title follow an object.
Motion tracking info from this filter is not perfect but it's a good start.
Keeping the motion info is triggered by a "_serialize" property, don't know if
this should be removed / renamed / whatever...
Ok for you?
regards
jb
_____________________________________________________________________________
diff --git a/src/modules/motion_est/filter_autotrack_rectangle.c
b/src/modules/motion_est/filter_autotrack_rectangle.c
index f65e16c..03db370 100644
--- a/src/modules/motion_est/filter_autotrack_rectangle.c
+++ b/src/modules/motion_est/filter_autotrack_rectangle.c
@@ -180,7 +180,34 @@ static int filter_get_image( mlt_frame frame, uint8_t
**image, mlt_image_format
{
init_arrows( format, *width, *height );
draw_rectangle_outline(*image, boundry.x, boundry.y, boundry.w,
boundry.h,
100);
- }
+ }
+
+ if( mlt_properties_get_int( filter_properties, "_serialize" ) == 1 )
+ {
+ // Add the vector change to the list
+ mlt_geometry key_frames = mlt_properties_get_data(
filter_properties,
"motion_vector_list", NULL );
+ if ( !key_frames )
+ {
+ key_frames = mlt_geometry_init();
+ mlt_properties_set_data( filter_properties,
"motion_vector_list", key_frames, 0, (mlt_destructor) mlt_geometry_close,
(mlt_serialiser) mlt_geometry_serialise );
+ if ( key_frames )
+ mlt_geometry_set_length( key_frames,
mlt_filter_get_length2( filter,
frame ) );
+ }
+ if ( key_frames )
+ {
+ struct mlt_geometry_item_s item;
+ item.frame = (int) mlt_frame_get_position( frame );
+ item.key = 1;
+ item.x = boundry.x;
+ item.y = boundry.y;
+ item.w = boundry.w;
+ item.h = boundry.h;
+ item.mix = 0;
+ item.f[0] = item.f[1] = item.f[2] = item.f[3] = 1;
+ item.f[4] = 0;
+ mlt_geometry_insert( key_frames, &item );
+ }
+ }
if( mlt_properties_get_int( filter_properties, "obscure" ) == 1 )
{
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Mlt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mlt-devel