Instructions for using the program named ShapeExtractor02

Version 0.0.1 2012.02.13

Table of contents

Introduction

You may have discovered that your attempts to emboss bitmap images have been met with less than outstanding success. If so, you may want to try using this program to enhance your bitmap images for embossing prior to the application of your chosen embossing method.

This program is designed to make it easier for sighted teachers and others who assist blind people to enhance bitmap images for improved embossing. The program is not tied to any particular embossing method. It should work equally well with embossers with variable dot height, embossers without variable dot height, and other embossing methods such as the use of "swell paper".

Accessibility

Unfortunately, the program is not completely accessible for blind users because it requires the use of a mouse, a slider, and an onscreen display to adjust a threshold in the enhancement algorithm for best results on an image by image basis.

However, the graphical user interface was written using SWT and should be fully accessible. If you are blind, you should be able to run the program to produce and emboss output files using the default level for the threshold. While you won't be able to use the slider to optimize the threshold on an image by image basis, you may find that embossed versions based on the default threshold value are more useful than embossing the raw image for some images.

An image processing algorithm

The program applies a sophisticated image processing algorithm to the full-color bitmap image for the purpose of identifying and retaining the salient features of the image prior to discarding the color information and converting to black and white or black, gray, and white format.

Output file format

The enhanced output image is written into a jpg file. The name of the output file is the same as the name of the input file but with "-Enhanced" inserted in the file name.

The dimensions of the image in the output file are the same as or possibly smaller than the dimensions of the input image. After the image is enhanced, it is trimmed to eliminate any blank areas around the borders of the enhanced image. This can lead to smaller dimensions in the output image.

Semi-theoretical background

You may have discovered that it can be very difficult to produce good results when embossing full-color bitmap images. The reasons for the poor results  are fairly easy to understand. The solution to the problem is somewhat more difficult.

The reasons for the difficulty are twofold:

This program deals with the first reason: loss of color information.

Loss of color information

In many cases, a digital image consists of an array of colored pixels where any one pixel can take on more than 16 million colors. It is the combination of these widely varying colors in the array of pixels that imparts information to a sighted viewer.

An embossed output is often analogous to a digital image containing only two colors -- black and white. The situation is somewhat better with embossing methods that provide variable dot height. Those methods can represent black, white, and possibly three shades of gray. (Some might claim that a blind user of a variable dot height embosser can recognize more than three shades of gray.)

Map 16 million colors into black, white, and three shades of gray

In order to emboss a digital image and produce a meaningful tactile image, we must map 16 million colors into black, white, and possibly three shades of gray and cause those resulting two to five colors to convey the information content of the original image. That is a tall order.

Five sets of 3.2 million colors each

Assume, for example, that you were to divide the colors into five sets of about 3.2 million colors each. Then assume that in order to emboss a bitmap image, you were to

The results that you get will depend entirely on chance and the chances for success aren't very good. About twenty-percent of the pixels will be will be indistinguishable from their neighbors in the final version of the image even if those pixels were clearly distinguishable from their neighbors in the original image.

The billboard example

Assume, for example, that red and green are two of the colors that are assigned to black while blue, is assigned to white. Now assume that you emboss an image of a green rectangular billboard containing red letters in front of a blue sky. The result will be a black rectangle on a white background. The message being conveyed by the red letters will be completely lost because they also will be converted to black and will be indistinguishable from the billboard.

We need a better way to convert those 16 million colors to black, gray, and white. I will explain a better way in the next section.

One solution to the color loss problem

Let me begin by saying that there is no single best solution to the problem of color loss. Different solutions may provide better results for different images. The solution provided by this program is only one of several possible solutions.

Outlines

Coloring books used by small sighted children contain images consisting almost entirely of the outlines of objects. Once a student progresses beyond childhood coloring books and enrolls in an art class, she learns that there are very few outlines in nature. Consequently, there are usually very few outlines in digital images. However, you probably will want to return to outlines for the purpose of embossing shapes. Outlines are probably more easily recognized than broad areas of raised dots when exploring an image with the fingers.

This is illustrated in the following four images.

Figure 1. Full-color rendition.
Missing image

