OOF: Finite Element Analysis of Microstructures
Modify Image Dashboard
Synopsis
There are many commercial and public domain software tools for modifying an image. We constantly found ourselves modifying images outside of ppm2oof and then importing them to make the mashing and material selection more efficient. For this reason, we decided to incorporate a small subset of the functionality of the many image modification tools into ppm2oof.
One advantage of including an image modification suite with ppm2oof is that images can be stacked with the Image Gallery dashboard. The groups of pixels that are selected by a Burn or Demography command are referenced by their position only, so selecting a pixel in one image also selects the pixel at the same position in all other images. Therefore, for example, it may be useful to use an edge detection image modification, load the resulting image into the image gallery and then make pixel groups or materials identification based on that image, and use a maximum contrast image manipulation method for other pixel groupings.
Clicking on the large buttons on the left edge of the dashboard performs the image modifications. The smaller buttons next to them bring up Function Windows that allow you to set the parameters used by the modifcation operations. To set parameters, you need to enter their values in the Function Window and press the large button at the top of the window. Setting parameters does not perform the modification--you still have to click on the lefthand button in the dashboard to actually do anything useful.
The image modification tools are illustrated here by applying them to the test image shown in Figure 3.8. . Note that the image is noisy and has a smooth featureless background gradient beneath some sharp features (the letters "OOF" in the lower right corner) and some slightly blurry features (the antialiased letters "OOF" in the upper left corner). The images are displayed here larger than life, to make it easier to see the effects.

The test image Figure 3.8. after 5 iterations of the smooth algorithm with dt=0.1. The sharp edges have been blurred.

The test image Figure 3.8. after 15 iterations of the nonlinear smoothing algorithm with dt=0.1 and alpha=1. The noise reduction is comparable to that achieved with the linear smoothing algorithm, but the sharp borders have been preserved.

The result of applying the laplacian stencil to the test image Figure 3.8. . The smooth gradient has been eliminated (among other features...)

The result of applying the blur stencil to the test image Figure 3.8. .

The result of applying the smooth stencil to the test image Figure 3.8. .

The result of applying the sharpen stencil to the test image Figure 3.8. . Note that the edges of the antialiased letters in the upper left are more distinct, and the edges of the sharp letters in the lower right have acquired a halo. The background noise has increased as well.

The result of applying the edge_find stencil to the test image Figure 3.8. . The distinct edges have become white.

The result of applying the edge_enhance_1 stencil to the test image Figure 3.8. . Edges (and noise) have become sharper, but the background gradient hasn't been lost as it has in Figure 3.15. .

The result of applying the edge_enhance_2 stencil to the test image Figure 3.8. . Noise has been enhanced less than in Figure 3.16.

The result of applying the equalize tool to the test image Figure 3.8. . The window widths were set to 10. The upper left corner is too dark and the lower right corner is too light as a result of the way the algorithm handles the edges of the image.
Dashboard Components
- Gray
-
Convert current image to gray scale. The map is from
- Max Contrast
-
Ensure that entire range of brightness is represented in the image. All RGB components of all colors are scaled and shifted so that the minimum component is 0 and the maximum is 255. All color components of all pixels are scaled and shifted by the same amount.
- Smooth
-
Smooth (blur) the image by treating each color component c as a diffusing field on a square lattice, and solve the diffusion equation,
The parameters are:
- Nonlinear Smooth
-
The diffusion equation used by Smooth will, if iterated repeatedly, completely obliterate all features of the image. At the suggestion of Allen Tannenbaum of the University of Minnesota, we have implemented a non-linear smoothing algorithm, in which the color components diffuse faster perpendicular to color gradients:
∂ c/∂ t = [( cxx cy2 - 2 cx cy cxy + cx2 cyy)/ (1 +
(cx2 + cy2)) ]^{⅓}.
The Parameters... button allows you to set the following parameters:
- Stencil
-
Replace each RGB component of each pixel by computing the value of a stencil applied to the pixel and its neighbors. A stencil (as used here) is a 3x3 array of numerical weights, or mask. The central weight multiplies the pixel's color component, and the eight weights surrounding it multiply the pixel's neighbors in the corresponding directions. The products are totaled, and the pixel is replaced by the result. In other words, if c_ij is a color component (red, green, or blue) of the pixel at (i,j), then
The Parameters... button lets you set the stencil weights and the number of iterations:
- mask
-
Defines the weight matrix. The choices are:
- laplacian
-
Replaces each color component with the local value of the discrete laplacian of that component. Changes linear gradients in color to black, for example, as shown in Figure 3.11. .
- blur
-
Replaces every pixel with the average of its neighbors. Because the central pixel is not included, the effect is something like looking at the image with your eyes crossed.
- smooth
-
Just like blur, but less so. The neighbors don't get 100% of the vote. See Figure 3.13.
- sharpen
-
Increases contrast at edges. Unstable if repeated too much. See Figure 3.14.
- edge_find
-
Increases contrast at edges, while making uniformly colored regions dark. See Figure 3.15.
- edge_enhance_1
-
This works more or less like sharpen. See Figure 3.16.
- edge_enhance_2
-
A slight variation on edge_enhance_1. See Figure 3.17.
- iterations
-
How many times should the operation be performed? Default: 1
- Equalize
-
This operation attempts to equalize the illumination of an image by making the average brightness in each small window the same as the average brightness B of the whole image. An example is shown in Figure 3.18. . To be precise, for each pixel (i,j), the algorithm computes the local average brightness bij} of a window centered on the pixel, and then scales the pixel's color components by the ratio B/bij. The window contains all pixels (x,y) such that i-xrange ≤ x ≤ i+xrange and j-yrange ≤ y ≤ j+yrange.
The parameters are:
- Undo
- Undo All
- Redo