<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>(r1.1 vs. r1.4) VideoMotion &lt; Cinelerra &lt; TWiki</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="robots" content="noindex" />
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="../../view/Cinelerra/WebRss?skin=rss&contenttype=text%2fxml" />
<!-- <base href="../../view/Cinelerra/VideoMotion" /> -->
<style type="text/css" media="all">
	/* Default TWiki layout */
	@import url('../../../pub/TWiki/PatternSkin/layout.css');
	/* Default TWiki style */
	@import url('../../../pub/TWiki/PatternSkin/style.css');
	/* Custom overriding layout per web or per topic */
	@import url('http://www.ftconsult.com/twiki/bin/view/Cinelerra/%USERLAYOUTURL%');
	/* Custom overriding style per web or per topic */
	@import url('http://www.ftconsult.com/twiki/bin/view/Cinelerra/%USERSTYLEURL%');
	.twikiToc li {
		list-style-image:url('../../../pub/TWiki/PatternSkin/i_arrow_down.gif');
	}	        
	.twikiWebIndicator {
		background-color:#D0D0D0;
	}
</style>
<style type="text/css" media="all"></style>
<script type="text/javascript">
<!-- HIDE
	function initPage() { }
-->
</script>
</head>
<body class="twikiNoViewPage twikiDiffPage"><a name="PageTop"></a>
<div class="twikiMiddleContainer"><div class="twikiMain"><div class="twikiSearchResults"><div class="twikiSearchResultsHeader">&nbsp;<tt><b>&lt;&lt;O&gt;&gt;</b></tt>&nbsp; Difference Topic
		<b><a href="../../view/Cinelerra/VideoMotion">VideoMotion</a></b>
		(<a href="http://www.ftconsult.com/twiki/bin/view/Cinelerra/VideoMotion?rev=r1.4">r1.4</a> - 11&nbsp;Jun&nbsp;2005 - <a class="twikiLink" href="../../view/Main/MarcinKostur">MarcinKostur</a>)</div>
<table class="twikiDiffTable" width="100%" cellspacing="0">
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META TOPICPARENT</strong> </th><td colspan="2" bgcolor="#FFFFCC"> <a class="twikiLink" href="../../view/Cinelerra/VideoEffect">VideoEffect</a> </td></tr>
</table>
<h3><a name="Motion_Tracker_Video_Effect"> </a> Motion Tracker Video Effect </h3>
</td></tr>
<tr bgcolor="#eeeeee" class="twikiDiffLineNumberHeader"><th align="left" colspan="9">Line: 130 to 130</th></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<p />
dir=/tmp
## integrate "relative vectors"  
</td></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffChangedHeader" colspan ="9"><b> Changed: </b></td></tr>
<tr><td bgcolor="#ff9999" class="twikiDiffDeletedMarker" valign="top" width="1%">&lt;<br />&lt;</td>
<td class="twikiDiffDeletedText">
cat ${dir}/motion* |awk  '{x+=$1;y+=$2;print FNR,x,y}'  &gt; ${dir}/tmpmt.dat
cat ${dir}/rotate* |awk  '{x+=$1; print FNR,x }' &gt; ${dir}/tmprt.dat
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
cat ${dir}/motion[0-9]* |awk  '{x+=$1;y+=$2;print FNR,x,y}'  &gt; ${dir}/tmpmt.dat
cat ${dir}/rotate[0-9]* |awk  '{x+=$1; print FNR,x }' &gt; ${dir}/tmprt.dat
</td></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
## recreate the absolute vector in "cinelerra" format (one file per frame)
cat ${dir}/tmpmt.dat | while read i x  X; 
do 
</td></tr>

</table></div><div class="twikiSearchResults"><div class="twikiSearchResultsHeader">&nbsp;<tt><b>&lt;&lt;O&gt;&gt;</b></tt>&nbsp; Difference Topic
		<b><a href="../../view/Cinelerra/VideoMotion">VideoMotion</a></b>
		(<a href="http://www.ftconsult.com/twiki/bin/view/Cinelerra/VideoMotion?rev=r1.3">r1.3</a> - 10&nbsp;Jun&nbsp;2005 - <a class="twikiLink" href="../../view/Main/MarcinKostur">MarcinKostur</a>)</div>
