Camera tracing: search area was always centered to marker's position when tracking

This commit is contained in:
Sergey Sharybin 2012-02-21 12:59:52 +00:00
parent 88a2be1846
commit c8de268e1b
2 changed files with 4 additions and 4 deletions

@ -296,7 +296,7 @@ int libmv_regionTrackerTrack(libmv_RegionTracker *libmv_tracker, const float *im
double sx2 = *x2, sy2 = *y2;
int result = region_tracker->Track(old_patch, new_patch, x1, y1, x2, y2);
if (!result) {
if (!result {
saveImage("old_patch", old_patch, x1, y1);
saveImage("new_patch", new_patch, sx2, sy2);
}

@ -1100,13 +1100,13 @@ static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTracki
w= (max[0]-min[0])*ibuf->x;
h= (max[1]-min[1])*ibuf->y;
/* dimensions should be odd */
w= w|1;
h= h|1;
x1= x-(int)(w/2.0f);
y1= y-(int)(h/2.0f);
x1= x-(int)(w * (-min[0] / (max[0] - min[0])));
y1= y-(int)(h * (-min[1] / (max[1] - min[1])));
/* dimensions should be odd */
tmpibuf= IMB_allocImBuf(w+margin*2, h+margin*2, 32, IB_rect);
IMB_rectcpy(tmpibuf, ibuf, 0, 0, x1-margin, y1-margin, w+margin*2, h+margin*2);