Task: Radial distortion of image

Write a python script/function, that undistorts lines extracted from the image, and the image itself, using known radial distortion parameters. Images and lines are here. The camera uses equi-angular radial distortionmodel. The parameters are:

In [24]:
im_center = [ 676, 503 ]
f = 456
In [2]:
import numpy as np
import matplotlib.pyplot as plt
import scipy.io as sio
In [22]:
im1 = plt.imread( 'data/rd/01.png')
im2 = plt.imread( 'data/rd/02.png')
plt.imshow( im1, cmap='gray' )
Out[22]:
<matplotlib.image.AxesImage at 0x7fcff1ed02d0>
In [13]:
lines = sio.loadmat( 'data/rd/lines.mat')
lines = lines['lines'][0]
In [17]:
for l in lines:
    plt.plot( l[0], l[1] )
In [25]:
%run task_rd
In [ ]: