GDexIndex.gif Previous-2.gif Next-3.gif

Calculating Image Statistics(ImageStats)


Another example that involves some of the interactive 2D drawing modules is to select a region within an image in a 2D view using the ContinuousSketch module and calculate some simple statistics on the values within that region.

 

GENERATE/FH413284.gif

Starting up

  1. 1.      Start AVS/Express or load a new application with None as the application type, as necessary.
  2. Instance the example

    Instance ImageStats into the empty NE workspace.

    This example is found in Libraries.Examples.Graphics_Display. The example renders the image avs.x into the viewer's window.

    Select a region from the image

    We are now ready to select a region in the image to calculate statistics.

    Select Editors->Modules to make the modules user interface panel visible. Select ContinuousSketch from the Modules option menu. This causes the user interface for the ContinuousSketch module to appear.

    Begin drawing a polygon, using the draw primitive operation.

    The mouse operations that control the drawing in the ContinuousSketch module are:

    Mouse-controlled operations

     

    Gesture

     

    Draw primitive

    Hold down the right button, and drag the mouse.

     

    In this example, the ContinuousSketch module is set up to draw a polygon in COPY mode. Once the operation is complete (that is, the right mouse button is released), the polygon is converted into a field since the Immediate toggle is set.

    The polygon converted into a raster mask by the Vector2Raster module. The raster mask is then used by the StatROI macro to calculate some statistics on the pixel values inside the polygon. Note that StatROI is a macro that was built for this example. The V code for it can be found in v/gd_examp/GDinter11.v .

    This touches on only a small portion of the capabilities in the ContinuousSketch module.

    Examining the image statistics

    Once a region is selected in the image, you can also view the statistics on the values in that region.

    Select Statistics from the Modules option menu to make the user interface for this module visible.

    This module calculates the mean, minimum, maximum, total, average and standard deviation of the values in the selected region of the image.

    Cleanup

    This completes the example.

    Delete the ImageStats application.

     

     



    GDexIndex.gif Previous-2.gif Next-3.gif