<table class="twikiDiffTable" width="100%" cellspacing="0">
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META TOPICPARENT</strong> </th><td colspan="2" bgcolor="#FFFFCC"> <a class="twikiLink" href="../../view/Cinelerra/VideoEffect">VideoEffect</a> </td></tr>
</table>
<h3><a name="Motion_Tracker_Video_Effect"> </a> Motion Tracker Video Effect </h3>
</td></tr>
<tr bgcolor="#eeeeee" class="twikiDiffLineNumberHeader"><th align="left" colspan="9">Line: 6 to 6</th></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<p />
<h4><a name="Basic_Usage"> </a> Basic Usage </h4>
</td></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffAddedHeader" colspan ="9"><b> Added:   </b>
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
The very fist remark: motion tracking is calculated as you play the track if the option 
"Play every frame" in preferenced is set.
</td></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
You'll find the motion tracker in the resource dialog under Video Effects.
<img src="../../../pub/Cinelerra/VideoMotion/cin_eff.jpg" alt="cin_eff.jpg" />
</td></tr>
<tr bgcolor="#eeeeee" class="twikiDiffLineNumberHeader"><th align="left" colspan="9">Line: 63 to 66</th></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<ul>
<li> Maximum absolute offset and Settling speed.  I can guess at these, but have not experimented enough to explain them.  Leave them unadjusted for now.
</li>
<li> Draw vectors.  Uncheck this to prevent rendering of the target boxes and motion vectors in your rendered video.  If checked, the vectors and boxes are rendered in output video.
</li>
<li> Set - Track Single Frame - for this example with a Frame number of 0 (first frame.)
</li>
</ul>
</td></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffChangedHeader" colspan ="9"><b> Changed: </b></td></tr>
<tr><td bgcolor="#ff9999" class="twikiDiffDeletedMarker" valign="top" width="1%">&lt;<br />&lt;</td>
<td class="twikiDiffDeletedText">
<ul>
<li> Master Layer - I do not know.  Does not seem to make a difference in this video sample.  Let me know if you can explain what this does.
</li>
</ul>
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
<ul>
<li> Master Layer - If the effect is shared between two tracks it specifies which of those tracks 
                    will be the one where motion is tracked (Master Layer) and which layer will 
                    be affected by the resulting translation vectors (Target Layer). If there is no 
                    second track sharing motion tracker then the Master=Target.   
</li>
</ul>
</td></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<ul>
<li> Action - Select one of the stabilize options to have the rendered video follow the motion of the target (play the video to see what I mean.)  Select a Track option to run motion tracking without adjusting the video (for possible output of vectors?)
</li>
<li> Calculation:  
<ul>
<li> Don't Calculate - select this option to turn off adjustment of video.
</li>
<li> Recalculate - Perform motion tracking and update video per Action setting.
</li>
</ul>
</li>
</ul>
</td></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffChangedHeader" colspan ="9"><b> Changed: </b></td></tr>
<tr><td bgcolor="#ff9999" class="twikiDiffDeletedMarker" valign="top" width="1%">&lt;<br />&lt;</td>
<td class="twikiDiffDeletedText">
<ul>
<li>
<ul>
<li> Save and Load - I have not tried these.
</li>
</ul>
</li>
</ul>
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
<ul>
<li>
<ul>
<li> Save and Load - Saves/Loads the translation/rotation vectors (absolute or relative) 
                        to/from files. Each frame gets an separate file in /tmp directory 
                        which contains its vector. 
