CS 7321 Winter 1998

PS#3 Solutions by Bob Nayar

Mulit-image splining Problem


Index


How I solved it

 
Besides these, this project was just done "text-book style". I just followed the instructions for splining. They were (along with the other details) :

- Implement the simple 5 X 5 kernel in the Multi-Spline paper
- Implement REDUCE function in the paper.
- Implement EXPAND function in the paper. This was a little tricky, because of the different pixel-pair combinations.
- Make binary "boundary image or mask : S(i,j) = 1 for A, S(i,j) = 0 for B. In my case, this was simple : 1 on the left and 0 on the right.
- Compute Gaussian pyramid for the mask.
- Compute Laplacian pyramids for images A and B.
- Blend each pyramid layer using the formula Lout = (GS)LA + (1-GS)LB
- Collapse or rebuild Lout pyramid by expanding each level and adding it to the level above.
 
This project had horrible complexities, the major ones and the solutions of which were :

- the colormap issue : How do you handle the calculations with a 3-element wide color vector.
    In order to solve this, I divided each image into 3 layers for red, green and blue, and individually did the Gaussian / Laplacian calculations for each layer).
- the image mapping issue : How do you combine 2 images and a mask image, when each one could have a different size and colormap ?
    In order to wimp out of this, I used the same image mirrored, thereby getting the same size and colormap.
- the "nasty number" issue : How do you prevent MATLAB from getting nasty computation results that can cause atrocities such as non-integer indexes etc ?
    In order to scrape out from this one, I resized my images to have the size 2^n - 1.

to TOP


Assumptions and Weaknesses

I made the following assumptions (as mentioned above)
  1. Both images are the same size
  2. Both images are of the size 2^n -1
I think the major weakness of my solutions are:
  1. Inefficient code : My code was not optimized well-enough that I could run a 513 X 513 image before Halley's comet was in sight again. Instead, I ended up running 129 X 129 images. I am sure the 513 X 513 image would have turned out a lot better.
  2. Lack of experimentation : Because of lack of time, I am not sure if I could have improved some of the parameters such as the thickness of the padding, the kernel seed etc that could have made a significant difference.

to TOP


Improvements and Possible Future Work

I think that this can be improved by doing the following

to TOP


Results

 

Figure 1: These are the left and right images respectively. They are 513 X 513  images. Unfortunately, because of running times, I had to shrink these images to 129 X 129 images and spline them.  In case, the picture on the left does not show properly (It does not on Netscape 4.0), please understand that is the exact mirror image of the right.

 
 


Figure 2: This is the result maginfied by 2 ( ie the original result was 129 X 129, and I used XV to double the size)
                It is obvious that I have something "flaky" in either my REDUCE or EXPAND functions, especially where the smoothing is involved.
 

to TOP


Source Code