You are on page 1of 4

Shock Detection Using Mathematical Morphology

1 Introduction
The number of flows in which shocks are present is innumerable. Knowing the location and strength of
shocks is very important in determining several quantities, including the aerodynamic loading, maximum
velocity, minimum pressure, and separation point(s). Generally when looking at flows containing shocks
the location of the shocks is well known due to their fixed location, i.e. steadiness. However, there are many
flows in which the location of the shock(s) is not known and cannot be determined analytically. Examples
of these types of flows are fluidized beds (Gidaspow, 1994) and transonic flows over airfoils at low angles of
attack (Gibb, 1988) (Tijdeman and Seebass, 1980). In order to locate the shocks numerically, the mathematics
of morphology can be employed.
Developed in the 1960s by Georges Matheron and Jean Serra at the Ecole des Mines de Paris, France,
morphology is the theory and technique for the analysis of spatial structures (Soille, 2003). Morphology is
heavily based on set theory, integral geometry, and lattice algebra. Morphology was originally developed
to describe porous media, where the porous material can be described as a binary image containing pores
or solid surrounding material (Soille, 2003). While this method has primarily been used in the image processing community, it can be and has been used on a wide variety of spatial structures. This fact allows for
the theory and application of morphology to be extended to locating shocks in flows.

2 Operations
Morphology attempts to extract structures of interest located within the whole spatial domain, herein referred to as an image, by performing various set operations over so-called structuring elements. Structuring
elements are used to probe the image with various shapes that describe the structure of interest. Structuring
elements can take on any number of shapes, from simple rods (straight elements) to circles, or in extreme
cases,galaxy shapes. Structuring elements can also be applied in combinations to create larger structuring
elements of varying shapes. While there is not a limitation to what shapes or size the structuring elements
can take, these structuring elements must be aligned in the same direction throughout the image. Failure
to maintain the same alignment throughout will distort the structures that are sought after. Also inherent
to structuring elements is that they can only be applied to highly structured images. Images not in a highly
structured state must be transformed to this state, and then all of the morphological operations can be applied as usual. The structuring element, denoted as b, is a locally defined quantity in the local coordinates
(k, l). The values of (k, l) are defined depending on the total size of the structuring element. If (0, 0) is the
point of interest in local (k, l) coordinates, then for a five point vertical rod structuring element the global
coordinates would be (i , j 2l), (i , j l), (i , j), (i , j + l), and (i , j + 2l). b assumes the value of the image, f ,at
these coordinates.
While morphology can perform a wide variety of operations over the structuring elements, all of these
operations can be described by combinations of two elementary operations: erosion and dilation. Both of
these operations can be described as shifts in the data set. Erosion can be taken as the minimum of these
shifts of the image, f (i , j), over the structuring element, b(k, l), given as:
e( f ) = min( f (i + k, j + l) b(k, l)).

(1)

Dilation, on the other hand, can be taken as the maximum of these shifts over the same structuring element.
d( f ) = max( f (i k, j l) + b(k, l))

(2)

With (1) and (2), we can perform any number of operations.


1

3 Other Key Operations


There are other operations that are not inherently morphological in nature but required if we are to detect
shocks in flows. These operations are blurring, the blur/erosion operator, the dilation/blur operator, and
thresholding.
Blurring is used in image processing as a noise reduction technique. This operation is required for a
preliminary elimination of extreme values. Blurring is also required for locating step-type edges (Lee et al.,
1987). Without the blurring, the area around a step edge is not a local maximum or minimum, and the
erosion and dilation operations will not be able to extract shocks of that type (Lee et al., 1987). Blurring is
defined as:
blur( f ) =

ip+=Li L f (p)

L=

K1
.
2

(3)

Here, the blurring is defined over the reduced stencil size, K. While blurring is necessary, too much blurring is detrimental to edge detection. Over blurring of the image will overly distort the edges making it
impossible to discern them. A good reduced stencil size for blurring is K = 3 (Lee et al., 1987). This means
that, for example, when using a vertical rod structuring element and looking at the center point, the values used to blur the center point are, in global coordinates: (i , j k), (i , j), and (i , j + k). A consequence of
this stencil size for blurring is that the structuring elements must be at least two elements larger than the
blurring stencil in order to mitigate possible over distortion of the edges.
The blur/erosion (be) and dilation/blur (db) operators were proposed by (Lee et al., 1987). They use
the standard erosion and dilation operations in unison with blurring. These operators are applied after
initially blurring the image and then performing the erosion and dilation of the blurred image. The be and
db operators are defined as:
be( f ) = blur( f ) e(blur( f ))