</li>
</ul>
</li>
</ul>
</td></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<p />
<p />
-- <a class="twikiLink" href="../../view/Main/KevinBrosius">KevinBrosius</a> - 29 Jan 2005
</td></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffAddedHeader" colspan ="9"><b> Added:   </b>
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
Application to move the second track.
<p />
The motion tracker can be applied to force some target layer to follow
an object in the master layer track.  The simplest application I can
imagine is to have floating label of some object which moves in the 
master layer (see e.g. videos below). 
<p />
There are following steps to achieve this effect: 
<img src="../../../pub/Cinelerra/VideoMotion/motion_tracking1.jpg" alt="motion_tracking1.jpg" /> 
<p />
1) "Video 1" layer was created on which the "Motion" is applied.
<p />
2) I added "Video 2" track which contains only the tittle effect with
my text.
<p />
3) Using right mouse click on Video 2 I added the share effect: "Video
1: Motion"
<p />
4) Additionally i spliced once more the content of Video 1 to Video 3
since the cinelerra did not display the "master track" for some
unknown reason. The resultting video is:
<a href="http://mk.phys.us.edu.pl/movies/motion_track_single_frame.avi" target="_top">http://mk.phys.us.edu.pl/movies/motion_track_single_frame.avi</a> 
<p />
Motion tracking can be done in absolute (Track single frame) and
relative (Track previous frame) way. The first one give automatically
some results but it is likely that after few seconds the tracker will
loose its primary object as in above video.  
<p />
<p />
On the other hand the relative tracking does not move the target layer
with the integrated vector but only with interframe translation which is
not useful. There is a possible work around: I saved the relative
vectors to files by playing video with "Calculation:Save" option and
integrated them by a script (see below). Then I changed the option in
tracker to "Calculation:Load" and rendered the video. The integrated
vectors might have some "drift" as a result of accumulated errors but
they will never show a jump. The results are
<a href="http://mk.phys.us.edu.pl/movies/motion_track_previous_frame.avi" target="_top">http://mk.phys.us.edu.pl/movies/motion_track_previous_frame.avi</a>
and it looks even better when one turns off the rotation:
<a href="http://mk.phys.us.edu.pl/movies/motion_track_previous_frame_norotations.avi" target="_top">http://mk.phys.us.edu.pl/movies/motion_track_previous_frame_norotations.avi</a>
<p />
<p />
<pre>
#!/bin/sh

#        Integration of interframe motion vectors

dir=/tmp
## integrate "relative vectors"  
cat ${dir}/motion* |awk  '{x+=$1;y+=$2;print FNR,x,y}'  &gt; ${dir}/tmpmt.dat
cat ${dir}/rotate* |awk  '{x+=$1; print FNR,x }' &gt; ${dir}/tmprt.dat
## recreate the absolute vector in "cinelerra" format (one file per frame)
cat ${dir}/tmpmt.dat | while read i x  X; 
do 
 name=`printf "motion%06d"  $i`
 echo "$x $X" &gt; ${dir}/${name}
done
cat ${dir}/tmprt.dat | while read i x; 
 do 
  name=`printf "rotate%06d"  $i`
  echo "$x" &gt; ${dir}/${name}
done
</pre>
<p />
<p />
</td></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_eff.jpg </td><td bgcolor="#FFFFCC"> attr="" comment="Motion Video Effect in resource dialog" date="1106963873" path="cin_eff.jpg" size="32997" user="KevinBrosius" version="1.2" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFFF"> cin_timeline_eff_clip.png </td><td bgcolor="#FFFFFF"> attr="" comment="Clip of timeline with video and motion" date="1107013186" path="cin_timeline_eff_clip.png" size="185132" user="KevinBrosius" version="1.2" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_motion_win.jpg </td><td bgcolor="#FFFFCC"> attr="" comment="Motion effect dialog" date="1106965966" path="cin_motion_win.jpg" size="49191" user="KevinBrosius" version="1.1" </td></tr>
</table>
</td></tr>
<tr bgcolor="#eeeeee" class="twikiDiffLineNumberHeader"><th align="left" colspan="9">Line: 82 to 156</th></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_motion_track.png </td><td bgcolor="#FFFFCC"> attr="" comment="motion target settings" date="1107009527" path="cin_motion_track.png" size="80948" user="KevinBrosius" version="1.1" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFFF"> cin_comp_first_setup_small.jpg </td><td bgcolor="#FFFFFF"> attr="" comment="adjusted tracker in compositor" date="1107010662" path="cin_comp_first_setup_small.jpg" size="38778" user="KevinBrosius" version="1.1" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_motion_set_output1.png </td><td bgcolor="#FFFFCC"> attr="" comment="motion output settings" date="1107011326" path="cin_motion_set_output1.png" size="63858" user="KevinBrosius" version="1.1" </td></tr>
</table>
</td></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffAddedHeader" colspan ="9"><b> Added:   </b>
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> motion_tracking1.png </td><td bgcolor="#FFFFCC"> attr="" comment="Floating Label" date="1118402936" path="motion_tracking1.png" size="137064" user="MarcinKostur" version="1.1" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFFF"> motion_tracking1.jpg </td><td bgcolor="#FFFFFF"> attr="" comment="Floating label" date="1118403157" path="motion_tracking1.jpg" size="150499" user="MarcinKostur" version="1.1" </td></tr>
</table>
</td></tr>

