Skip to content

select_shape_protoSelectShapeProtoSelectShapeProtoselect_shape_protoselect_shape_proto🔗

Short description🔗

select_shape_protoSelectShapeProtoSelectShapeProtoselect_shape_protoselect_shape_proto — Choose regions having a certain relation to each other.

Signature🔗

select_shape_proto( region Regions, region Pattern, out region SelectedRegions, string Feature, number Min, number Max )void SelectShapeProto( const HObject& Regions, const HObject& Pattern, HObject* SelectedRegions, const HTuple& Feature, const HTuple& Min, const HTuple& Max )static void HOperatorSet.SelectShapeProto( HObject regions, HObject pattern, out HObject selectedRegions, HTuple feature, HTuple min, HTuple max )def select_shape_proto( regions: HObject, pattern: HObject, feature: MaybeSequence[str], min: Union[int, float], max: Union[int, float] ) -> HObject

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 )

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)

HRegion HRegion.SelectShapeProto( HRegion pattern, HTuple feature, HTuple min, HTuple max )

HRegion HRegion.SelectShapeProto( HRegion pattern, string feature, double min, double max )

Description🔗

The operator select_shape_protoSelectShapeProto selects regions based on certain relations between the regions. Every region from Regionsregionsregions is compared to the union of regions from Patternpatternpattern. The limits (Minminmin and Maxmaxmax) are specified absolutely or in percent (0..100), depending on the feature. Possible values for Featurefeaturefeature are:

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Regionsregionsregions (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Regions to be examined.

Patternpatternpattern (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Region compared to Regionsregionsregions.

SelectedRegionsselectedRegionsselected_regions (output_object) region(-array) → objectHObjectHRegionHObjectHobject *

Regions fulfilling the condition.

Featurefeaturefeature (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Shape features to be checked.

Default: 'covers'"covers"
List of values: 'covers', 'distance_center', 'distance_contour', 'distance_dilate', 'fits', 'overlaps_abs', 'overlaps_rel'"covers", "distance_center", "distance_contour", "distance_dilate", "fits", "overlaps_abs", "overlaps_rel"

Minminmin (input_control) number → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Lower border of feature.

Default: 50.050.0
Suggested values: 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.00.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
Value range: 0.0 ≤ Min
Minimum increment: 0.001
Recommended increment: 5.0

Maxmaxmax (input_control) number → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Upper border of the feature.

Default: 100.0100.0
Suggested values: 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.00.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
Value range: 0.0 ≤ Max
Minimum increment: 0.001
Recommended increment: 5.0

Example🔗

(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++)
#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)\;
}

Result🔗

The operator select_shape_protoSelectShapeProto 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 (the region is the empty set) is set via set_system('empty_region_result',<Result>). If necessary an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

connectionConnection, draw_regionDrawRegion, gen_circleGenCircle, gen_rectangle1GenRectangle1, gen_rectangle2GenRectangle2, gen_ellipseGenEllipse

Possible successors

select_graySelectGray, shape_transShapeTrans, reduce_domainReduceDomain, count_objCountObj

Alternatives

select_shapeSelectShape

See also

openingOpening, erosion1Erosion1, distance_rr_min_dilDistanceRrMinDil, distance_rr_minDistanceRrMin

Module🔗

Foundation