This is part 3 of the 3 part blog posts documenting the features of our first project.
Part 1 can be found here.
Part 2 can be found here.
Section 3.4: Basic Convolution and Edge Detection
Section 3.5: Antialiased Scale and Shift
2. Shift;
Usage: image -shift < sx sy >
Simply shifts the image with the sx and sy values. Here are some examples of shifting the image past the boundaries. A black background was applied to better showcase the shift.
Section 3.6: Fun Filter
For our filter, we decided to implement a brightness highlight filter. This filter essentially highlights regions in the image that cross a specified threshold in brightness, which gives a bloom effect of sorts. The end result gives an image that not only is bloomed, but also has a somewhat cartoony feel (if one were to apply a low enough threshold and do so multiple times). The bottom image of Shibuya square in Japan at night shows how the filter can be used to bloom the light sources, without noticeably blurring the buildings.
The exact process is as follows:
Part 1 can be found here.
Part 2 can be found here.
Section 3.4: Basic Convolution and Edge Detection
1. Blurring
Usage: image -blur < n >
This operation simply blurs the image with a filter of width nbits. Higher values of nbits leads to more blurring.
2. Sharpen
Usage: image -sharpen
Sharpen operation produces the reverse effect of blurring, except it cannot produce information that doesn't exist. It brings out the higher frequencies in an image to make it appear sharper. The filter used to produce these images was
{-1 -3 -1
-3 23 -3
-1 -3 -1 }
{-1 -3 -1
-3 23 -3
-1 -3 -1 }
3. Edge Detect
image -edgeDetect < threshold >
This operation detects the edges within an image, so that we can focus on a cutout selection of the image and blacken the rest of it. Based on the threshold, we can be more strict or less strict with this selection.
Unfortunately, due to an unknown error, we are not able to detect edges, however the program does shade in regions that are contained by edges.
Unfortunately, due to an unknown error, we are not able to detect edges, however the program does shade in regions that are contained by edges.
Section 3.5: Antialiased Scale and Shift
0. A note about our algorithm
In our algorithms, we did things a little bit differently than the reference solution:
1. Scale
In our algorithms, we did things a little bit differently than the reference solution:
- For nearest neighbor, we went to the actual nearest neighbor. An example in 1 dimension: in the solution image, coordinate 123.1 gets rounded to 124, whereas in our solution, this gets rounded down to 123. A coordinate of 123.6 will get rounded up to 124 in both solutions
- For the hat and mitchell operators, due to the guarantee of extracting the decimal part of a floating point number, call it x, that the extracted number is between 0 (inclusive) and 1 (exclusive), fewer checks need to be made about what range the absolute value of this x lies in. For example, x + 1 is always guaranteed to be between 1 and 2, so the second piecewise function for the Mitchell filter can be used.
- Coordinates that exceed the edges get mirrored back to ensure that the pixel we extract is valid.
1. Scale
Usage: image -size < sizex sizey >
This scales an image up to a larger size or a smaller size. When scaling to a larger size, we have to interpolate with pixels to produce information to fill in the gaps when scaling up. When scaling to a smaller size, we apply a reconstruction filter to each pixel.
Here is an image, originally sized at 242x242 pixels. This has been scaled up to 400x400 and scaled down to 70x70.2. Shift;
Usage: image -shift < sx sy >
Simply shifts the image with the sx and sy values. Here are some examples of shifting the image past the boundaries. A black background was applied to better showcase the shift.
For our filter, we decided to implement a brightness highlight filter. This filter essentially highlights regions in the image that cross a specified threshold in brightness, which gives a bloom effect of sorts. The end result gives an image that not only is bloomed, but also has a somewhat cartoony feel (if one were to apply a low enough threshold and do so multiple times). The bottom image of Shibuya square in Japan at night shows how the filter can be used to bloom the light sources, without noticeably blurring the buildings.
The exact process is as follows:
- Determine all regions that exceed the threshold brightness
- Apply a blur effect to these regions
- Determine how much light bled out to the sides
- Add the light bleed to the original image
Usage: image -fun threshold
Here are some comparison images of the filter in action:
No comments:
Post a Comment