/usr/share/doc/python-dtcwt-doc/html/registration-3.py is in python-dtcwt-doc 0.12.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from pylab import *
import datasets
ref, src = datasets.regframes('traffic')
import dtcwt
transform = dtcwt.Transform2d()
ref_t = transform.forward(ref, nlevels=6)
src_t = transform.forward(src, nlevels=6)
import dtcwt.registration as registration
reg = registration.estimatereg(src_t, ref_t)
warped_src = registration.warp(src, reg, method='bilinear')
vxs, vys = registration.velocityfield(reg, ref.shape[:2], method='bilinear')
vxs = vxs * ref.shape[1]
vys = vys * ref.shape[0]
figure()
X, Y = np.meshgrid(np.arange(ref.shape[1]), np.arange(ref.shape[0]))
imshow(ref, cmap=cm.gray, clim=(0,1))
step = 8
quiver(X[::step,::step], Y[::step,::step],
vxs[::step,::step], vys[::step,::step],
color='g', angles='xy', scale_units='xy', scale=0.25)
title('Estimated velocity field (x4 scale)')
|