You are on page 1of 4

A faster method for erosion and dilation of reservoir pore-complex images

J. R. PARKER
The University of Calgary, Department of Computer Science, Calgary, Alta., Canada T2N IN4
Received June 23, 1987
Revision accepted August 20, 1987

Studies of thin sections of reservoir rock have been conducted for some time with the goal of understanding flow behavior
and estimating physical properties. These sections are essentially two dimensional, but it has always been assumed that the
results obtained can be extrapolated to the third dimension. Computer image-processing techniques are often used in this sort
of analysis because of the large amounts of data contained in a single digitized section image. One of the methods used to
Can. J. Earth Sci. Downloaded from www.nrcresearchpress.com by Mount Royal University on 07/13/15

process these images is erosion-dilation, wherein layers of each pore are stripped off (erosion) and then replaced (dilation).
This results in a smoothing of the pore perimeters and can be used to estimate pore radii, volume, and roughness. Because of
the size of each image, erosion-dilation of images of the pore complex of reservoir rocks is a time-consuming process. A new
method called global erosion is much faster, with no increase in memory requirement or decrease in accuracy. This should
permit the processing of larger images or a greater number of small images than does the standard method.

Les ttudes de lames minces des roches rkservoirs ont kt6 pratiquCes depuis un certain temps avec l'ojectif de mieux
comprendre le comportement de 1'Ccoulement et d'kvaluer les propriCtCs physiques. L'observation est limitCe a deux
dimensions dans les lames minces, mais on a toujours prCsumC que les ksultats obtenus pouvaient Ctre extrapolCs dans la
troiskme dimension. Les techniques de traitement d'images par ordinateur sont frkquemrnent utilsCe dans ce type d'analyse a
cause du t&s grand nombre de donnCes que foumit une seule image numCrique d'une lame mince. Une des mCthodes utilisCes
pour traiter ces images est celle d'Crosion-dilatation, dans laquelle les couches de chaque pore sont enlevCes (Crosion) et
ensuite remplacCes (dilatation). I1 en rCsulte un adoucissement des pCrimktres des pores, et en plus le rayon, le volume et la
mgositC des pores peuvent Ctre CvaluCs. La technique de l'trosion et dilatation des images appliqute un complexe de pores de
roches kservoirs est un processus qui requiert beaucoup de temps a cause de la dimension de chacune des images. Une
nouvelle mkthode appelCe Crosion globale est beaucoup plus rapide sans toutefois exiger plus de mCmoire ou de pkcision. Elle
For personal use only.

devrait permettre le traitement de plus grandes images ou d'un plus grand nombre de petites images que le fait la mtthode
habituelle.
[Traduit par la revue]

Can. J. Eaah Sci. 25, 1128- 1131 (1988)

Introduction in the subtracted image and can then be counted.


