Lab: Logarithm Contrast Enhancement

[Exercises] [Workspace]

Purpose: The purpose of this lab is to experiment with techniques of image contrast enhancement achieved by applying logarithmic functions and logarithmic colormaps to images.

Activities:

  1. Contrast Enhancement using the log function explicitly.

    1. Read and display the $DIP/data/myelin.kdf image using the operators User defined and Display Image.

      1. Glyphs:Input/Output:Data Files:User defined
      2. Glyphs:Visualization:Non-Interactive Display:Display Image

    2. Apply the Logarithm operator the image and display the result using the Display Image operator. The resultant image has a much better contrast in the dark areas.

      1. Glyphs:Arithmetic:NonLinear Functions:Logarithm
      2. Glyphs:Visualization:Non-Interactive Display:Display Image

    3. You will notice that the pixels values of the previous image are of type float varying from 0 to log(1+255) which is approximately 2.4. Use the operator Normalize to convert the image to pixels of type unsigned byte varying from 0 to 255.

      1. Glyphs:Data Manip:Data Conversion:Normalize
      2. Glyphs:Visualization:Non-Interactive Display:Display Image

  2. Contrast Enhancement using a logarithmic color table. This experiment shows three ways of enhancing the image using the logarithm colormap.

    1. Visualize the color table data. Read the colormap file $DIP/data/log-256-lut.kdf, and print its data using the operator Print Data with the parameters "Map Indexing" and "Map Data" selected.

      1. Glyphs:Input/Output:Data Files:User defined
      2. Glyphs:Input/Output:Information:Print Data
      3. Glyphs:Input/Output:Information:File Viewer

    2. Plot this file. This requires that you first transfer the data to the VALUE segment using the Copy to Value operator, then plot the results using Display 2D Plot.

      1. Glyphs:Data Manip:Segment Operators:Copy to Value
      2. Glyphs:Visualization:Plot Display:Display 2D Plot
      3. Open the Copy to Value and set the parameters so that the map segment is copied to the value segment.

    3. Use the operator Display Image to display the $DIP/data/myelin.kdf image. Connect the colormap file to the last entry of the Display Image operator ("Colormap Image").

      1. Glyphs:Visualization:Non-Interactive Display:Display Image

    4. Insert the colortable in the image file using the operator Insert Segments. Insert the "Value" segment of $DIP/data/myelin.kdf file with the colortable file. Display it with Display Image.

      1. Glyphs:Data Manip:Segment Operators:Insert Segments
      2. Glyphs:Visualization:Non-Interactive Display:Display Image

    5. Use the image generated in the previous method and explicitly map the data through the colormap using the operator Map Data.

      1. Glyphs:Data Manip:Map Operators:Map Data
      2. Glyphs:Visualization:Non-Interactive Display:Display Image


Exercises

  1. Explain the differences between the three methods of using the color table. Use the operator Data Object Info to see the differences between the file contents of methods 2 and 3.

    Glyphs:Input/Output:Information:Data Object Info

    Glyphs:Input/Output:Information:File Viewer


Khoros Workspace
Execute the visual program c4s6contrast-log.wk



Main DIP Menu
DIP Feedback Form
Copyright © 1997-1995 KRI, ISTEC, Ramiro Jordán, Roberto Lotufo. All Rights Reserved