</table></div><div class="twikiSearchResults"><div class="twikiSearchResultsHeader">&nbsp;<tt><b>&lt;&lt;O&gt;&gt;</b></tt>&nbsp; Difference Topic
		<b><a href="../../view/Cinelerra/VideoMotion">VideoMotion</a></b>
		(<a href="http://www.ftconsult.com/twiki/bin/view/Cinelerra/VideoMotion?rev=r1.2">r1.2</a> - 29&nbsp;Jan&nbsp;2005 - <a class="twikiLink" href="../../view/Main/KevinBrosius">KevinBrosius</a>)</div>
<table class="twikiDiffTable" width="100%" cellspacing="0">
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META TOPICPARENT</strong> </th><td colspan="2" bgcolor="#FFFFCC"> <a class="twikiLink" href="../../view/Cinelerra/VideoEffect">VideoEffect</a> </td></tr>
</table>
<h3><a name="Motion_Tracker_Video_Effect"> </a> Motion Tracker Video Effect </h3>
</td></tr>
<tr bgcolor="#eeeeee" class="twikiDiffLineNumberHeader"><th align="left" colspan="9">Line: 9 to 9</th></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
You'll find the motion tracker in the resource dialog under Video Effects.
<img src="../../../pub/Cinelerra/VideoMotion/cin_eff.jpg" alt="cin_eff.jpg" />
</td></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffChangedHeader" colspan ="9"><b> Changed: </b></td></tr>
<tr><td bgcolor="#ff9999" class="twikiDiffDeletedMarker" valign="top" width="1%">&lt;<br />&lt;</td>
<td class="twikiDiffDeletedText">
Here's a quick sample activity to get an idea how the tracker works.  I've made a small sample mpeg1 video with a moving camera directed at a hanging garage door pull.  You can get the video sample from <a href="http://kevb.net/files/swing_short1.m1v" target="_top">http://kevb.net/files/swing_short1.m1v</a> (2.6M)  Run <code>mpeg3toc swing_short1.m1v swing_short1.toc</code> and then start up cinelerra and load the .toc file into your timeline.
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
Here is a quick sample activity to get an idea of how the tracker works.  I have made a small sample mpeg1 video with a moving camera directed at a hanging garage door pull.  You can get the video sample from <a href="http://kevb.net/files/swing_short1.m1v" target="_top">http://kevb.net/files/swing_short1.m1v</a> (2.6M)  Run <code>mpeg3toc swing_short1.m1v swing_short1.toc</code> and then start up cinelerra and load the .toc file into your timeline.
</td></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">

