CS 559 - Project 1 - Honors
by Mark Lenz
Overview
My honors task for this project was to correctly implement several different
image resampling filters and then determine their optimal radius. I have provided a breif analysis
of each filter with examples of images that are downscaled and upscaled
using each filter with a radius that is optimal, too small and too large.
The filters that I have implemented are the Dirac Delta, box, tent, B-spline, Gaussian
and Lanczos.
The original image that I used for all of the examples is the chessboard image from Yoh Suzuki.
I chose this image in particular because it has both some curves and some sharp lines. Also,
the letters, numbers and checkerboard squares were helpful in determining the optimal radius of
each filter. It was easy to see in most cases, especially around the edges of the squares
whether or not the filter was large enough to optimally reduce aliasing and small enough
not to cause excessive blurring.
Original Chessboard Image
|
The original chessboard test image provided by Yoh. |
Filters
Dirac Delta
The Dirac Delta filter is different from all the other filters in that the integral
anywhere equals 1. Therefore, it is really only point sampling, and so, even with an
optimal radius, results from downscaling or upscaling with this filter are quite "blocky".
Dirac Delta Optimal Radius
Scale |
Radius |
1/4 |
2.5 |
1/2 |
1.5 |
3/4 |
1.1667 |
5/4 |
0.9 |
3/2 |
0.833333 |
7/4 |
0.78571 |
2 |
0.75 |
Dirac Delta Downsampling
|
|
|
Too small. Scale = 3/4. Radius = 1.1666. |
Optimal. Scale = 3/4. Radius = 1.1667. |
Too big. Scale = 3/4. Radius = 1.5. |
|
|
|
Magnified. Here you can see how the symmetry of the original image is lost, and its missing some transitions between squares. |
Magnified. Correct symmetry, some aliasing. |
Magnified. Here the symmetry is gone again and there is additional aliasing. |
Dirac Delta Upsampling
|
|
|
Too small. Scale = 3/2. Radius = 0.83332. |
Optimal. Scale = 3/2. Radius = 0.833333. |
Too big. Scale = 3/2. Radius = 0.83334. |
|
|
|
Magnified. You can see that one of the vertical edges between the squares does not match the others. |
Magnified. All of the edges between the squares match. |
Magnified. This vertical edge between the squares is thicker than the horizontal edge. |
Box
The box filter represents the simplest approximation to the optimal filter.
The box filter is theoretically optimal with a radius of 0.5, but that does not
turn out to be the best radius in practice. The optimal radius for the box
filter follows the same distribution of the Dirac Delta filter. It seems that the box filter doesn't
handle resampling much better than the delta filter and it results in a lot of
aliasing.
A box filter with radius of 0.5 results in nearest-neighbor interpolation.
Box Filter Optimal Radius
Scale |
Radius |
1/4 |
2.5 |
1/2 |
1.5 |
3/4 |
1.1667 |
5/4 |
0.9 |
3/2 |
0.833333 |
7/4 |
0.78571 |
2 |
0.75 |
Box Filter Downsampling
|
|
|
Too small. Scale = 3/4. Radius = 1.1666. |
Optimal. Scale = 3/4. Radius = 1.1667. |
Too big. Scale = 3/4. Radius = 1.5. |
|
|
|
Magnified. Here you can see how the symmetry of the original image is lost, and it's not fully interpolating. |
Magnified. Correct symmetry and interpolation with some aliasing. |
Magnified. The symmetry of the image seems to look correct, but there is excessive aliasing. |
Box Filter Upsampling
|
|
|
Too small. Scale = 3/2. Radius = 0.83332. |
Optimal. Scale = 3/2. Radius = 0.833333. |
Too big. Scale = 3/2. Radius = 0.83334. |
|
|
|
Magnified. You can see that one of the vertical edges between the squares is not interpolated. |
Magnified. All of the edges between the squares are interpolated. |
Magnified. This vertical edge between the squares is thicker than the horizontal edge. Notice the excessive aliasing. |
Tent
The optimal radius of the tent filter, and the b-spline, were the easiest to figure out.
Whenever upsampling, a radius of 1 is optimal. When downsampling the optimal
radius is equal to 1 divided by the average of the scales in each direction.
A tent filter with radius of 1 results in standard bi-linear interpolation.
Tent Filter Optimal Radius
Scale |
Radius |
1/4 |
4 |
1/2 |
2 |
3/4 |
1.3 |
5/4 |
1 |
3/2 |
1 |
7/4 |
1 |
2 |
1 |
Tent Filter Downsampling
|
|
|
Too small. Scale = 3/4. Radius = 1.2. |
Optimal. Scale = 3/4. Radius = 1.3. |
Too big. Scale = 3/4. Radius = 1.5. |
|
|
|
Magnified. No interpolation between the board and the white background. |
Magnified. Full interpolation. |
Magnified. Additional aliasing, this is hard to see. |
Tent Filter Upsampling
|
|
|
Too small. Scale = 3/2. Radius = 0.8. |
Optimal. Scale = 3/2. Radius = 1. |
Too big. Scale = 3/2. Radius = 1.2. |
|
|
|
Magnified. The vertical edge between the squares and the edge between the board and background are not interpolated. |
Magnified. All of the edges are being interpolated. |
Magnified. Additional aliasing, again, not excessive. |
B-Spline
The B-Spline filter is the convolution of the box filter with itself 4 times.
It has continuity through the second derivative, making it more smooth than than the tent
filter.
The optimal radius for a B-spline happens to follow the same formula as
the tent filter.
B-Spline Filter Optimal Radius
Scale |
Radius |
1/4 |
4 |
1/2 |
2 |
3/4 |
1.3 |
5/4 |
1 |
3/2 |
1 |
7/4 |
1 |
2 |
1 |
B-Spline Filter Downsampling
|
|
|
Too small. Scale = 3/4. Radius = 1.1. |
Optimal. Scale = 3/4. Radius = 1.3. |
Too big. Scale = 3/4. Radius = 1.5. |
|
|
|
Magnified. No interpolation between the board and the background plus one of the vertical edges between the squares. |
Magnified. Interpolation between all of the edges. |
Magnified. Additional aliasing. |
B-Spline Filter Upsampling
|
|
|
Too small. Scale = 3/2. Radius = 0.8. |
Optimal. Scale = 3/2. Radius = 1. |
Too big. Scale = 3/2. Radius = 1.2. |
|
|
|
Magnified. The vertical edge between the squares and the edge between the board and background are not being interpolated. |
Magnified. Interpolation between all of the edges. |
Magnified. Additional aliasing. |
Gaussian
The Gaussian filter is a close approximation to the optimal filter, but it
can produce somewhat blurry results. Upsampling with the filter generally produces
smoother images than with the b-spline, sometimes again with a little more aliasing.
The optimal radius for the Gaussian filter follows the same distribution as
the delta and box filter.
Gaussian Filter Optimal Radius
Scale |
Radius |
1/4 |
2.5 |
1/2 |
1.5 |
3/4 |
1.1667 |
5/4 |
0.9 |
3/2 |
0.833333 |
7/4 |
0.78571 |
2 |
0.75 |
Gaussian Filter Downsampling
|
|
|
Too small. Scale = 3/4. Radius = 1.166. |
Optimal. Scale = 3/4. Radius = 1.1667. |
Too big. Scale = 3/4. Radius = 1.5. |
|
|
|
Magnified. The edge between the board and the background is not being interpolated. |
Magnified. All of the edges are interpolated. |
Magnified. Additional aliasing. |
Gaussian Filter Upsampling
|
|
|
Too small. Scale = 3/2. Radius = 0.83332. |
Optimal. Scale = 3/2. Radius = 0.833333. |
Too big. Scale = 3/2. Radius = 0.83334. |
|
|
|
Magnified. The vertical edge is not being interpolated. |
Magnified. All of the edges are being interpolated. |
Magnified. Additional aliasing, the vertical edge is thicker than it should be. |
Lanczos
The Lanczos filter is the most unique of the filters that I implemented. It seems to
produce very smooth results with little aliasing. A smaller than optimal radius results
in an image very close to an image produced by the optimal radius. A larger than optimal
radius doesn't produce much additional aliasing like the other filters until it is much larger than the optimal.
Instead, with the checkboard image, it produced black or white "splats" as aliasing. Also, the optimal
radius did not follow any of the other filters.
The optimal radius for the Lanczos filter was the hardest to determine. I am not
sure if there is a closed formula for the optimal radius based on the scale factor.
Lanczos Filter Optimal Radius
Scale |
Radius |
1/4 |
1.52338 |
1/2 |
1.515468 |
3/4 |
1.188732 |
5/4 |
1.131861 |
3/2 |
1.188732 |
7/4 |
1.113 |
2 |
1.267990 |
Lanczos Filter Downsampling
|
|
|
Too small. Scale = 3/4. Radius = 0.6. |
Optimal. Scale = 3/4. Radius = 1.188732. |
Too big. Scale = 3/4. Radius = 1.2. |
|
|
|
Magnified. If you look real close you can tell that the horizontal edge between the squares is not being interpolated. |
Magnified. If you look closely you can tell that the horizontal edge between the squares is interpolated. |
Magnified. Aliasing as white "splats". |
Lanczos Filter Upsampling
|
|
|
Too small. Scale = 3/2. Radius = 0.6. |
Optimal. Scale = 3/2. Radius = 1.188732. |
Too big. Scale = 3/2. Radius = 1.2. |
|
|
|
Magnified. If you look closely you can tell that the edge between the board and background is not being interpolated. |
Magnified. The edge between the board and background is interpolated. |
Magnified. Aliasing as white "splats". |
Conclusion
I found that the many of the filters have the same optimal radius. The Dirac Delta, box and Gaussian filters all have the same optimal radius, and the tent and B-Spline filters
have the same optimal radius. The only "odd" one of the filters that I implemented was the Lanczos filter.