Name
smallest_circle smallest_circle SmallestCircle smallest_circle SmallestCircle SmallestCircle — Smallest surrounding circle of a region.
The operator smallest_circle smallest_circle SmallestCircle smallest_circle SmallestCircle SmallestCircle determines the smallest
surrounding circle of a region, i.e., the circle with the smallest
area of all circles containing the region. For this circle the
center (Row Row Row Row Row row ,Column Column Column Column Column column ) and the radius
(Radius Radius Radius Radius Radius radius ) are calculated. The operator is applied when,
for example, the location and size of circular objects (e.g.,
coins) which, however, are not homogeneous inside or have broken
edges due to bad segmentation, has to be determined. The output of
the operator is selected in such a way that it can be used as input
for the operators disp_circle disp_circle DispCircle disp_circle DispCircle DispCircle and
gen_circle gen_circle GenCircle gen_circle GenCircle GenCircle .
In the documentation of this chapter (Regions / Features ), you can
find an image illustrating regions with varying outer and inner radii.
If several regions are passed in Regions Regions Regions Regions Regions regions corresponding
tuples are returned as output parameter. In case of empty region
all parameters have the value 0.0 if no other behavior was set (see
set_system set_system SetSystem set_system SetSystem SetSystem ).
Internally, the calculation is based on the center coordinates of
the region pixels. To take into account that pixels are not just
infinitely small points but have a certain area, the calculated
radius is enlarged by 0.5 before it is returned in
Radius Radius Radius Radius Radius radius . This, in most cases, gives acceptable results.
However, in the worst case (pixel diagonal) this enlargement is not
sufficient. If one wants to ensure that the border of the input
region completely lies within the circle, one had to enlarge the
radius by
instead of 0.5. Consequently,
the value returned in Radius Radius Radius Radius Radius radius must be corrected by
. However, this would also be only
an upper bound, i.e., the circle with the corrected radius would be
slightly too big in most cases.
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).
Automatically parallelized on tuple level.
Line index of the center.
Column index of the center.
Radius of the surrounding circle.
Assertion: Radius >= 0
read_image(Image,'fabrik')
regiongrowing(Image,Regions,5,5,6,100)
select_shape(Regions,SelectedRegions,'area','and',100,2000)
smallest_circle(SelectedRegions,Row,Column,Radius)
gen_circle(Circles,Row,Column,Radius)
dev_display (Circles)
read_image(&Image,"fabrik");
open_window(0,0,-1,-1,0,"visible","",&WindowHandle);
regiongrowing(Image,&Regions,5,5,6.0,100);
select_shape(Regions,&SelectedRegions,"area","and",100.0,2000.0);
T_smallest_circle(SelectedRegions,&Row,&Column,&Radius);
T_gen_circle(&Circles,Row,Column,Radius);
set_draw(WindowHandle,"margin");
disp_region(Circles,WindowHandle);
read_image(Image,'fabrik')
regiongrowing(Image,Regions,5,5,6,100)
select_shape(Regions,SelectedRegions,'area','and',100,2000)
smallest_circle(SelectedRegions,Row,Column,Radius)
gen_circle(Circles,Row,Column,Radius)
dev_display (Circles)
#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.SmallestCircle (&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);
}
read_image(Image,'fabrik')
regiongrowing(Image,Regions,5,5,6,100)
select_shape(Regions,SelectedRegions,'area','and',100,2000)
smallest_circle(SelectedRegions,Row,Column,Radius)
gen_circle(Circles,Row,Column,Radius)
dev_display (Circles)
read_image(Image,'fabrik')
regiongrowing(Image,Regions,5,5,6,100)
select_shape(Regions,SelectedRegions,'area','and',100,2000)
smallest_circle(SelectedRegions,Row,Column,Radius)
gen_circle(Circles,Row,Column,Radius)
dev_display (Circles)
If F is the area of the region, then the mean runtime complexity
is O(sqrt(F).
The operator smallest_circle smallest_circle SmallestCircle smallest_circle SmallestCircle SmallestCircle 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>) set_system("no_object_result",<Result>) SetSystem("no_object_result",<Result>) set_system("no_object_result",<Result>) SetSystem("no_object_result",<Result>) SetSystem("no_object_result",<Result>) .
The behavior in case of empty region (the region is the empty set) is set via
set_system('empty_region_result',<Result>) set_system("empty_region_result",<Result>) SetSystem("empty_region_result",<Result>) set_system("empty_region_result",<Result>) SetSystem("empty_region_result",<Result>) SetSystem("empty_region_result",<Result>) .
If necessary an exception is raised.
threshold threshold Threshold threshold Threshold Threshold ,
regiongrowing regiongrowing Regiongrowing regiongrowing Regiongrowing Regiongrowing ,
connection connection Connection connection Connection Connection ,
runlength_features runlength_features RunlengthFeatures runlength_features RunlengthFeatures RunlengthFeatures
gen_circle gen_circle GenCircle gen_circle GenCircle GenCircle ,
disp_circle disp_circle DispCircle disp_circle DispCircle DispCircle
elliptic_axis elliptic_axis EllipticAxis elliptic_axis EllipticAxis EllipticAxis ,
smallest_rectangle1 smallest_rectangle1 SmallestRectangle1 smallest_rectangle1 SmallestRectangle1 SmallestRectangle1 ,
smallest_rectangle2 smallest_rectangle2 SmallestRectangle2 smallest_rectangle2 SmallestRectangle2 SmallestRectangle2
set_shape set_shape SetShape set_shape SetShape SetShape ,
select_shape select_shape SelectShape select_shape SelectShape SelectShape ,
inner_circle inner_circle InnerCircle inner_circle InnerCircle InnerCircle
Foundation