[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40245] branches/soc-2011-tomato/source/ blender/blenkernel/intern/tracking.c: Camera tracking integration

Sergey Sharybin g.ulairi at gmail.com
Thu Sep 15 21:40:38 CEST 2011


Revision: 40245
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40245
Author:   nazgul
Date:     2011-09-15 19:40:38 +0000 (Thu, 15 Sep 2011)
Log Message:
-----------
Camera tracking integration
===========================

Fixed bug with wrong position applied on manual tracking when
track is getting to close to the image boundary.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c	2011-09-15 19:32:02 UTC (rev 40244)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c	2011-09-15 19:40:38 UTC (rev 40245)
@@ -969,6 +969,7 @@
 			double x1, y1, x2, y2;
 			ImBuf *ibuf= NULL;
 			MovieTrackingMarker marker_new, *marker_keyed;
+			int onbound= 0;
 
 			if(!context->settings.adjframes) need_readjust= context->first_time;
 			else need_readjust= context->frames%context->settings.adjframes == 0;
@@ -982,6 +983,7 @@
 			/* do not track markers which are too close to boundary */
 			if(marker->pos[0]<margin[0] || marker->pos[0]>1.f-margin[0] ||
 			   marker->pos[1]<margin[1] || marker->pos[1]>1.f-margin[1]) {
+				onbound= 1;
 			}
 			else if(context->settings.tracker==TRACKER_KLT) {
 				int wndx, wndy;
@@ -1104,8 +1106,14 @@
 				}
 
 				memset(&marker_new, 0, sizeof(marker_new));
-				marker_new.pos[0]= (origin[0]+x2)/ibuf_new->x;
-				marker_new.pos[1]= (origin[1]+y2)/ibuf_new->y;
+
+				if(!onbound) {
+					marker_new.pos[0]= (origin[0]+x2)/ibuf_new->x;
+					marker_new.pos[1]= (origin[1]+y2)/ibuf_new->y;
+				} else {
+					copy_v2_v2(marker_new.pos, marker->pos);
+				}
+
 				marker_new.flag|= MARKER_TRACKED;
 
 				if(context->backwards) marker_new.framenr= curfra-1;




More information about the Bf-blender-cvs mailing list