Exercise P6: Converting Grayscale Images to Bitonal Images

In this exercise you convert a grayscale image to bitonal (black and white) images and clean up the converted image:

By converting the grayscale image to a bitonal (black and white) image, inverting the image, and removing speckles, you make the soil boundaries in the image easier to identify. The resulting map can be readily converted to vector using the AutoCAD Raster Design toolset Vectorization Tools.

In this lesson, you also export the modified image with a world correlation file.

Related Exercises

Before doing this exercise, ensure that AutoCAD Raster Design toolset options are set as described in the exercise Exercise A1: Setting AutoCAD Raster Design Toolset Options.

Exercise

  1. In the \Tutorial5 folder, open the drawing file Map_06.dwg. In the next few steps, you will change the background color of the Model space to black.
  2. At the Command line, enter the OPTIONS command to open the Options dialog box.
  3. Click the Display tab.
  4. Click the Colors button. The Drawing Window Colors dialog box opens.
  5. In the Interface Element list, select Uniform Background.
  6. In the Color list, select Black.
  7. Click Apply & Close in the Drawing Window Colors dialog box, then click OK in the Options dialog box.

    Convert the grayscale image to bitonal

  8. Click Raster menu Image ProcessingHistogram. Press Enter to edit the entire image. The Histogram dialog box is displayed.

    On the Threshold tab, use the slider to determine which pixels will be black and which will be white after you convert the image. The shades of gray to the left of the slider become black, and those to the right become white.

  9. Move the slider to 82, observing the effect on the image in the preview window.

    This exercise uses one image. However, if you select multiple images, you can select the image name below the preview to observe the effect of the threshold value on that image. The selected images convert to black and white when you click Apply and Close.

  10. Click Apply and Close to convert the image.

    The following example shows how the image of the soils map should appear after you convert it to a bitonal (black and white) image. The image has a light background and dark line work that is difficult to read. The image also contains large speckles.

    Export the image

  11. Click Raster menu ExportImage.
  12. In the Export dialog box, enter Soilsmap_world_03.cal for the filename, select CALS1 for the file type, and click Export.
  13. In the Export Options dialog box, select Maintain Drawing Link to Image and under Correlation, select World File.
  14. Click Finish.

    Invert the image

  15. Click Raster menu CleanupInvert.

    The following example shows how the image of the soils map should appear after you invert the light and dark areas of the image. The image still contains many large speckles.

    Remove speckles from the image

  16. Under Insert Options, select the Insertion Dialog option. Also make sure that Show Frames Only and Zoom To Image(s) boxes are cleared.
  17. Click Open to display the Image Correlation dialog box. Select the Source tab.

    You are prompted to continue or to respecify the pixel size.

  18. Click the Insertion tab and click OK.

    The pixels about to be removed are highlighted. In a real project, this is when you can zoom in to inspect the image and ensure that essential data is not highlighted for removal. You can specify pixels to exclude from the removal set in a variety of ways.

  19. Press Enter to remove the highlighted speckles.

    The following example shows how the image of the soils map should appear after you remove the speckles.

  20. Close the drawing without saving changes.