Herror ::shape_histo_all (
    Hobject Region,
    Hobject Image,
    const HTuple &Feature,
    HTuple *AbsoluteHisto,
    HTuple *RelativeHisto
)
HTuple HRegion::ShapeHistoAll (
    const HImage &Image,
    const HTuple &Feature,
    HTuple *RelativeHisto
) const

Determine a histogram of features along all threshold values.

The operator ::shape_histo_all carries out 255 threshold operations within Region with the gray values of Image. The entry i in the histogram corresponds to the number of connected components/holes of this image segmented with the threshold i (Feature = 'connected_components', 'holes') or the mean value of the feature values of the regions segmented in this way (Feature = 'convexity', 'compactness', 'ansisometry'), respectively.

The histogram can also be displayed directly as a graphic via the operators ::set_paint(WindowHandle,'component_histogram') and ::disp_image.


Attention

The operator ::shape_histo_all expects a region and exactly one gray value image as input. Because of the power of this operator the runtime of ::shape_histo_all is relatively large!


Parameters

Region (input_object)
region -> Hobject: HRegion
Region in which the features are to be examined.

Image (input_object)
image -> Hobject: HImage ( byte )
Gray value image.

Feature (input_control)
string -> HTuple.char *
Feature to be examined.
Default value: 'connected_components'
List of values: 'connected_components', 'convexity', 'compactness', 'anisometry', 'holes'

AbsoluteHisto (output_control)
histogram-array -> HTuple.double * / long *
Absolute distribution of the feature.

RelativeHisto (output_control)
histogram-array -> HTuple.double *
Relative distribution of the feature.


Example
/* Simulation von shape_histo_all mit Merkmal 'connected_components': */
my_shape_histo_all(Hobject Region,Hobject Image,
		   long AbsHisto[], double RelHisto[])
{
  long     i,sum;
  Hobject  RegionGray,Seg;

  reduce_domain(Region,Image,&RegionGray);
  for (i=0; i<256; i++) {
    threshold(RegionGray,&Seg,(double)i,255.0);
    connect_and_holes(Seg,&AbsHisto[i],_);
    clear_obj(Seg);
  }
  clear_obj(RegionGray); sum = 0;
  for (i=0; i<256; i++)
    sum += AbsHisto[i];
  for (i=0; i<256; i++)
    RelHist[i] = (double)AbsHisto[i]/Sum;
}

Complexity

If F is the area of the input region and N the mean number of connected components the runtime complexity is O(255 * (F + sqrt(F) * sqrt(N)).


Result

The operator ::shape_histo_all returns the value H_MSG_TRUE if an image with the defined gray values is entered. The behavior in case of empty input (no input images) is set via the operator ::set_system('no_object_result',<Result>), the behavior in case of empty region is set via ::set_system('empty_region_result',<Result>). If necessary an exception handling is raised.


Possible Successors

::histo_to_thresh, ::threshold, ::gen_region_histo


Alternatives

::shape_histo_point


See also

::connection, ::convexity, ::compactness, ::connect_and_holes, ::entropy_gray, ::gray_histo, ::set_paint, ::count_obj


Module

Image filters



Copyright © 1996-2002 MVTec Software GmbH