ImageTools in Maple
Go to Maple Portal Maple Portal for Engineers
The ImageTools package in Maple contains a large number of image processing functions. Before using the commands found within the ImageTools package, load the package into the workspace using the with command.
| (1) |
This document below uses a sample image to illustrate how the commands in the ImageTools
package work.
|
Extract Input Image
|
|
The image in Figure 1, which is located in Maple's data directory, is imported into the worksheet by using the Read command.
Figure 1: Tree image
| (1.1) |
| (1.2) |
Note: Since backslashes are special characters, backslashes used in filenames must be escaped by "doubling up," that is, using two backslashes as was done in defining FileLocation. Alternatively, use the form C://Program Files/Maple 13/data/images/tree.jpg. See backslash and file for more information about backslashes and file names.
Use the View command to view the image stored in . The image is displayed in a Maplet dialog.
The image can be converted into a grayscale image with the ToGreyscale command.
Figure 2: Grayscale tree image
|
|
Histogram Manipulation
|
|
View histograms of the colored and grayscale images using the PlotHistogram command.
Next we will manipulate the pixel intensities. For this illustration, we will manipulate the grayscale image. Adjust the histogram of the grayscale image by applying the function to all the pixels in the image. Since this operation will cause the pixel intensities to no longer fit between 0 and 1, the pixel intensities are then rescaled using the FitIntensity command.
| (2.1) |
In a similar manner, we can intensify the grayscale image by applying an exponential operator.
| (2.2) |
View the images to see the effects of adjusting the histogram.
Histogram Manipulations
|
Original Image
|
Decreased Intensity Image
|
|
|
Increase Intensity Image
|
|
|
|
|
|
You can plot the histograms of the original and modified images. The histogram can be normalized using the normalized option to the PlotHistogram command.. See PlotHistogram for information on normalized and other options.
Use plots[display] to display multiple plots on the same axes.
|
|
Smoothing & Edge Detection
|
|
An edge detector can be constructed by applying a convolution mask to the image.
The Robert's Cross is a typical edge mask that can be used to extract the horizontal and vertical edges of an image. The Robert's Cross mask is defined below.
Use the Convolution command to obtain the horizontal and vertical edge operators for the image defined in .
Detect the horizontal and vertical edges of the image.
View the results of the edge detection.
Horizontal and Vertical Edge Detection
|
Original Image
|
Horizontal & Vertical Edge Detection
|
|
|
Horizontal Edge Detection
|
Vertical Edge Detection
|
|
|
|
|
Using the Threshold command we can extract the edges that were detected.
The results of the extraction are shown in the plots below.
Horizontal and Vertical Edge Extraction
|
Original Image
|
Horizontal & Vertical Edge Extraction
|
|
|
Horizontal Edge Extraction
|
Vertical Edge Extraction
|
|
|
|
|
Another useful feature found in the ImageTools package is the ability to take the color complement of an image using the Complement command. For instance, the complement of the image defined in can be seen in the plots below.
Complement
|
Edge Extracted Image
|
Complement of Edge Extracted Image
|
|
|
|
|
|
Go to Maple Portal Maple Portal for Engineers
|
Download Help Document
Was this information helpful?