-

Figure 2. Five-level gray scale rendition.
Missing image

-

Figure 3. Enhanced image with 5-level gray scale.
Missing image

-

Figure 4. Enhanced image with black and white only.
Missing image
Horse images

Figure 1 shows a full-color image of a horse. Note the similarities of the colors in the image.

Figure 2 shows a five-level gray scale rendition of the same horse image. If you were to simply copy the original image to a 5-level embosser, this is probably close to what you would get where each different shade of gray  is represented by dots of a given height. Thus, you would end up with large areas of dots all at the same height with small differences in dot height between the areas in some cases.

Figure 3 shows a five-level rendition of an enhanced version of the original image. In this rendition, the salient features of the original image are outlined in black and the gray levels simply add accent to the image. This version would be suitable for printing on an embosser that supports variable dot height.

I believe that the outlines shown in Figure 3 would be much easier to interpret with the fingers than the large areas of constant dot height shown in Figure 2. I will admit, however, that never having developed the ability to see with my fingers, even Figure 3 would be nearly impossible for me to interpret blindfolded.

Figure 4 shows an enhanced black and white rendition that would be suitable for printing on an embosser that doesn't support variable dot height. Depending on the number of dots per inch that the embosser produces, this version should work well with such an embosser. I don't know what you would get if you were to print the rendition in Figure 2 on such an embosser, but I doubt that it would be very usable.

A written description is necessary

In all cases, a good written description of the embossed image would be needed to help the student interpret what she feels with her fingers.

Color differences are paramount

