[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55844] trunk/blender: Revert change made to bilinear sampler in libmv

Sergey Sharybin sergey.vfx at gmail.com
Sat Apr 6 16:47:45 CEST 2013


Revision: 55844
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55844
Author:   nazgul
Date:     2013-04-06 14:47:45 +0000 (Sat, 06 Apr 2013)
Log Message:
-----------
Revert change made to bilinear sampler in libmv

This made preview working but that broke internals
of tracking.

Namely, BlurredImageAndDerivativesChannels is giving
much more blurred image because it was assuming pixel
center is an integer position.

Guess other parts of libmv used to suffer because of
this issue.

Now pixel centering happens in blender side, and
libmv assumes integer position is a pixel center.

Modified Paths:
--------------
    trunk/blender/extern/libmv/libmv/image/sample.h
    trunk/blender/source/blender/blenkernel/intern/tracking.c

Modified: trunk/blender/extern/libmv/libmv/image/sample.h
===================================================================
--- trunk/blender/extern/libmv/libmv/image/sample.h	2013-04-06 14:45:50 UTC (rev 55843)
+++ trunk/blender/extern/libmv/libmv/image/sample.h	2013-04-06 14:47:45 UTC (rev 55844)
@@ -59,10 +59,6 @@
   int x1, y1, x2, y2;
   float dx, dy;
 
-  // Take the upper left corner as integer pixel positions.
-  x -= 0.5;
-  y -= 0.5;
-
   LinearInitAxis(y, image.Height(), &y1, &y2, &dy);
   LinearInitAxis(x, image.Width(),  &x1, &x2, &dx);
 
@@ -82,10 +78,6 @@
   int x1, y1, x2, y2;
   float dx, dy;
 
-  // Take the upper left corner as integer pixel positions.
-  x -= 0.5;
-  y -= 0.5;
-
   LinearInitAxis(y, image.Height(), &y1, &y2, &dy);
   LinearInitAxis(x, image.Width(),  &x1, &x2, &dx);
 

Modified: trunk/blender/source/blender/blenkernel/intern/tracking.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/tracking.c	2013-04-06 14:45:50 UTC (rev 55843)
+++ trunk/blender/source/blender/blenkernel/intern/tracking.c	2013-04-06 14:47:45 UTC (rev 55844)
@@ -356,8 +356,8 @@
 	/* Convert the corners into search space coordinates. */
 	for (i = 0; i < 4; i++) {
 		marker_unified_to_search_pixel(frame_width, frame_height, marker, marker->pattern_corners[i], pixel_coords);
-		search_pixel_x[i] = pixel_coords[0];
-		search_pixel_y[i] = pixel_coords[1];
+		search_pixel_x[i] = pixel_coords[0] - 0.5;
+		search_pixel_y[i] = pixel_coords[1] - 0.5;
 	}
 
 	/* Convert the center position (aka "pos"); this is the origin */
@@ -365,8 +365,8 @@
 	unified_coords[1] = 0.0;
 	marker_unified_to_search_pixel(frame_width, frame_height, marker, unified_coords, pixel_coords);
 
-	search_pixel_x[4] = pixel_coords[0];
-	search_pixel_y[4] = pixel_coords[1];
+	search_pixel_x[4] = pixel_coords[0] - 0.5;
+	search_pixel_y[4] = pixel_coords[1] - 0.5;
 }
 
 /* Inverse of above. */
@@ -379,14 +379,14 @@
 
 	/* Convert the corners into search space coordinates. */
 	for (i = 0; i < 4; i++) {
-		search_pixel[0] = search_pixel_x[i];
-		search_pixel[1] = search_pixel_y[i];
+		search_pixel[0] = search_pixel_x[i] + 0.5;
+		search_pixel[1] = search_pixel_y[i] + 0.5;
 		search_pixel_to_marker_unified(frame_width, frame_height, marker, search_pixel, marker->pattern_corners[i]);
 	}
 
 	/* Convert the center position (aka "pos"); this is the origin */
-	search_pixel[0] = search_pixel_x[4];
-	search_pixel[1] = search_pixel_y[4];
+	search_pixel[0] = search_pixel_x[4] + 0.5;
+	search_pixel[1] = search_pixel_y[4] + 0.5;
 	search_pixel_to_marker_unified(frame_width, frame_height, marker, search_pixel, marker_unified);
 
 	/* If the tracker tracked nothing, then "marker_unified" would be zero.




More information about the Bf-blender-cvs mailing list