>  Docs Center  >  Libraries  >  Coyote  >  BLOB_ANALYZER__DEFINE






      The purpose of this routine is to create a system for analyzing
      regions of interest (ROIs) or (more commonly) "blobs" inside images.
      In particular, given a suitable image (this will require judgement on
      your part), the program will automatically select "blobs" or connected
      regions in the image and make it possible for you to analyze these
      blobs. An example program is provided to show you one way the program
      can be used.
      The code is a wrapper, essentially, for LABEL_REGION and HISTOGRAM, with
      a couple of my other image processing routines (FIND_BOUNDARY and FIT_ELLIPSE)
      used in a supporting role.


      David Fanning, Ph.D.
      1645 Sheely Drive
      Fort Collins, CO 80526 USA
      Phone: 970-221-0438
      E-mail: david@idlcoyote.com
      Coyote's Guide to IDL Programming: http://www.idlcoyote.com


      Analysis, Image Processing

Calling Sequence

      analyzer = Obj_New("BLOB_ANALYZER", image)


  image: A two-dimensional image array. To make this program memory efficient,
                    a copy of the image is *not* stored in the object. You will be responsible
                    for image operations outside this program.


  ALL_NEIGHBORS: Set this keyword to look at all eight neighbors when searching
                    for connectivity. The default is to look for four neighbors on
                    each side of the starting pixel. Passed directly to LABEL_REGION.
  MASK: A two-dimensional array, the same size as image, that identifies the
                    foreground and background pixels in the image. Applying the mask
                    should result in a bi-level image of 0s and 1s, where 1 identifies the
                    blobs you wish to analyze. If a mask is not provided, the mask is created
                    like this:
                    mask = image > 0
  SCALE: A one- or two-dimensional given the pixel scaling parameters. By default [1.0, 1.0].
                    If passed a scalar, the scale parameter is applied to both the X and Y directions of
                    each pixel. Statistical output is reported with scaling unless the NOSCALE keyword
                    is set. Scaling also effects the data that is output from the various methods.
  The following methods are provided. Please see the documentation header for each method for
  information on arguments and keywords that can be used with the method.
  FitEllipse: This method fits an ellipse to the blob. It returns information about the fitted
                    ellipse, including the points that all the ellipse to be drawn.
  GetIndices: This method returns the indices for a particular blob in the image.
  GetStats: This method returns a structure containing statistics for a particular blob in the image.
                    The structure is defined as follows:
                    stats = {INDEX: indexNumber, $ ; The index number of this blob.
                              COUNT: N_Elements(indices), $ ; The number of indices in this blob.
                              PERIMETER_PTS: boundaryPts, $ ; A [2,n] array of points that describe the blob perimeter.
                              PIXEL_AREA: pixelArea, $ ; The area as calculated by pixels in the blob.
                              PERIMETER_AREA: perimeterArea, $ ; The area as calculated by the blob perimeter. (Smaller than pixel area.)
                              CENTER: centroid[0:1], $ ; The [x,y] array that identifies the centroid of the blob.
                              PERIMETER_LENGTH: perimeter_length, $ ; The perimenter length (scaled unless the NOSCALE keyword is set).
                              SCALE: scale, $ ; The [xscale, yscale] array used in scaling.
                              MINCOL: Min(xyindices[0,*]), $ ; The minimum column index in the blob.
                              MAXCOL: Max(xyindices[0,*]), $ ; The maximum column index in the blob.
                              MINROW: Min(xyindices[1,*]), $ ; The minimum row index in the blob.
                              MAXROW: Max(xyindices[1,*])} ; The maximum row index in the blob.
  NumberOfBlobs: The number of blobs identified in the image.
  ReportStats: This methods reports statistics on every identified blob in the image. The
                      report can be sent to the display (the default) or to a file. The format for
                      the report works for most images, but you may have to change the format or override
                      this method for your particular image. The reported statistics are basically the
                      output of the GetStats and FitEllipse methods.
    Here is an example of statistical output from the example program below.
    0 426 107.89 9.78 106.50 98.00 37.56 12.15 11.29 -8.05
    1 580 151.97 10.22 145.00 134.25 49.21 17.49 11.77 -0.99
    2 812 266.29 15.36 203.00 190.75 52.56 17.88 14.65 -107.48
    3 1438 204.53 43.29 359.50 344.13 70.23 21.68 21.12 -76.47


      Requires programs from the Coyote Library. At the very least, those below are required.
      It is *highly* recommended that you install the entire library. FIT_ELLIPSE has been
      changed specifically for this release, so by sure you get a copy of that with this
      source code.
      ERROR_MESSAGE http://www.idlcoyote.com/programs/error_message.pro
      FIND_BOUNDARY http://www.idlcoyote.com/programs/find_boundary.pro
      FIT_ELLIPSE http://www.idlcoyote.com/programs/fit_ellipse.pro
      The program currently works only with 2D bi-level images.


      To run an example program. Compile the file and type "example" at the IDL command line.
      IDL> .compile blob_analyzer__define
      IDL> example

Modification History

      Written by David W. Fanning, Fanning Software Consulting, 17 August 2008.
      Ideas taken from discussion with Ben Tupper and Ben's program HBB_ANALYZER.

© NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us