Implementation of "Multiresolution Spline With Application to Image Mosaics" Paper
12 ==> 102
22 000
202
The first run basically moves the pixels to the right two places, this is when a 1X5 kernel of a=4 is convolved with the image. Then we move the pixel down by two and we convolve again with the transpose of the kernel -in other words a 5X1 kernel. So, for the expand function, we now have an image that is double the size of the original. The reduce funtion works the opposite way. Each pixel at the bottom right corner of a group of 4 neighbor pixels is copied into a new image. As explained above, first the pixel is shifted left by two places, convolved, then shifted up two places and convolved with the transpose kernel.
Next, I wrote the make pyramid function which creates a structure to contain the Gaussian and Laplacian pyramid images. It figures how many times it needs to expand and reduce based on the image size. I assumed that all images will be same in size for conveniance, that way I could pad them to the 2^Nx2^M format which my algorithm is written around. So, basically, I implemented the left half of the chart that was provided to us in class. In other words, I started with the original image, put it in the Gaussian list and then reduced it, placed it also in the Gaussian list and so on, until the image was down to a size of about 4x4. I had trouble working with the image if it was smaller than 4X4 because the reduce and expand functions needed some padding/borders and so the padding could not be bigger than the image dimensions. So, after the Gaussian list of images was created, It went upwards in the struct and started with the last Gaussian image and expanded it and subtracted it from the Gaussian image above it to obtain the Laplacian image. This was iterated until the algorithm reached the original Gaussian image in the list. This function then sent back the structure which contained both the Gaussian and Laplacian pyramids. I had to send both to the make pyramid function. However, let me explain a little more about what I did......
I originally was only working with gray images to make the problem easier to begin with. I also tried splining down the middle and it worked quite fine. However, what stumped me was how to average the borders of curvy boundaries without having to pull out my dusty-old calc book. I obviously missed a vitle little paragraph in the paper which explained how to include the mask into the algorithm for variable shape splining. This was cool. And, it saved me a lot of work. What I did was take the two images and made a third mask image. I then sent all three images to the make pyramid function and obtained the pyramid for all three of them. Next, I had to put a small for loop to implement the averaging around the variable edges. It was a whole '1' line of code, but this is what killed processor time because it was going pixel by pixel. I ran the little one-liner on all the Laplacian images and created another Laplacian pyramid consisting of the combined images and the mask. I then expanded out the Pyramid at each level and added them to obtain the output image. For color images, I had to run the entire procedure explained above three times to cover the set of three images that make up the color image. I then copied all output images into a 2nX2mX3 array to come up with the color output image.
The waeknesses:
I assumed that all images would be the exact size and overlap. This makes
the user have to go through and do a lot of manual labor to make sure that
the area to be splined aligns exactly with the mask and the other image.
The other weakness is the statement I mentioned
above about this version assuming that the images are 2^nx2^n. In the driver
I have provided below, I didn't pad any of the images I used to fit the
2^NX2^M format because I was too lazy to type a whole 10 lines more of
code to find the largest image and pad it and the other images.
![]() |
![]() |
![]() |
| The Splined image | Original Irfan Image | Original Locutus Image |
![]() |
|
|
| The Mask used to create the Spline | The Gaussian Pyramid of one of the three array of images in the original color image | The Laplacian Pyramid of one of the three array of images in the original color image |
![]() |
![]() |
![]() |
| Hey. Always wanted to know what I'd look like in short hair. =) | That's me | That's someone off the web. |
![]() |
![]() |