Version 10 of Maple contains the *ImageTools* package that contains some basic image operations. In this example we will use Maple to construct an edge detector.
As an example, we will use the following image from the Florence, Tuscany post.
First we will need to include the ImageTools package.
with (ImageTools);

Now, using the *Read* command, we can read the image into Maple and represent it as a 3 dimensional array. The first dimension is the height, next dimension is the width, and the last dimension corresponds to the three color planes (red, green, and blue).
img := Read ("galileo.jpg");

We would like to perform the edge detection on the grayscale version of the image. Using the *ToGrayscale* command, the RGB color image is converted to grayscale image.
g_img := ToGrayscale (img);

We will extract the edges using two Sobel operator. One for the horizontal edge component and the other for the vertical edge component. The two operators are defined by the following two matrices:
Gx = Matrix ([[1,2,1], [0,0,0],[-1,-2,-1]])
Gy = Matrix ([[-1,0,1],[-2,0,2],[-1,0,1]])
Gx := Matrix ([[1,2,1], [0,0,0],[-1,-2,-1]]);
Gy := Matrix ([[-1,0,1],[-2,0,2],[-1,0,1]]);

To get the horizontal and vertical edge components, we use the *Convolution* command that performs 2 dimensional discrete convolution of the grayscale image with the two matrices.
img_x := Convolution (img_r, Gx);
img_y := Convolution (img_r, Gy);

To get the combined edge map, we take the absolute value of the horizontal and vertical components and add them together.
edge := Array (abs (img_x) + abs (img_y), datatype=float[8]);

The values in the edge map range from 0 to about 3.8, however the valid range for an image is from 0 to 1. We must rescale all the pixel values, such that the brightest pixel is 1.
To do this, first we must find the darkest and the brightest pxiel values, and the difference between them.
min_v, max_v := rtable_scanblock (edge, [rtable_dims (edge)], 'Minimum', 'Maximum');
delta_v := max_v - min_v;

Using these values we can remap the pixel intesities to fit between 0 and 1.
img_edge := Array ((edge-min_v)/delta_v, order=C_order, datatype=float[8]);

Finally, we use the *Write* command to write the image into a file.
Write ("edge.jpg", img_edge);

The final image looks like this, where the edges are highlighted in white.
The attached worksheet includes all the necessary commands.