inner_circleinner_circleInnerCircleInnerCircleinner_circle (Operator)

Name

inner_circleinner_circleInnerCircleInnerCircleinner_circle — Largest inner circle of a region.

Signature

inner_circle(Regions : : : Row, Column, Radius)

Herror inner_circle(const Hobject Regions, double* Row, double* Column, double* Radius)

Herror T_inner_circle(const Hobject Regions, Htuple* Row, Htuple* Column, Htuple* Radius)

void InnerCircle(const HObject& Regions, HTuple* Row, HTuple* Column, HTuple* Radius)

void HRegion::InnerCircle(HTuple* Row, HTuple* Column, HTuple* Radius) const

void HRegion::InnerCircle(double* Row, double* Column, double* Radius) const

static void HOperatorSet.InnerCircle(HObject regions, out HTuple row, out HTuple column, out HTuple radius)

void HRegion.InnerCircle(out HTuple row, out HTuple column, out HTuple radius)

void HRegion.InnerCircle(out double row, out double column, out double radius)

def inner_circle(regions: HObject) -> Tuple[Sequence[float], Sequence[float], Sequence[float]]

def inner_circle_s(regions: HObject) -> Tuple[float, float, float]

Description

The operator inner_circleinner_circleInnerCircleInnerCircleInnerCircleinner_circle determines the largest inner circle of a region. This is the biggest discrete circle region that completely fits into the region. For this circle the center (RowRowRowRowrowrow, ColumnColumnColumnColumncolumncolumn) and the radius (RadiusRadiusRadiusRadiusradiusradius) are calculated. If the position of the circle is ambiguous, the "first possible" position (as far upper left as possible) is returned.

In the documentation of this chapter (Regions / Features), you can find an image illustrating regions with varying inner circles.

The output of the operator is chosen in such a way that it can be used as an input for the operators disp_circledisp_circleDispCircleDispCircleDispCircledisp_circle, gen_circlegen_circleGenCircleGenCircleGenCirclegen_circle, and gen_ellipse_contour_xldgen_ellipse_contour_xldGenEllipseContourXldGenEllipseContourXldGenEllipseContourXldgen_ellipse_contour_xld.

If several regions are passed in RegionsRegionsRegionsRegionsregionsregions corresponding tuples are returned as output parameters. In case of an empty input region all parameters have the value 0.0 if no other behavior was set with set_systemset_systemSetSystemSetSystemSetSystemset_system.

Attention

If several inner circles are present at a region only the most upper left solution is returned.

Execution Information

Parameters

RegionsRegionsRegionsRegionsregionsregions (input_object)  region(-array) objectHRegionHObjectHRegionHobject

Regions to be examined.

RowRowRowRowrowrow (output_control)  circle.center.y(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Line index of the center.

ColumnColumnColumnColumncolumncolumn (output_control)  circle.center.x(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Column index of the center.

RadiusRadiusRadiusRadiusradiusradius (output_control)  circle.radius(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Radius of the inner circle.

Assertion: Radius >= 0

Example (HDevelop)

read_image(Image,'fabrik')
regiongrowing(Image,Seg,5,5,6,100)
select_shape(Seg,H,'area','and',100,2000)
inner_circle(H,Row,Column,Radius)
gen_circle(Circles,Row,Column,Radius)
dev_set_draw('margin')
dev_display(Circles)

Example (C)

read_image(&Image,"fabrik");
regiongrowing(Image,&Seg,5,5,6.0,100);
select_shape(Seg,&H,"area","and",100.0,2000.0);
T_inner_circle(H,&Row,&Column,&Radius);
T_gen_circle(&Circles,Row,Column,Radius);

Example (C++)

#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
using namespace Halcon;

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);
}

Example (HDevelop)

read_image(Image,'fabrik')
regiongrowing(Image,Seg,5,5,6,100)
select_shape(Seg,H,'area','and',100,2000)
inner_circle(H,Row,Column,Radius)
gen_circle(Circles,Row,Column,Radius)
dev_set_draw('margin')
dev_display(Circles)

Example (HDevelop)

read_image(Image,'fabrik')
regiongrowing(Image,Seg,5,5,6,100)
select_shape(Seg,H,'area','and',100,2000)
inner_circle(H,Row,Column,Radius)
gen_circle(Circles,Row,Column,Radius)
dev_set_draw('margin')
dev_display(Circles)

Complexity

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

Result

The operator inner_circleinner_circleInnerCircleInnerCircleInnerCircleinner_circle returns the value 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>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>), the behavior in case of empty region is set via set_system('empty_region_result',<Result>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)set_system("empty_region_result",<Result>). If necessary an exception is raised.

Possible Predecessors

thresholdthresholdThresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing, connectionconnectionConnectionConnectionConnectionconnection, runlength_featuresrunlength_featuresRunlengthFeaturesRunlengthFeaturesRunlengthFeaturesrunlength_features

Possible Successors

gen_circlegen_circleGenCircleGenCircleGenCirclegen_circle, disp_circledisp_circleDispCircleDispCircleDispCircledisp_circle

Alternatives

erosion_circleerosion_circleErosionCircleErosionCircleErosionCircleerosion_circle, inner_rectangle1inner_rectangle1InnerRectangle1InnerRectangle1InnerRectangle1inner_rectangle1

See also

set_shapeset_shapeSetShapeSetShapeSetShapeset_shape, select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, smallest_circlesmallest_circleSmallestCircleSmallestCircleSmallestCirclesmallest_circle

Module

Foundation