</td></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffChangedHeader" colspan ="9"><b> Changed: </b></td></tr>
<tr><td bgcolor="#ff9999" class="twikiDiffDeletedMarker" valign="top" width="1%">&lt;<br />&lt;</td>
<td class="twikiDiffDeletedText">
Now that you've got some video to work with, go ahead and add a motion effect to the track.  Drag it from the resource window and drop it directly over the video in cinelerra's main window.  You should see something like this:
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
Now that you have some video to work with, go ahead and add a motion effect to the track.  Drag it from the resource window and drop it directly over the video in cinelerra's main window.  You should see something like this:
</td></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<p />
<img src="../../../pub/Cinelerra/VideoMotion/cin_timeline_eff_clip.png" alt="cin_timeline_eff_clip.png" />
</td></tr>
<tr bgcolor="#eeeeee" class="twikiDiffLineNumberHeader"><th align="left" colspan="9">Line: 19 to 19</th></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<p />
<img src="../../../pub/Cinelerra/VideoMotion/cin_motion_win.jpg" alt="cin_motion_win.jpg" />
</td></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffChangedHeader" colspan ="9"><b> Changed: </b></td></tr>
<tr><td bgcolor="#ff9999" class="twikiDiffDeletedMarker" valign="top" width="1%">&lt;<br />&lt;</td>
<td class="twikiDiffDeletedText">
(still in progress ... send me comments if you have suggestions)
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
A couple quick notes:
<p />
<ul>
<li> <img src="../../../pub/Cinelerra/VideoMotion/cin_knob.png" alt="cin_knob.png" />  This is a knob.  It was not intuitive to me, so in case you suffer the same lack of vision...  It is the equivalent of a slider.  Anywhere you see one in the dialog there is a setting you can adjust.  The top six knobs must be adjusted for your image.  The defaults are not likely to match your image.
</li>
<li> Calculation:  Very important setting.  Set to Recalculate to render and display motion tracking realtime.  Set to Don't Calculate to turn off motion tracker effect on video.
</li>
</ul>
<p />
<h4><a name="Settings_Introduction"> </a> Settings Introduction </h4>
<p />
Start by looking at your Compositor.  You will see some new boxes overlayed on the video.  These are important to control the motion tracker.  Here is a quick shot of what it will look like when working:
<p />
<img src="../../../pub/Cinelerra/VideoMotion/cin_comp_action_small.jpg" alt="cin_comp_action_small.jpg" />
<p />
Now I was not completely honest with you.  The image above shows the motion tracker losing track of the object because of a search window that is to small.  We will talk about this more later, but quickly:
<ul>
<li> The middle small box is the target of the tracker.
</li>
<li> The middle larger box is the search range for the tracker.  It should contain the full range of motion for the tracking target.
</li>
<li> In this example, we are trying to track the hanging handle.  We have failed in this video frame, because the handle is far right of the center of frame.
</li>
<li> The left pointing vector indicates the motion tracker attempting to find the target.  More on this later.
</li>
</ul>
<p />
<h4><a name="Trying_it_out"> </a> Trying it out </h4>
<p />
<ul>
<li> Move to the beginning of your video clip
</li>
<li> Make sure the motion tracker dialog is open
</li>
<li> Look at the Compositor
</li>
<li> Start adjusting these four knobs:
</li>
</ul>
<p />
<img src="../../../pub/Cinelerra/VideoMotion/cin_motion_track.png" alt="cin_motion_track.png" />
<p />
<ul>
<li> Make sure you check Track Translation
</li>
<li> Uncheck Track Rotation
</li>
<li> Start with knob two - Translation block size - and spin it to get an idea for what is changing.  Notice that both boxes resize.  Look at the small inside box.  Adjust it to the size of the target (the object you want to track.)  Do not worry if it does not cover the object yet.
</li>
<li> Go on to knobs three and four - Block X and Block Y.  Use these to put the target designator over the target itself.
</li>
<li> Finally, use the top knob - Translation search radius.  Expand it to include the full range of travel you expect for the target.  If you look back at my original action shot, the search radius was to small and the target moved outside the range.  You can test this by playing the timeline and viewing the results (if your machine is fast enough for realtime) or by rendering and viewing the stabilized handle in the output.
</li>
<li> Make the first video frame look similar to:
</li>
</ul>
<p />
<img src="../../../pub/Cinelerra/VideoMotion/cin_comp_first_setup_small.jpg" alt="cin_comp_first_setup_small.jpg" />
<p />
This image shows a lot of detail.  Notice that the small frame is centered over the handle and sized to just include it.  Those settings are control by knobs two through four.  Finally, the outer frame is larger than the back and forth movement of the handle in the entire video clip.
<p />
Finally, here are other settings needed to see the effect.
<p />
<img src="../../../pub/Cinelerra/VideoMotion/cin_motion_set_output1.png" alt="cin_motion_set_output1.png" />
<p />
<ul>
<li> Maximum absolute offset and Settling speed.  I can guess at these, but have not experimented enough to explain them.  Leave them unadjusted for now.
</li>
<li> Draw vectors.  Uncheck this to prevent rendering of the target boxes and motion vectors in your rendered video.  If checked, the vectors and boxes are rendered in output video.
</li>
<li> Set - Track Single Frame - for this example with a Frame number of 0 (first frame.)
</li>
<li> Master Layer - I do not know.  Does not seem to make a difference in this video sample.  Let me know if you can explain what this does.
</li>
<li> Action - Select one of the stabilize options to have the rendered video follow the motion of the target (play the video to see what I mean.)  Select a Track option to run motion tracking without adjusting the video (for possible output of vectors?)
</li>
<li> Calculation:  
<ul>
<li> Don't Calculate - select this option to turn off adjustment of video.
</li>
<li> Recalculate - Perform motion tracking and update video per Action setting.
</li>
<li> Save and Load - I have not tried these.
</li>
</ul>
</li>
</ul>
</td></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<p />
-- <a class="twikiLink" href="../../view/Main/KevinBrosius">KevinBrosius</a> - 29 Jan 2005
<p />
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_eff.jpg </td><td bgcolor="#FFFFCC"> attr="" comment="Motion Video Effect in resource dialog" date="1106963873" path="cin_eff.jpg" size="32997" user="KevinBrosius" version="1.2" </td></tr>
</table>
</td></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffChangedHeader" colspan ="9"><b> Changed: </b></td></tr>
<tr><td bgcolor="#ff9999" class="twikiDiffDeletedMarker" valign="top" width="1%">&lt;<br />&lt;</td>
<td class="twikiDiffDeletedText">
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_timeline_eff_clip.png </td><td bgcolor="#FFFFCC"> attr="" comment="Clip of timeline with video and motion" date="1106965236" path="cin_timeline_eff_clip.png" size="169165" user="KevinBrosius" version="1.1" </td></tr>
</table>
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_timeline_eff_clip.png </td><td bgcolor="#FFFFCC"> attr="" comment="Clip of timeline with video and motion" date="1107013186" path="cin_timeline_eff_clip.png" size="185132" user="KevinBrosius" version="1.2" </td></tr>
</table>
</td></tr>
<tr><td valign="top" bgcolor="#ffffff" class="twikiDiffUnchangedText" width="1%"><br /></td>
<td class="twikiDiffUnchangedText">
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_motion_win.jpg </td><td bgcolor="#FFFFCC"> attr="" comment="Motion effect dialog" date="1106965966" path="cin_motion_win.jpg" size="49191" user="KevinBrosius" version="1.1" </td></tr>
</table>
</td></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffAddedHeader" colspan ="9"><b> Added:   </b>
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_knob.png </td><td bgcolor="#FFFFCC"> attr="" comment="The knob" date="1107005164" path="cin_knob.png" size="5192" user="KevinBrosius" version="1.1" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFFF"> cin_comp_action.jpg </td><td bgcolor="#FFFFFF"> attr="" comment="motion tracker in action" date="1107006022" path="cin_comp_action.jpg" size="66782" user="KevinBrosius" version="1.1" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_comp_action_small.jpg </td><td bgcolor="#FFFFCC"> attr="" comment="motion tracker in action" date="1107007819" path="cin_comp_action_small.jpg" size="37577" user="KevinBrosius" version="1.2" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFFF"> cin_motion_track.png </td><td bgcolor="#FFFFFF"> attr="" comment="motion target settings" date="1107009527" path="cin_motion_track.png" size="80948" user="KevinBrosius" version="1.1" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_comp_first_setup_small.jpg </td><td bgcolor="#FFFFCC"> attr="" comment="adjusted tracker in compositor" date="1107010662" path="cin_comp_first_setup_small.jpg" size="38778" user="KevinBrosius" version="1.1" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFFF"> cin_motion_set_output1.png </td><td bgcolor="#FFFFFF"> attr="" comment="motion output settings" date="1107011326" path="cin_motion_set_output1.png" size="63858" user="KevinBrosius" version="1.1" </td></tr>
</table>
</td></tr>

