select_shape_protoselect_shape_protoSelectShapeProtoSelectShapeProtoselect_shape_proto(算子)
名称
select_shape_protoselect_shape_protoSelectShapeProtoSelectShapeProtoselect_shape_proto — 选择彼此有一定关系的区域。
签名
Herror select_shape_proto(const Hobject Regions, const Hobject Pattern, Hobject* SelectedRegions, const char* Feature, double Min, double Max)
Herror T_select_shape_proto(const Hobject Regions, const Hobject Pattern, Hobject* SelectedRegions, const Htuple Feature, const Htuple Min, const Htuple Max)
void SelectShapeProto(const HObject& Regions, const HObject& Pattern, HObject* SelectedRegions, const HTuple& Feature, const HTuple& Min, const HTuple& Max)
HRegion HRegion::SelectShapeProto(const HRegion& Pattern, const HTuple& Feature, const HTuple& Min, const HTuple& Max) const
HRegion HRegion::SelectShapeProto(const HRegion& Pattern, const HString& Feature, double Min, double Max) const
HRegion HRegion::SelectShapeProto(const HRegion& Pattern, const char* Feature, double Min, double Max) const
HRegion HRegion::SelectShapeProto(const HRegion& Pattern, const wchar_t* Feature, double Min, double Max) const
(
Windows only)
static void HOperatorSet.SelectShapeProto(HObject regions, HObject pattern, out HObject selectedRegions, HTuple feature, HTuple min, HTuple max)
HRegion HRegion.SelectShapeProto(HRegion pattern, HTuple feature, HTuple min, HTuple max)
HRegion HRegion.SelectShapeProto(HRegion pattern, string feature, double min, double max)
def select_shape_proto(regions: HObject, pattern: HObject, feature: MaybeSequence[str], min: Union[int, float], max: Union[int, float]) -> HObject
描述
算子 select_shape_protoselect_shape_protoSelectShapeProtoSelectShapeProtoSelectShapeProtoselect_shape_proto selects regions based on
certain relations between the regions. Every region from
RegionsRegionsRegionsRegionsregionsregions is compared to the union of regions from
PatternPatternPatternPatternpatternpattern. The limits (MinMinMinMinminmin and MaxMaxMaxMaxmaxmax) are
specified absolutely or in percent (0..100), depending on the
feature. Possible values for FeatureFeatureFeatureFeaturefeaturefeature are:
- 'distance_dilate'
The minimum distance in the maximum norm from the edge of
PatternPatternPatternPatternpatternpattern to the edge of every region from RegionsRegionsRegionsRegionsregionsregions
is determined (see distance_rr_min_dildistance_rr_min_dilDistanceRrMinDilDistanceRrMinDilDistanceRrMinDildistance_rr_min_dil).
- 'distance_contour'
The minimum Euclidean distance from the edge of PatternPatternPatternPatternpatternpattern to
the edge of every region from RegionsRegionsRegionsRegionsregionsregions is determined. (see
distance_rr_mindistance_rr_minDistanceRrMinDistanceRrMinDistanceRrMindistance_rr_min).
- 'distance_center'
The Euclidean distance from the center of PatternPatternPatternPatternpatternpattern to the
center of every region from RegionsRegionsRegionsRegionsregionsregions is determined.
- 'covers'
It is examined how well the region PatternPatternPatternPatternpatternpattern fits into the
regions from RegionsRegionsRegionsRegionsregionsregions. If there is no shift so that
PatternPatternPatternPatternpatternpattern is a subset of RegionsRegionsRegionsRegionsregionsregions the overlap is 0.
If PatternPatternPatternPatternpatternpattern corresponds to the region after a corresponding
shift the overlap is 100. Otherwise the area of the opening of
RegionsRegionsRegionsRegionsregionsregions with PatternPatternPatternPatternpatternpattern is put into relation with the
area of RegionsRegionsRegionsRegionsregionsregions (in percent).
- 'fits'
It is examined whether PatternPatternPatternPatternpatternpattern can be shifted in such a way
that it fits in RegionsRegionsRegionsRegionsregionsregions. If this is possible the
corresponding region is copied from RegionsRegionsRegionsRegionsregionsregions. The
parameters MinMinMinMinminmin and MaxMaxMaxMaxmaxmax are ignored.
- 'overlaps_abs'
The area of the intersection of PatternPatternPatternPatternpatternpattern and every region in
RegionsRegionsRegionsRegionsregionsregions is computed.
- 'overlaps_rel'
The area of the intersection of PatternPatternPatternPatternpatternpattern and every region in
RegionsRegionsRegionsRegionsregionsregions is computed. The relative overlap is the ratio of
the area of the intersection and the are of the respective region in
RegionsRegionsRegionsRegionsregionsregions (in percent).
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
RegionsRegionsRegionsRegionsregionsregions (输入对象) region(-array) → objectHRegionHObjectHRegionHobject
Regions to be examined.
SelectedRegionsSelectedRegionsSelectedRegionsSelectedRegionsselectedRegionsselected_regions (输出对象) region(-array) → objectHRegionHObjectHRegionHobject *
Regions fulfilling the condition.
FeatureFeatureFeatureFeaturefeaturefeature (输入控制) string(-array) → HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Shape features to be checked.
默认值:
'covers'
"covers"
"covers"
"covers"
"covers"
"covers"
值列表:
'covers'"covers""covers""covers""covers""covers", 'distance_center'"distance_center""distance_center""distance_center""distance_center""distance_center", 'distance_contour'"distance_contour""distance_contour""distance_contour""distance_contour""distance_contour", 'distance_dilate'"distance_dilate""distance_dilate""distance_dilate""distance_dilate""distance_dilate", 'fits'"fits""fits""fits""fits""fits", 'overlaps_abs'"overlaps_abs""overlaps_abs""overlaps_abs""overlaps_abs""overlaps_abs", 'overlaps_rel'"overlaps_rel""overlaps_rel""overlaps_rel""overlaps_rel""overlaps_rel"
MinMinMinMinminmin (输入控制) number → HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Lower border of feature.
默认值:
50.0
建议值:
0.0, 1.0, 5.0, 10.0, 20.0, 30.0, 50.0, 60.0, 70.0, 80.0, 90.0, 95.0, 99.0, 100.0, 200.0, 400.0
值范围:
0.0
≤
Min
Min
Min
Min
min
min
最小增量:
0.001
建议增量:
5.0
MaxMaxMaxMaxmaxmax (输入控制) number → HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Upper border of the feature.
默认值:
100.0
建议值:
0.0, 10.0, 20.0, 30.0, 50.0, 60.0, 70.0, 80.0, 90.0, 95.0, 99.0, 100.0, 200.0, 300.0, 400.0
值范围:
0.0
≤
Max
Max
Max
Max
max
max
最小增量:
0.001
建议增量:
5.0
示例 (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
using namespace Halcon;
int main (int argc, char *argv[])
{
if (argc < 2)
{
cout << "Usage: " << argv[0] << " <radius of circle>" << endl;
exit (1);
}
double rad = atof (argv[1]);
HImage img ("monkey");
HWindow w;
img.Display (w);
HRegion circ = HRegion::GenCircle (100, 100, rad);
HRegionArray reg = img.Regiongrowing (3, 3, 5, 0);
HRegionArray seg = reg.SelectShapeProto (circ, "fits", 0, 0);
w.SetColor ("red");
seg.Display (w);
w.Click ();
return(0);
}
示例(C)
regiongrowing(Image,&Seg,3,3,5.0,0);
gen_circle(&C,100.0,100.0,MinRadius);
select_shape_proto(Seg,C,"fits",0.0,0.0);
示例 (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
using namespace Halcon;
int main (int argc, char *argv[])
{
if (argc < 2)
{
cout << "Usage: " << argv[0] << " <radius of circle>" << endl;
exit (1);
}
double rad = atof (argv[1]);
HImage img ("monkey");
HWindow w;
img.Display (w);
HRegion circ = HRegion::GenCircle (100, 100, rad);
HRegionArray reg = img.Regiongrowing (3, 3, 5, 0);
HRegionArray seg = reg.SelectShapeProto (circ, "fits", 0, 0);
w.SetColor ("red");
seg.Display (w);
w.Click ();
return(0);
}
示例 (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
using namespace Halcon;
int main (int argc, char *argv[])
{
if (argc < 2)
{
cout << "Usage: " << argv[0] << " <radius of circle>" << endl;
exit (1);
}
double rad = atof (argv[1]);
HImage img ("monkey");
HWindow w;
img.Display (w);
HRegion circ = HRegion::GenCircle (100, 100, rad);
HRegionArray reg = img.Regiongrowing (3, 3, 5, 0);
HRegionArray seg = reg.SelectShapeProto (circ, "fits", 0, 0);
w.SetColor ("red");
seg.Display (w);
w.Click ();
return(0);
}
示例 (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
using namespace Halcon;
int main (int argc, char *argv[])
{
if (argc < 2)
{
cout << "Usage: " << argv[0] << " <radius of circle>" << endl;
exit (1);
}
double rad = atof (argv[1]);
HImage img ("monkey");
HWindow w;
img.Display (w);
HRegion circ = HRegion::GenCircle (100, 100, rad);
HRegionArray reg = img.Regiongrowing (3, 3, 5, 0);
HRegionArray seg = reg.SelectShapeProto (circ, "fits", 0, 0);
w.SetColor ("red");
seg.Display (w);
w.Click ();
return(0);
}
结果
算子 select_shape_protoselect_shape_protoSelectShapeProtoSelectShapeProtoSelectShapeProtoselect_shape_proto 在输入不为空时返回值 2 ( H_MSG_TRUE )。当输入为空(无可用输入区域)时,可设置行为通过算子 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>)。空区域(区域是空集)的情况下的可设置行为通过
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>)。如有必要,则抛出异常。
可能的前趋
connectionconnectionConnectionConnectionConnectionconnection,
draw_regiondraw_regionDrawRegionDrawRegionDrawRegiondraw_region,
gen_circlegen_circleGenCircleGenCircleGenCirclegen_circle,
gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1GenRectangle1gen_rectangle1,
gen_rectangle2gen_rectangle2GenRectangle2GenRectangle2GenRectangle2gen_rectangle2,
gen_ellipsegen_ellipseGenEllipseGenEllipseGenEllipsegen_ellipse
可能的后继
select_grayselect_graySelectGraySelectGraySelectGrayselect_gray,
shape_transshape_transShapeTransShapeTransShapeTransshape_trans,
reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain,
count_objcount_objCountObjCountObjCountObjcount_obj
替代
select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape
另见
openingopeningOpeningOpeningOpeningopening,
erosion1erosion1Erosion1Erosion1Erosion1erosion1,
distance_rr_min_dildistance_rr_min_dilDistanceRrMinDilDistanceRrMinDilDistanceRrMinDildistance_rr_min_dil,
distance_rr_mindistance_rr_minDistanceRrMinDistanceRrMinDistanceRrMindistance_rr_min
模块
基础