Le Minh Trung
Asian Institute of Technology
School of Environment, Resources & Development (SERD)
Space Technology Application & Research Program (STAR)
P.O. Box 4 KhlongLuang, Pathumthani 12120, Thailand
Tel. (662) 524 5585 Fax. (662) 524 6147
Internet: http://www.rsl.ait.ac.th/Trung/
Email: trung@ait.ac.th
This paper introduces an image processing program executable on the World Wide Web. We call it briefly IPT applet. It may be used as a training tool for courses on image processing, during which students can understand some basic image processing techniques and see the effects of these operations. In addition to basic image processing techniques, it contains some morphological operations such as dilation and erosion. Written in Java programming language, it supports two image file formats (jpg and gif). In the future other formats may be added.
The current version of IPT applet contains the following transformations/operations:
Some filters can process only gray scale images, so if the original image is a color image, it is necessary to convert it to a gray scale image before further processing. In a gray scale image, each pixel has a value ranging from 0 (black) to 255 (white). The transformation is based on the equation (see [Russ95], pp. 39):
gray value = 0.299*r + 0.587*g + 0.114*b
where r, g, b are the red, green, blue values of a pixel in the color image.
The following images demonstrate the effect of this filter:
Fig. 1 Original image |
Fig. 2 Gray scale image |
|
This simply brightens the image, applying equation:
for red, green and blue values of each pixel.
This darkens the image, applying equation:
for red, green and blue values of each pixel.
These are the results of brighten and darken applied to the image in Fig. 2:
Fig. 4 Brighten |
Fig. 5 Darken |
Rotates the image 90 degrees clockwise each time this operation is performed.
Creates the mirror image.
These are examples showing the mirror image and rotated image:
Fig. 1 Original image |
Fig. 6 Mirror image |
Fig. 7 Image rotated 90 degrees |
Change the pixel value according to a given threshold value v. In the program, we use this method only for gray scale images, and any pixel having a value not less than v will be changed to white, otherwise to black. This technique is useful for segmentation to recognize and perform some calculation on a specific feature.
Below is an image of a National Park in the United States. After thresholding we can see individual trees, which enable us to count the number of trees (See section 12, Counting Separate Objects, in this part).
|
|
Fig. 8 Original image |
Fig. 9 Thresholded image |
This method performs the following steps (see [Gonzalez93 pp.173], [Sid-Ahmed95 pp.67-68]):
The following images demonstrate the effect of this filter:
Fig. 12 Original image |
Fig. 13 Result after applying histogram equalization |
Filters alter each pixel's color based on its current color and the colors of neighboring pixels. Median filter replaces each pixel with its median neighbor. If we sort all the neighbors of a pixel according to their gray scale values, the middle pixel is called the median neighbor. This technique is useful for noise removal, as we can see in Fig. 10 and Fig. 11 below.
Fig. 10 Original image with noise |
Fig. 11 Result after applying median filter |
In IPT applet, this filter can be applied to only black and white
images. Here we use the simplest kind of erosion (classical erosion), which
removes foreground pixels touching at least one background pixel. This
removes a layer from around the periphery of all regions. Repeating this
operation may lead to separation of touching features (which enables us
to count the features, for instance).
This operation can be accomplished by the following simple procedure: for
each foreground pixel (black), if it is on the boundary, remove it.
Below are two images demonstrating this operation:
|
|
Dilation, on the contrary, adds any background pixel that touches a foreground
pixel. This will add a layer around the periphery of each region. This
filter can also be applied to only black and white images.
The operation is accomplished by the following simple procedure: change each background pixel (white) touching at least one foreground pixel to black.
Below is a simple example of using dilation to fill gaps inside features.
Fig. 16 Original image |
Fig. 17 After one cycle of dilation |
The counting operation is performed with the region growing technique (see [Gonzalez93 pp. 458], [Russ95 pp. 399-402]). This can be accomplished by the following procedure:
A demonstration of this operation can be seen at http://www.rsl.ait.ac.th/~trung/TreeCount/
The Java Developer's Kit has packages for image processing, including the RGBImageFilter class and others. Point operations (i.e. processing a pixel depends only on its value, not on the values of neighbors) can be accomplished by using classes in the java.awt.image package.
However, many operations above are neighbor operations (median filter, erosion, dilation...), in which pixel processing depends on both its value and the values of its neighbors. In this case we still can use the classes mentioned above, but for higher speed we implemented our own classes.
To implement the region growing algorithm above, we used a queue data structure to keep the pixels under consideration, so the region scanning process can be easily accomplished. The algorithm for marking an area from a given pixel p in this area can be described as follows:
And finally, due to the security policy of browser vendors (Netscape, Microsoft...), users can process the images from only the server where the images are located, and the processed image can not be saved on the local machine. To process an image from the local machine, the user must upload it to the server (on specific directory) before running the IPT applet.
The following are requirements for Internet users:
The IPT applet is available at http://www.rsl.ait.ac.th/~trung/ImPro/
To process an image, perform the following steps:
Note: Before clicking the Proceed button,, users should know in advance whether the currently used filter (image processing method) can be applied for the type of currently loaded image (black & white, gray scale or color image). Otherwise, unexpected results may occur.
Java technology enables us to develop many interesting tools for the web, from simple things such as animation images, to more advanced image processing tools and others (for instance, expert systems) . This paper presents a simple image processing tool for education and training purposes. Further additions will be considered in the future to cover popular image processing techniques, available in other commercial image processing software.
We also intend to add an on-line explanation module into the applet, so that users can have a deep understanding about what is happening behind the underlying image processing transformation.
The IPT applet provides only global image processing techniques, i.e. every operation is applied to the whole image, not to a point or a specific smaller area. This restriction will be overcome in later versions of IPT applet.
References
This document validates as HTML 3.2