</table></div><div class="twikiSearchResults"><div class="twikiSearchResultsHeader">&nbsp;<tt><b>&lt;&lt;O&gt;&gt;</b></tt>&nbsp; Difference Topic
		<b><a href="../../view/Cinelerra/VideoMotion">VideoMotion</a></b>
		(<a href="http://www.ftconsult.com/twiki/bin/view/Cinelerra/VideoMotion?rev=r1.1">r1.1</a> - 29&nbsp;Jan&nbsp;2005 - <a class="twikiLink" href="../../view/Main/KevinBrosius">KevinBrosius</a>)</div>
<table class="twikiDiffTable" width="100%" cellspacing="0">
<tr bgcolor="#eeeeee" class="twikiDiffLineNumberHeader"><th align="left" colspan="9">Line: 1 to 1</th></tr>
<tr><td bgcolor="#D0FFD0" class="twikiDiffAddedHeader" colspan ="9"><b> Added:   </b>
</td></tr>
<tr><td bgcolor="#ccccff" class="twikiDiffAddedMarker" valign="top" width="1%">&gt;<br />&gt;</td>
<td class="twikiDiffAddedText">
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META TOPICPARENT</strong> </th><td colspan="2" bgcolor="#FFFFCC"> <a class="twikiLink" href="../../view/Cinelerra/VideoEffect">VideoEffect</a> </td></tr>
</table>
<h3><a name="Motion_Tracker_Video_Effect"> </a> Motion Tracker Video Effect </h3>
<p />
Cinelerra 1.2.2 now includes a motion tracker effect.  It can be used for simple video stabilization and much more.  There are some great video clips up on Heroinewarrier.com in the <a href="http://heroinewarrior.com/movies.php3" target="_top">screening room</a> to give you an idea of what can be done.
<p />
<h4><a name="Basic_Usage"> </a> Basic Usage </h4>
<p />
You'll find the motion tracker in the resource dialog under Video Effects.
<img src="../../../pub/Cinelerra/VideoMotion/cin_eff.jpg" alt="cin_eff.jpg" />
<p />
Here's a quick sample activity to get an idea how the tracker works.  I've made a small sample mpeg1 video with a moving camera directed at a hanging garage door pull.  You can get the video sample from <a href="http://kevb.net/files/swing_short1.m1v" target="_top">http://kevb.net/files/swing_short1.m1v</a> (2.6M)  Run <code>mpeg3toc swing_short1.m1v swing_short1.toc</code> and then start up cinelerra and load the .toc file into your timeline.
<p />
Now that you've got some video to work with, go ahead and add a motion effect to the track.  Drag it from the resource window and drop it directly over the video in cinelerra's main window.  You should see something like this:
<p />
<img src="../../../pub/Cinelerra/VideoMotion/cin_timeline_eff_clip.png" alt="cin_timeline_eff_clip.png" />
<p />
Right-click on the motion effect marker in the timeline and select show to see the motion tracker dialog:
<p />
<img src="../../../pub/Cinelerra/VideoMotion/cin_motion_win.jpg" alt="cin_motion_win.jpg" />
<p />
(still in progress ... send me comments if you have suggestions)
<p />
-- <a class="twikiLink" href="../../view/Main/KevinBrosius">KevinBrosius</a> - 29 Jan 2005
<p />
<table border="1" cellspacing="1" cellpadding="0">
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_eff.jpg </td><td bgcolor="#FFFFCC"> attr="" comment="Motion Video Effect in resource dialog" date="1106963873" path="cin_eff.jpg" size="32997" user="KevinBrosius" version="1.2" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFFF"> cin_timeline_eff_clip.png </td><td bgcolor="#FFFFFF"> attr="" comment="Clip of timeline with video and motion" date="1106965236" path="cin_timeline_eff_clip.png" size="169165" user="KevinBrosius" version="1.1" </td></tr>
<tr><th class="twikiFirstCol" bgcolor="#99CCCC"> <strong>META FILEATTACHMENT</strong> </th><td bgcolor="#FFFFCC"> cin_motion_win.jpg </td><td bgcolor="#FFFFCC"> attr="" comment="Motion effect dialog" date="1106965966" path="cin_motion_win.jpg" size="49191" user="KevinBrosius" version="1.1" </td></tr>
</table>
</td></tr>