(4)

db( f ) = d(blur( f )) blur( f ).

(5)

These operations act over the structuring elements and are used to eliminate obvious points where edges
are not located.
The last operation required to detect edges is thresholding. Thresholding is an image segmentation
technique used to isolate areas of interest in the image. For non-binary images (1s and 0s), thresholding is
almost always required to completely extract the desired information from the image. This in large part due
to the over emphasis of the previous operations of edges in grayscale images. Since grayscale images can
take on a wide variety of values, the operations tend to assign more than two points to an edge, where the
edge is defined as being only two points in width. By thresholding, we are able to satisfy this requirement
in edge size. Thresholding can be applied globally or semi-globally, where globally is a binary fix to the
image and semi-globally maintains the original value of the edge. We use global thresholding, defined
as (Ritter and Wilson, 2000):
thres( f ) = 1

if f

thres( f ) = 0

otherwise.

(6)

The constants and are user defined values specific for the image, or set of images if the group of images
describe the same general phenomenon. These values are determined by trial and error.

4 Algorithm
All of the previously described operations, when combined, allow for the detection of edges in images with
two-point edge strength. The algorithm for edge detection, described by (Lee et al., 1987), is repeated here.
2

1. Read in the image (single or multiple) from which the edges are desired to be extracted.
2. Create the structuring elements (boundary conditions). For our purposes, we use four rod-type structuring elements that are five units in length and have the following orientations: horizontal, vertical,
and diagonal (45 and 135 degrees with respect to the horizontal).
3. Blur the image as defined by (3), with the reduced stencil size, K, equal to 3, over the structuring
elements.
4. Compute the erosion and the dilation of the newly blurred image using (1) and (2).
5. Compute values of the blur/erosion and dilation/blur operators as defined by (4) and (5).
6. For each of the structuring elements, determine the maximum values of the be and db operators, given
below as:
max(bei( f ))

I = 1, ..., 4

(7)

max(dbi( f ))

I = 1, ..., 4.

(8)

Here I represents each of the four structuring elements.


7. With the maximum of the be and db operators determined, the edge strength can be determined from:
Indicator( f ) = min(max(db( f )), max(be( f )))

(9)

8. To obtain two-point edge strength, apply the global threshold as defined by (6) to the edge indicated
image. For our case, and were determined to be .1 and .2, respectively.

Figure 1: Results of the application of the shock detection algorithm to a bubbling fluidized bed. (a) is the
bubbling fluidized beds void fraction e pg at t = 1.0s. (b) is the edge indicator of (a) after thresholding.

5 Results
The edge, or shock, detection algorithm was applied to a bubbling fluidized bed, as described by Gidaspow (Gidaspow, 1994). Bubbling occurs once the velocity in the bed reaches a critical value. For the
3

test case, the velocity of the central jet was 355 cm/s. Bubbles are inherently unpredicatable when it comes
to locating them inside the bed, which makes them a prime candidate for this algorithm. The results of the
application of the algorithm are given in Figure 1. As indicated by Figure 1, all of the high energy bubbles
are easily extracted. Lower energy bubbles are not represented because of the lower gradients that define
them.

6 Conclusion
Mathematical morphology has the remarkable ability to extract key features from any image by the use of
simple set operations. As shown, the algorithm presented herein based on morphological principles, has
the ability to detect and isolate shocks in flows with two-point accuracy. The beauty of this method is that
it is not limited at all by what the image is or describes, so long as the data can be arranged in a structured
(pixelated) manner, the location of shocks can be determined.

References
Gibb, J. (1988, August-September). The cause and cure of periodic flows at transonic speeds. In Proceedings
16th Congress of ICAS, Jerusalem, Israel, pp. 122130.
Gidaspow, D. (1994). Multiphase Flow and Fluidization, Continuum and Kinetic Theory Descriptions, Chapter 7,
pp. 156159. San Diego, California: Academic Press.
Lee, J. S. J., R. Haralick, and L. Shapiro (1987, April). Morphological edge detection. IEEE J. of Robotics and
Automation RA-3(2), 142156.
Ritter, G. and J. Wilson (2000). Computer Vision Algorithms in Image Algebra (2nd ed.)., Chapter 4, pp. 137138.
CRC Press.
Soille, P. (2003). Morphological Image Analysis: Principles and Applications (2nd ed.). Springer-Verlag.
Tijdeman, D. and R. Seebass (1980). Transonic flow past oscillating airfoils. Ann. Rev. Fluid Mech. 12, 181
222.

You might also like