Erosion -dilation is usually performed in cycles (Rosenfeld
Computer-assisted analysis of the pore complex of reservoir and Kak 1982). First, an image would have one layer of pixels
rocks is required because of the complexity of the images eroded and then would be dilated by one pixel. This removes
involved and the time-consuming nature of the same analysis one-pixel irregularities. Then the image would be eroded by
performed manually. A key technique for extracting relevant two layers and dilated by two pixels to remove two-pixel irreg-
data from pore-complex images is erosion-dilation (Ehrlich ularities. This process can be repeated until the erosion process
et al. 1984; Rink 1976). In this method layers of pixels are removes all pixels belonging to a given pore. At this point,
removed from the raster image representation of each pore dilation will have no effect, since at least one pixel must
(erosion). This has the general effect of smoothing out irregu- remain to provide a "seed" for the dilation process.
larities in the pore Layers of pixels are then added For large images, which include any practical image used for
back to the outer edges of the pores (dilation), restoring the analysis, this is a time-consuming process. Each erosion step
pores to an approximation of their original size and shape but requires that the entire image be examined; for an image of
without the surface irregularities. L 2
size N rows by N columns, the time needed is a function of
Erosion -dilation is related to another computer image-pro- 2NZ,assuming that erosion is perfomed in place and a second
cessing method known as the medial axis transform (Pratt copy is not used. Similarly, each dilation step requires on the
1978, pp. 519-520) which is used for skeletonizing objects order of 2NZtime. To erode two layers of pixels requires twice
for shape determination. It is also related to thinning (Pavlidis this amount of time, as does the corresponding dilation step. If
1982, pp. 199-208), a process that removes parts of the image all erosions and dilations from 1 to k pixels are needed, the
not needed for the communication of shape. Thinning in par- total time needed is a function of 2k(k - 1)N2.
ticular can be usefully applied to any image. It can be used in If sufficient computer memory space is available the time
the production and analysis of orthomaps and orthophotomaps needed for erosions can be shortened. The eroded image can be
and in computer processing of Landsat pictures. Erosion -dila- saved in a second image, and dilated, then the saved image can
tion is used directly to determine size and roughness param- be eroded by one more layer. If this is done, then the time
eters of the pores in the reservoir sample. Size can be found +
needed is a function of k(k 3)N2. For typical applications N
simply by counting the number of layers needed to erode the has a value of 5 12 or more; the time needed is therefore exces-
pore until it vanishes completely. Roughness is found by erod- sive for most microprocessor systems and for many larger
ing a pore and then dilating it and subtracting the resulting time-shared computers as well. However, it is possible to
image from the original. Depending on the number of layers reduce the time needed by a large factor without affecting the
removed and restored, irregularities of known sizes will remain quality of the results.
F'rinted in Canada 1 lmprimt au Canada
NOTES
Can. J. Earth Sci. Downloaded from www.nrcresearchpress.com by Mount Royal University on 07/13/15

FIG. 1. Sample results from standard erosion-dilation. (a) Portion of a pore-complex image. (b) Erosion of a by two pixels. (c)Erosion of a
by four pixels. (d) Dilation of b by two pixels. (e) Dilation of c by two pixels. (f) Dilation of c by four pixels.

Computing erosion and dilation belonging to a pore is replaced by a new value representing the
Figure l a shows a small portion of a pore-complex image to distance of that pixel from the boundary of the pore. Thus,
be eroded. Assume that all pixels in the image have a value of pixels on the pore boundary would be given a value of 1, since
0 or 255, where a 255 value represents a pixel that belongs to a they are one pixel away from the boundary. Pixels that are two
pore and a 0 value represents rock. For ease of viewing, pixel pixels away from the boundary would be given the value 2 ,
values of 255 have been represented as " 1 " in Figs. 1 , 2 b , and and so on. The result has the appearance of a contour map,
2c. The standard in-place erosion method can be described as where the contours represent the distance from the edge of
follows: the pore.
( 1 ) Scan the image for a pixel with the value of 255. The resulting image contains enough information to perform
For personal use only.

