inner_circleπ
Short descriptionπ
inner_circle β Largest inner circle of a region.
Signatureπ
inner_circle( region Regions, out circle.center.y Row, out circle.center.x Column, out circle.radius Radius )
Descriptionπ
The operator inner_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 (Row, Column) and the
radius (Radius) 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_circle,
gen_circle, and gen_ellipse_contour_xld.
If several regions are passed in Regions 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_system.
Attentionπ
If several inner circles are present at a region only the most upper left solution is returned.
Execution informationπ
Execution information
-
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
-
Multithreading scope: global (may be called from any thread).
-
Automatically parallelized on tuple level.
Parametersπ
Regions (input_object) region(-array) β object
Regions to be examined.
Row (output_control) circle.center.y(-array) β (real)
Line index of the center.
Column (output_control) circle.center.x(-array) β (real)
Column index of the center.
Radius (output_control) circle.radius(-array) β (real)
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)
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)\;
#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)\;
}
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_circle returns the value 2 (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 is raised.
Combinations with other operatorsπ
Combinations
Possible predecessors
threshold, regiongrowing, connection, runlength_features
Possible successors
Alternatives
erosion_circle, inner_rectangle1
See also
Moduleπ
Foundation