</table></div><div class="twikiTopicAction"><a href="../../view/Cinelerra/VideoMotion">View topic</a>
 <span class="twikiSeparator">|</span> <a href="VideoMotion">Diffs</a>  | <a href="http://www.ftconsult.com/twiki/bin/view/Cinelerra/VideoMotion?rev=1.4">r1.4</a> | <a href="http://www.ftconsult.com/twiki/bin/rdiff/Cinelerra/VideoMotion?rev1=1.4&rev2=1.3">&gt;</a> | <a href="http://www.ftconsult.com/twiki/bin/view/Cinelerra/VideoMotion?rev=1.3">r1.3</a> | <a href="http://www.ftconsult.com/twiki/bin/rdiff/Cinelerra/VideoMotion?rev1=1.3&rev2=1.2">&gt;</a> | <a href="http://www.ftconsult.com/twiki/bin/view/Cinelerra/VideoMotion?rev=1.2">r1.2</a>
 <span class="twikiSeparator">|</span> <a href="http://www.ftconsult.com/twiki/bin/oops/Cinelerra/VideoMotion?template=oopsmore&param1=1.4&param2=1.4">More</a>
</div><div class="twikiTopicInfo"><span class="twikiRevInfo twikiGrayText">Revision r1.1 - 29 Jan 2005 - 02:00 - <a class="twikiLink" href="../../view/Main/KevinBrosius">KevinBrosius</a><br />
Revision r1.4 - 11 Jun 2005 - 11:05 - <a class="twikiLink" href="../../view/Main/MarcinKostur">MarcinKostur</a></span></div>
<div class="twikiTopicFooter"></div>
<a name="PageBottom"></a> </div></div>
</body></html>