( 2 ) If one of the eight immediate neighbors of this pixel has a an erosion by any number of pixels in just one pass through the
value of 0, then mark this pixel. This is done by changing its image; in other words, all possible erosions have been encoded
value to, say, 128. into a single image. This globally eroded image can be pro-
(3) Continue from step 1 until all pixels have been examined. duced in just two passes through the original image. The
(4) Scan the image again, this time looking for any pixel that method is the following:
has been marked. ( 1 ) Starting at the upper left of the image, scan along succes-
(5) Change the value of this marked pixel to 0, thereby sive rows, from left to right, until a pixel with a value of 255 is
removing it. found. This becomes the current pixel.
(6) Repeat from step 4 until all marked pixels have been (2) Look at all eight possible neighbors of the current pixel,
set to 0. and let V be the minimum value found in these pixels.
Figures 16 and l c represent erosions of Fig. l a by two pixels (3) Set the value of the current pixel to V + 1.
and four pixels, respectively, using this method. The value of (4) Continue from step 1 until all the pixels have been
255 permits the erosion of regions smaller than 5 12 pixels by examined.
512 pixels and allows the pixel values to be stored in a single (5) Now starting at the lower right of the image, scan along
memory byte. The standard method used for computing in- successive rows from right to left moving up the image, look-
place dilations is similar, and with the same assumptions for ing for a pixel whose value is nonzero. This becomes the cur-
pixel values as before, can be described as follows: rent pixel.
( 1 ) Scan the image for a pixel with the value of 0. ( 6 ) Look at all eight neighbors of the current pixel, and let V
(2) If one of the eight immediate neighbors of this pixel has a be the minimum value found in these pixels.
value of 255, then mark this pixel. (7) If V has a value less than that of the current pixel, set the
( 3 ) Continue from step 1 until all pixels have been examined. value of the current pixel to V + 1.
( 4 ) Scan the image again, this time looking for any pixel that (8) Repeat from step 5 until all pixels have been examined.
has been marked. Steps 1 -4 represent the first phase of the global erosion, and
(5) Change the value of this marked pixel to 255, thereby steps 5 - 8 represent the second phase. After the first phase is
adding a new pixel. complete the pixel values represent the minimum distance,
( 6 ) Repeat from step 4 until all marked pixels have been set expressed as numbers of pixels, to the nearest upper, upper-
to 255. left, left, and upper-right boundaries. The second phase must
Figures Id and l e show the result of dilating Figs. l b and be performed by scanning in the opposite direction in order to
l c , respectively, by two pixels. Figure If shows the result of collect the distances in the other four directions in one pass.
dilating Fig. l c by four pixels. The desired effect of removing The resulting image has all possible erosions encoded with
small irregularities has been achieved at some expense of com- the pixel values. Figure 2a shows the result of globally eroding
puter time. the pore image of Fig. l a . It would normally not be necessary
to actually perform an erosion by removing pixels, since the
image will be immediately dilated again. If the actual eroded
A faster erosion- dilation method image is desired, a simple thresholding operation will do the
The fast erosion method is based on the construction of a dis- job. To remove k layers of pixels from a globally eroded
tance map of the pore image, where the value of each pixel image, simply set all the pixels that have a value of less than or
1130 CAN. J. EARTH SCI. VOL. 25, 1988

