# 15-869 Image Based Modeling & Rendering

### Assignment 3: Single View Metrology

###### Results for Chris Rodriguez (cjr2@andrew.cmu.edu)

This assignment is based on a paper by A. Criminisi, I.Reid and A. Zisserman named Single View Metrology.  Starting with the code for image warping from the first assignment, slightly modified, I created an interface to find and draw vanishing lines, set reference heights and create polygons for 3d registration.  We will start with a picture of the user interface.

I have a way of placing 2 lines in the 3 cardinal directions to calculate the vanishing points for each of these directions.  To calculate the vanishing points, I used the Collins method and assumed that I knew the lines would intersect.  Also, to make my life easier, I bail out of any calculations after I figure out the vanishing points if they are at infinity.

The next thing that I should make note of is how I compute the scalars to the vanishing points.  I calculate the Z scalar the way it mentions in the paper, I use the formula with the vanishing points and vanishing line with a known height to find the z direction scalar.  I am able to calculate heights ok.  The this is I also calculate the scalars for the X direction and Y direction vanishing points the same way.  Although this seems to work for the X direction, it seems to be totally off in the y direction.  Here are some examples:

I took this image:

and created this vrml file.  When you look at it, it seems like it started out alright.  It registers the heights correctly and looks like it registers the x values ok, but the y values are off.  This is clearly seen when you rotate the left side of the cube.  It has the side shrunk and has it coming out, instead of going into the screen.  This is clearly wrong.  I was thinking that if I made the textures visible on both sides of the model and rotated around, it would be right, but I am not sure.

Worse yet, I tried to model this image:

and it created this vrml file.  Although the picture looks incredibly bad, if you look at the file itself, the X and Z values again look right, but the Y values are off in the thousands.

Positives:

1)  I feel I have a easy to use interface.

2)  I have sub-pixel registration, and unlimited zoom / unzoom (no constraint on number of times you do it).

3) I can calculate heights anywhere in the image.

4) It seems as if my X values work, but that is not 100% sure

5) My program takes the pieces of image and warps them to 128x128 textures correctly.

6) My program outputs a vrml file and also tiff images which it forks and converts to jpg's so the user doesn't have to do any extra work to test the vrml file.

Negatives:

1) My homography does not work quite right, and I am guessing it is because of the scalar values (mostly because I can solve for heights correctly).  I should have done the 4 points on the ground or the cube instead, but I thought my way would be easier.

Things I should have done to save time:

Have a way of saving the applications current state so I would not keep having to set up everything each time I tested it.  This was a big waste of time to set up vanishing lines and reference heights all the time for the same image.

Things I would have done if I wasn't so dumb:

1) I should have used 4 point registration on the ground.  I spent a great deal of time trying to figure out why my scalars weren't working correctly.

2) Not worried about some of my interface problems so much.

3) Given up much earlier