Histogram Principles / ASCII data processing

Building the Cantata Workspace


Khoros does not have an operator to sort the pixels of an image. To do this we can use the UNIX sort command. This example illustrates how we can integrate other standard tools into Cantata.

The general idea is to convert the pixels into an ASCII table, sort it using the UNIX sort command, and then convert the data back to the viff format. Several tricks are necessary to make this work.

Following is a procedure to create a sorted version (raster scan ascending order) and compare their histograms.

  1. Read and display an image, take its histogram and plot it. Use operators User defined, Display Image, Histogram, and 2D Plot.
  2. To convert the 2D data into a 1D column table use the operator Reorient. Map the WIDTH and HEIGHT dimensions to a new HEIGHT dimension.
  3. Convert to ASCII data using the Supported Formats operator.
  4. To call a standard UNIX command, use the Command Icon. Write the command sort -n in the command area. The input and output files are piped through stdin and stdout channels. This operator will sort the pixels in the table.
  5. Use the operator Import ASCII to create a new image with the same Data Type, Index Order and Size of the original image.
  6. Finally display the sorted image, determine its histogram and plot it.

Exercises


DIP Feedback Form

Copyright © 1995 KRI, ISTEC, Ramiro Jordán, Roberto Lotufo. All Rights Reserved.