OTSU_THRESHOLD
Name
   
    OTSU_THRESHOLD
Purpose
   
    This function uses Otsu's method to automatically perform histogram shape-based
    
    image thresholding, or, the reduction of a gray-level image to a binary image.
    
    The algorithm assumes that the image to be thresholded contains two classes of
    
    pixels (e.g. foreground and background) then calculates the optimum threshold
    
    separating those two classes so that their combined spread (inter-class variance)
    
    is maximal.
Category
   
    Image Processing.
Calling Sequence
   
    Result = OTSU_THRESHOLD( image [, THRESHOLDED_IMAGE=thresholdedImage] [, /VERBOSE] )
Inputs
   
    image
      
       A two-dimensional greyscale image array containing the data to be thresholded.
Keyword Parametrs
   
    THRESHOLDED_IMAGE
      
       An optional parameter specifying a named variable to contain the binary image 
      
       computed using the determined threshold.
    
    VERBOSE
      
       An optional parameter that if set will cause a plot of the image histogram
      
       depicting the threshold value to be displayed.
Return Value
   
    Result is a scalar containing the determined threshold.
Side Effects
   
    None
Requires
   
    None
Modification History
   
    Written by:       Carl Salvaggio
    
    April, 2011       Original code
    
    October, 2012     Vectorized to run significantly faster (using the 
                    
 
                      recommended modifications provided by Gianguido Cianci)
Disclaimer
   
    This source code is provided "as is" and without warranties as to performance 
    
    or merchantability. The author and/or distributors of this source code may 
    
    have made statements about this source code. Any such statements do not 
    
    constitute warranties and shall not be relied on by the user in deciding 
    
    whether to use this source code.
    
    This source code is provided without any express or implied warranties 
    
    whatsoever. Because of the diversity of conditions and hardware under which 
    
    this source code may be used, no warranty of fitness for a particular purpose 
    
    is offered. The user is advised to test the source code thoroughly before 
    
    relying on it. The user must assume the entire risk of using the source code.