CS194 Proj 5 Part 1

LOAD IMAGES

Used a picture, of a tiled floor.

In [8]:
plt.imshow(im_mid_v)
Out[8]:
<matplotlib.image.AxesImage at 0x1208466a0>
In [9]:
plt.imshow(im_left_v)
Out[9]:
<matplotlib.image.AxesImage at 0x16d154fd0>

Get Points

Enter points

Save file

Functions to compute homography

convert Left to middle orientation

In [18]:
 
Out[18]:
(4032, 3024, 3)

Get the points we want to transform the picture to

Rectification and warp the image using the homography matrix

I took a picture from the same perspective from the left side and the middle. I took the homography of transforming the middle/center view to the left side. The first picture below is warping the middle view to the left perspective using the homography matrix. and The second picture below is warping the left to the middle using the inverse of the homography (so we can go from the left perspective to the middle)

In [22]:
warped = warpImage(im_mid_v, homog_matrix, corners_left_uncrop) #warp middle to the left
In [23]:
warped = warpImage(im_left_v, inv(homog_matrix), im1_pts) #warp left to the middle
In [120]:
 
Out[120]:
array([[  0,   0],
       [  0, 100],
       [100, 100],
       [100,   0]])

Fail cases

In [23]:
 
In [24]:
 
Out[24]:
array([[[163, 137, 104],
        [163, 137, 104],
        [163, 137, 104],
        ...,
        [  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0]],

       [[163, 137, 104],
        [163, 137, 104],
        [163, 137, 104],
        ...,
        [  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0]],

       [[163, 137, 104],
        [163, 137, 104],
        [163, 137, 104],
        ...,
        [  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0]],

       ...,

       [[  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0],
        ...,
        [  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0]],

       [[  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0],
        ...,
        [  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0]],

       [[  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0],
        ...,
        [  0,   0,   0],
        [  0,   0,   0],
        [  0,   0,   0]]], dtype=uint8)
In [123]:
imname1 = 'brugesPainting.jpeg'
im1 = skio.imread(imname1) 
im1 = sk.img_as_float(im1)
plt.imshow(im1)
Out[123]:
<matplotlib.image.AxesImage at 0x128d97e48>