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.
- Read and display an image, take its histogram and plot it. Use operators
User defined,
Display Image,
Histogram, and
2D Plot.
- 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.
- Convert to ASCII data using the
Supported Formats operator.
- 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.
- Use the operator
Import ASCII to create a new image with the same Data Type,
Index Order and Size of the original image.
- Finally display the sorted image, determine its histogram and plot it.
Exercises
- Change the sort order from ascending to descending.
- How can the histograms be precisely compared?
DIP Feedback Form