Herror ::inner_circle (
    Hobject Regions,
    double *Row,
    double *Column,
    double *Radius
)
Herror ::inner_circle (
    Hobject Regions,
    HTuple *Row,
    HTuple *Column,
    HTuple *Radius
)
double HRegion::InnerCircle (
    double *Column,
    double *Radius
) const
HTuple HRegionArray::InnerCircle (
    HTuple *Column,
    HTuple *Radius
) const

Largest inner circle of a region.

The operator ::inner_circle determines the largest inner circle of a region, i.e. the circle with the largest area of all circles that fit into the region. For this circle the center (Row,Column) and the radius (Radius) are calculated. The output of the procedure is chosen in such a way that it can be used as input for the HALCON procedures ::disp_circle and ::gen_circle.

If several regions are passed in Regions corresponding tuples are returned as output parameters. In case of empty region all parameters have the value 0.0 if no other behavior was set (see ::set_system).


Attention

If several inner circles are present at a region only one solution is returned.


Parameters

Regions (input_object)
region(-array) -> Hobject: HRegion(Array)
Regions to be examined.

Row (output_control)
circle.center.y(-array) -> (HTuple.) double *
Line index of the center.

Column (output_control)
circle.center.x(-array) -> (HTuple.) double *
Column index of the center.

Radius (output_control)
circle.radius(-array) -> (HTuple.) double *
Radius of the inner circle.
Assertion: Radius >= 0


Example
#include  <iostream.h>
#include  "HalconCpp.h"

int main (int argc, char *argv[])
{
  Tuple    row, col, rad;

  HImage   img (argv[1]);
  HWindow  w;

  img.Display (w);

  HRegionArray  reg  = img.Regiongrowing (5, 5, 6.0, 100);
  HRegionArray  seg  = reg.SelectShape ("area", "and", 100.0, 1000.0);

  row = seg.InnerCircle (&col, &rad);

  HRegionArray  circ = HRegionArray::GenCircle (row, col, rad);

  w.SetDraw   ("margin");

  w.SetColor  ("green");   reg.Display (w);
  w.SetColor  ("blue");    seg.Display (w);
  w.SetColor  ("red");     circ.Display (w);
  w.Click ();

  return(0);
}

Complexity

If F is the area of the region and R is the radius of the inner circle the runtime complexity is O(F * R).


Result

The operator ::inner_circle returns the value H_MSG_TRUE if the input is not empty. The behavior in case of empty input (no input regions available) 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 Predecessors

::threshold, ::regiongrowing, ::connection, ::runlength_features


Possible Successors

::gen_circle, ::disp_circle


Alternatives

::erosion_circle


See also

::set_shape, ::select_shape, ::smallest_circle


Module

Region processing



Copyright © 1996-2002 MVTec Software GmbH