# Load correct frame range. last = j if ((j + 2*step) >= film_l): i3_data.loadDataInFrames(fmin = j) step_step = 2*step else: i3_data.loadDataInFrames(fmin = j, fmax = j + step - 1) step_step = step xycurr = i3_data.i3To2DGridAllChannelsMerged(uncorrected = True) # Correlate to master image. [corr, dx, dy, xy_success] = imagecorrelation.xyOffset(xymaster, xycurr, i3_data.getScale(), center = [x[index-1] * scale, y[index-1] * scale]) # Update values if xy_success: old_dx = dx old_dy = dy else: dx = old_dx dy = old_dy dx = dx/float(scale) dy = dy/float(scale) t.append(step/2 + index * step)
centers.append((end1 - start1)/2 + start1) if (start1 > endpost): continue if not (start1 == start2): if (old_start1 != start1): i3_data.loadDataInFrames(fmin = start1, fmax = end1-1) sub1 = i3_data.i3To2DGridAllChannelsMerged(uncorrected = True) old_start1 = start1 i3_data.loadDataInFrames(fmin = start2, fmax = end2-1) sub2 = i3_data.i3To2DGridAllChannelsMerged(uncorrected = True) [corr, dx, dy, success] = imagecorrelation.xyOffset(sub1, sub2, scale) dx = dx/float(scale) dy = dy/float(scale) print "offset between frame ranges ", start1, "-" , end1 , " and ", start2, "-", end2 if success: print " -> ", dx, dy, "good" else: print " -> ", dx, dy, "bad" print "" pairs.append([i, j, dx, dy, success])