(a1 (b) (c
000000000000000000000000000m 00000000000000000000000000000000 00000000000000000000000000000000
00000000000000001000000000000000 00000000000000000000000000000000 00000000000000000000000000000000
00000000000OOO011100000000000000 00000000000000000000000000000000 00000000000000000000000000000000
00000000000000112110000OOOOO0000 00000000000000111110000000000000 00000000000000000000000000000000
00000000000001122211000000000000 00000000000001111111000000000000 00000000000000000000000000000000
0000000000011122322111000000OOOO 00000000000111111111110000000000 00000000000111111111110000000000
00000000011122233322211100000000 00000000011111111111111100000000 00000000011111111111111100000000
00000001112223334333222111000000 00000001111111111111111111000000 00000000011111111111111110000000
00000001222333444443332221000000 00000001111111111111111111000000 00000000011111111111111110000000
00000001233344455544433321000000 00000001111111111111111111000000 00000000011111111111111110000000
00000001234445556555444321000000 00000001111111111111111111000000 00000000011111111111111110000000
00000011233445566665544321000000 00000001111111111111111111000000 00000000011111111111111110000000
Can. J. Earth Sci. Downloaded from www.nrcresearchpress.com by Mount Royal University on 07/13/15

00000001223344556655443321110000 00000001111111111111111111000000 00000000011111111111111110000000


00000001122334455554433221110000 00000001111111111111111111000000 00000000011111111111111110000000
00000000112233445544332211000000 00000000111111111111111111000000 00000000011111111111111110000000
00000000011223344443322110000000 000000000111111111111111lOOOO000 00000000011111111111111110000000
0000000000112233333322110000000 00000000001111111111111100000000 00000000001111111111111100000000
0000000000011222332221lOOaOOO000 00000000000111111111111000000000 00000000000111111111111000000000
00000000000011122221110000000000 00000000000011111111110000000000 00000000000011111111110000000000
00000000000000112211000000000000 0000OOOOOOOO00111111000000000000 00000000000000000000000000000000
00000000000000011110000000000000 00000000000000000000000000000000 00000000000000000000000000000000
00000000000000001100000000000000 00000000000000000000000000000000 00000000000000000000000000000000
00000000000000000000000000000000 0000000000000000000000000OOO0000 00000000000000000000000000000000
FIG. 2. Results of global erosion-dilation. (a) Global erosion of Fig. la. (b) 2a dilated by two pixels. (c) 2a dilated by four pixels.
For personal use only.

FIG. 3. Test images used for execution timings. (a) Sample 1 . (b) Sample 2.

equal to k to 0 and set all other pixels to 255. and four pixels, respectively. Notice that there is no difference
The process of global dilation must be applied only to an between these dilated images and those of Figs. Id and If.
image that has been globally eroded. The result is an image If further dilations are needed, the original globally eroded
that has been eroded and then dilated by k pixels. The method image may be saved and dilated by a different number of
is the following: pixels, or the globally dilated image can be unmarked and
(1) Scan the image for a pixel with a value greater than 0 that redilated. Depending upon the method chosen for marking
is also unmarked. Let this pixel be the current pixel. pixels, the globally dilated image may need to be thresholded
(2) If the value of the current pixel is less than k + 1 , set the before it is displayed.
current pixel to zero; if the value of the current pixel is greater
+
than k 1, mark the current pixel. In either case, skip to step
Results
4. If the current pixel has a value equal to k + 1 , go to step 3.
(3) The current pixel must have a value of k + 1. Mark the All the computer programs for performing erosions and dila-
current pixel, and also mark all pixels with k pixels of the cur- tions were written in the C language on a VAX 111780 running
rent pixel. UNIX. Conversion to FORTRAN or another language would
(4) Repeat from step 1 until all pixels have been examined. provide no difficulty. The code for performing global erosions
The marked pixels in the image that results belong to the and dilations was actually a little shorter than the code for the
dilated pore; all other pixels are background. Figures 2b and 2c traditional method: 70 as opposed to 76 lines. Both methods
show the result of globally dilating the image of Fig. 2a by two can be coded and debugged in just a few hours.
NOTES 1131

Both methods were applied to the micropore images seen in to implement than is the standard technique but yields a signifi-
Fig. 3 , which are both of size 443 pixels by 440 pixels. A cant saving of computer time during execution. This should
modified version of the standard method in which eroded permit the processing of larger images than was previously
images are saved for later erosion steps was timed and is possible. This method will also allow the processing of a larger
referred to as the standard II method. All erosions and dilations number of images or the use of smaller computers.
from 1 to 12 pixels were requested. The computer time needed It turns out that any normally eroded image can be globally
for each method is given in the following table: dilated using a method very similar to the one described here.
The time performance is still not as good as for global ero-
CPU time (s) sion-dilation but is better than for standard 11.

Real time Acknowledgments


Can. J. Earth Sci. Downloaded from www.nrcresearchpress.com by Mount Royal University on 07/13/15

Method Image Erode Dilate Total (min)


The author wishes to express his appreciation to Dr. N. C.
Standard 3a 1242.10 730.76 1972.86 182.03 Wardlaw and to M. McKellar for providing sample micro-
3b 1067.61 709.77 1777.38 85.0 model images and for the original impetus to do this work.
Standard I1 3a 191.15 724.31 915.46 46.77 Thanks also to The University of Calgary Department of Com-
36 188.99 754.60 943.59 65.98 puter Science for providing VAX time (in large amounts).
Global 3a 120.24 102.69 222.93 29.02
36 90.40 95.04 185.44 17.60 EHRLICH,R., KENNEDY, S. K., CRABTREE, S. J., and CANNON, R. L.
1984. Petrographic image analysis of reservoir pore complexes.
The values for real time would depend on the load on the com- Journal of Sedimentaly Petrology, 54: 1365 - 1378.
PAVLIDIS,T. 1982. Algorithms for graphics and image processing.
puter at the time and are included only as a rough estimate. As Computer Science Press, Rockville, MD.
well, execution time of these algorithms will depend on the PRATT,W. K. 1978. Digital image processing. John Wiley & Sons,
number of black pixels. Since the image of Fig. 3a has more New York, NY.
black area than does Fig. 3b, it would take a little longer to RINK. M. 1976. A computerized quantitative image analysis pro-
process. cedure for investigating features and an adaptive image process.
Journal of Microscopy, 107: 267 -286.
For personal use only.

Conclusions ROSENFELD, A., and KAK,A. C. 1982. Digitial picture processing.


Vol. 2 . Academic Press, New York, NY.
The method of global erosion-dilation is no more difficult

You might also like