In general, the only thing that distinguishes one object from another in a full color digital image is the fact that the two objects are colored differently. (The horse's hair in Figure 1 is a different color than the wooden planks that were used to construct the stall.) As mentioned above, if the scheme for converting the color image to black, gray, and white depends on subdividing the colors into five groups, and simply mapping the colors into black, dark gray, gray, light gray, and white (as in Figure 2), much of the information will be lost in the transformation from color to black, gray, and white.

Camouflage

Animals and military combat troops use camouflage to avoid being seen by predators or by the enemy. The purpose of camouflage is to eliminate outlines and to prevent the recognition of common shapes.

For example, the colors of the feathers on a quail cause it to blend into its surroundings and eliminate or reduce its visual outline. The chameleon and certain undersea creatures can change their color to match that of their surroundings to eliminate or reduce their visual outline.

For purposes of embossing a digital image  we need a way to un-camouflage the objects in the image. In other words, we need a way to retain and even emphasize the shapes of objects in the process of converting from color to black, gray, and white.

Emphasizing outlines

The image processing algorithm used by this program is designed to emphasize outlines. The primary objective is to cause each object in an image to be described by a black outline against a white background. A secondary objective, if elected by the user, is to fill in the outlines with three shades of gray plus white.

Color changes

The distinguishing characteristic among objects in a full-color digital image is usually not the absolute colors themselves. Instead, the distinguishing characteristic is the change in color from one object to the next. For example, I can invert the colors in a color image so that every unique color is changed to a different unique color and a sighted person will probably still be able to distinguish among the different objects in the image.

Therefore, the primary characteristic of the algorithm used by this program is not based on the translation of absolute colors into black, gray, and white. Instead, it is based on detecting the changes in color and reflecting those changes in black, gray, and white.

An audio speed sensor

This is somewhat analogous to installing a buzzer in your car that sounds off when your rate of change of position (speed) exceeds a preset limit. The buzzer doesn't care about your absolute position, it cares only about the rate of change in position.

The algorithm used in this program doesn't care about absolute color, it cares only about the rate of change of color.

Getting back to outlines

The net effect of the algorithm is to convert the image back to the "coloring book" format of black outlines on a white background. This is a format that seems to work well for embossing images with a two-level embosser. The algorithm can also fill in the outlines with three levels of gray, if elected by the user, to add accent to the image when used with a multi-level embosser.

A mathematical description

For the mathematicians in the group, the enhancement algorithm simulates the computation of the first derivative of a five-dimensional surface (X, Y, red, green, and blue) and the creation of a three-dimensional surface where the height of the surface at a particular X-Y coordinate position represents the rate of change of color at that position in the original image.

A slider is used to manually apply a level detector to the surface, producing black pixels where the rate of change exceeds the threshold and producing white pixels where the rate of change is less than the threshold. Thus, peaks in the surface are represented as black islands in a sea of white.

Alternatively, if elected by the user, four separate  but related thresholds can be applied producing black, dark gray, gray, light gray, and white pixels in the output image.

Operating instructions

ShapeExtractor02 is a GUI application designed for use by sighted instructors and others who assist blind people. It is not designed to be fully accessible for unassisted use by the blind. (See earlier comments regarding use of the program with the default threshold value.) I will publish a different version of the program later that is designed for unassisted use by the blind. The user interface consists of labels, a checkbox, a sliding scale, a small display window, two buttons, and a large onscreen visual display.

GUI components

When the program starts running, focus is on a component that I refer to as home base. It reads "Start here and tab down." As you tab down, you will encounter the following components in order, which are labeled as shown. I will explain the purpose of each component in later sections of this document.

Check to display gray pixels

This checkbox is checked by default, meaning that the output file will contain gray pixels by default. If you don't want gray pixels in the output, clear the checkbox.

Select file

Press the button labeled "Select file." to open a bitmap image file for processing. When you press that button, a standard file selection dialog will appear allowing you to select a bitmap image file.

Allowable file types

The image processing portion of this program was written using a multimedia library provided by Georgia Tech University. I'm unsure as to all of the different image file types that it will support. I know that the program will support image files of types jpg, bmp, and png, so the program is written to allow you to easily select image files of those types. (The program will also allow you to select a file of any type, but a little extra effort is required.)

If you are interested in routinely processing image files of types other than those listed above, contact me by email and provide a sample image file. I will test the file, and if it can be supported, I will update the program to include image files of that type.

Processing begins

Processing begins when you select the file and close the dialog. At this point, you can begin moving the slider to adjust the image in the onscreen display.

Also, at this point, the value of the checkbox labeled "Check to display gray pixels" has been set. Clearing or setting that checkbox will have no effect until you select another file for processing.

Slide to adjust threshold

When you select an image file for processing, the program will begin running the image enhancement algorithm described earlier The slider on the scale will move to the center position with a value of 50 and a black and white version of the selected image will appear in an onscreen display. (If the checkbox is checked, a black, gray, and white version of the selected image will appear in the onscreen display.)

You use the slider to adjust a threshold value that is used by the enhancement algorithm to determine how much detail is included in the enhanced image. Detail decreases you move the slider to the left and increases as you move the slider to the right.

Only you can decide what works best for any particular image and embossing method, and you can use the slider to adjust the level of detail accordingly.

Depending on the speed of your computer, you may find that the slider is sluggish and difficult to move. Just be patient. One approach to moving the slider is to press the slider with the mouse and then move the mouse pointer to the location where you want the slider to go. As soon as the computer finishes the current task, an updated image will appear in the onscreen display and the slider will move to the location of the mouse pointer.

Another way to move the slider is to click the mouse in the track to the left or the right of the slider. This will cause the slider to move in very small increments. This is useful in the final stages of adjusting the threshold to cause the algorithm to produce the desired output.

Sliding scale value display

The sliding scale is calibrated from 0 on the left to 100 on the right. As you move the slider, you should see the current position of the slider reflected in a small read-only display immediately below the sliding scale.

Note, however, that depending on the speed of your computer, you may also find that updates to the display are somewhat sluggish.

Write output file

When you are satisfied with the image showing in the onscreen display, press the button labeled "Write output file. This will cause the output jpg file to be written into the same folder as the input file that you selected for processing earlier.

When the output jpg file has been written, you can use it to produce an embossed version of the enhanced image using the embossing method of your choice.

At that point, you can either select another file for processing, or exit the program.

As mentioned earlier, the name of the jpg file will be based on the name of the image file with "-Enhanced" inserted into the file name to distinguish it from the original image file

Exit the program

You can exit the program by selecting the X in the upper-right corner of the graphical user interface.

Dick Baldwin
baldwin@dickbaldwin.comp

-end-