Operator Reference

polar_trans_regionpolar_trans_regionPolarTransRegionPolarTransRegionpolar_trans_region (Operator)

polar_trans_regionpolar_trans_regionPolarTransRegionPolarTransRegionpolar_trans_region — Transform a region within an annular arc to polar coordinates.

Signature

Herror polar_trans_region(const Hobject Region, Hobject* PolarTransRegion, double Row, double Column, double AngleStart, double AngleEnd, double RadiusStart, double RadiusEnd, const Hlong Width, const Hlong Height, const char* Interpolation)

Herror T_polar_trans_region(const Hobject Region, Hobject* PolarTransRegion, const Htuple Row, const Htuple Column, const Htuple AngleStart, const Htuple AngleEnd, const Htuple RadiusStart, const Htuple RadiusEnd, const Htuple Width, const Htuple Height, const Htuple Interpolation)

void PolarTransRegion(const HObject& Region, HObject* PolarTransRegion, const HTuple& Row, const HTuple& Column, const HTuple& AngleStart, const HTuple& AngleEnd, const HTuple& RadiusStart, const HTuple& RadiusEnd, const HTuple& Width, const HTuple& Height, const HTuple& Interpolation)

HRegion HRegion::PolarTransRegion(const HTuple& Row, const HTuple& Column, double AngleStart, double AngleEnd, const HTuple& RadiusStart, const HTuple& RadiusEnd, Hlong Width, Hlong Height, const HString& Interpolation) const

HRegion HRegion::PolarTransRegion(double Row, double Column, double AngleStart, double AngleEnd, double RadiusStart, double RadiusEnd, Hlong Width, Hlong Height, const HString& Interpolation) const

HRegion HRegion::PolarTransRegion(double Row, double Column, double AngleStart, double AngleEnd, double RadiusStart, double RadiusEnd, Hlong Width, Hlong Height, const char* Interpolation) const

HRegion HRegion::PolarTransRegion(double Row, double Column, double AngleStart, double AngleEnd, double RadiusStart, double RadiusEnd, Hlong Width, Hlong Height, const wchar_t* Interpolation) const   ( Windows only)

static void HOperatorSet.PolarTransRegion(HObject region, out HObject polarTransRegion, HTuple row, HTuple column, HTuple angleStart, HTuple angleEnd, HTuple radiusStart, HTuple radiusEnd, HTuple width, HTuple height, HTuple interpolation)

HRegion HRegion.PolarTransRegion(HTuple row, HTuple column, double angleStart, double angleEnd, HTuple radiusStart, HTuple radiusEnd, int width, int height, string interpolation)

HRegion HRegion.PolarTransRegion(double row, double column, double angleStart, double angleEnd, double radiusStart, double radiusEnd, int width, int height, string interpolation)

def polar_trans_region(region: HObject, row: Union[int, float], column: Union[int, float], angle_start: float, angle_end: float, radius_start: Union[int, float], radius_end: Union[int, float], width: int, height: int, interpolation: str) -> HObject

Description

polar_trans_regionpolar_trans_regionPolarTransRegionPolarTransRegionpolar_trans_region transforms a RegionRegionRegionregionregion within the annular arc specified by the center point (RowRowRowrowrow, ColumnColumnColumncolumncolumn), the radii RadiusStartRadiusStartRadiusStartradiusStartradius_start and RadiusEndRadiusEndRadiusEndradiusEndradius_end and the angles AngleStartAngleStartAngleStartangleStartangle_start and AngleEndAngleEndAngleEndangleEndangle_end to its polar coordinate version in a virtual image of the dimensions WidthWidthWidthwidthwidth x HeightHeightHeightheightheight.

The polar transformation is a change of the coordinate system. Instead of a row and a column coordinate, each point's position is expressed by its radius r (i.e. the distance to the center point RowRowRowrowrow, ColumnColumnColumncolumncolumn) and the angle phi between the column axis (through the center point) and the line from the center point towards the point. Note that this transformation is not affine.

The coordinate (0,0) in the output region always corresponds to the point in the input region that is specified by RadiusStartRadiusStartRadiusStartradiusStartradius_start and AngleStartAngleStartAngleStartangleStartangle_start. Analogously, the coordinate (HeightHeightHeightheightheight-1, WidthWidthWidthwidthwidth-1) corresponds to the point in the input region that is specified by RadiusEndRadiusEndRadiusEndradiusEndradius_end and AngleEndAngleEndAngleEndangleEndangle_end. In the usual mode (AngleStartAngleStartAngleStartangleStartangle_start < AngleEndAngleEndAngleEndangleEndangle_end and RadiusStartRadiusStartRadiusStartradiusStartradius_start < RadiusEndRadiusEndRadiusEndradiusEndradius_end), the polar transformation is performed in the mathematically positive orientation (counterclockwise). Furthermore, points with smaller radii lie in the upper part of the output region. By suitably exchanging the values of these parameters (e.g., AngleStartAngleStartAngleStartangleStartangle_start > AngleEndAngleEndAngleEndangleEndangle_end or RadiusStartRadiusStartRadiusStartradiusStartradius_start > RadiusEndRadiusEndRadiusEndradiusEndradius_end), any desired orientation of the output region can be achieved.

The angles can be chosen from all real numbers. Center point and radii can be real as well. However, if they are both integers and the difference of RadiusEndRadiusEndRadiusEndradiusEndradius_end and RadiusStartRadiusStartRadiusStartradiusStartradius_start equals HeightHeightHeightheightheight-1, calculation will be sped up through an optimized routine.

The radii and angles are inclusive, which means that the first row of the virtual target image contains the circle with radius RadiusStartRadiusStartRadiusStartradiusStartradius_start and the last row contains the circle with radius RadiusEndRadiusEndRadiusEndradiusEndradius_end. For complete circles, where the difference between AngleStartAngleStartAngleStartangleStartangle_start and AngleEndAngleEndAngleEndangleEndangle_end equals (360 degrees), this also means that the first column of the target image will be the same as the last.

To avoid this, do not make this difference , but degrees instead.

The parameter InterpolationInterpolationInterpolationinterpolationinterpolation is used to select the interpolation method 'bilinear'"bilinear""bilinear""bilinear""bilinear" or 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor". Setting InterpolationInterpolationInterpolationinterpolationinterpolation to 'bilinear'"bilinear""bilinear""bilinear""bilinear" leads to smoother region boundaries, especially if regions are enlarged. However, the runtime increases significantly.

If more than one region is passed in RegionRegionRegionregionregion, their polar transformations are computed individually and stored as a tuple in PolarTransRegionPolarTransRegionPolarTransRegionpolarTransRegionpolar_trans_region. Please note that the indices of an input region and its transformation only correspond if the system variable 'store_empty_regions'"store_empty_regions""store_empty_regions""store_empty_regions""store_empty_regions" is set to 'true'"true""true""true""true" (see set_systemset_systemSetSystemSetSystemset_system). Otherwise empty output regions are discarded and the length of the input tuple RegionRegionRegionregionregion is most likely not equal to the length of the output tuple PolarTransRegionPolarTransRegionPolarTransRegionpolarTransRegionpolar_trans_region.

Further Information

For an explanation of the different 2D coordinate systems used in HALCON, see the introduction of chapter Transformations / 2D Transformations.

Attention

If WidthWidthWidthwidthwidth or HeightHeightHeightheightheight are chosen greater than the dimensions of the current image, the system variable 'clip_region'"clip_region""clip_region""clip_region""clip_region" should be set to 'false'"false""false""false""false" (see set_systemset_systemSetSystemSetSystemset_system). Otherwise, an output region that does not lie within the dimensions of the current image can produce an error message.

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.
  • Automatically parallelized on internal data level.

Parameters

RegionRegionRegionregionregion (input_object)  region(-array) objectHRegionHObjectHObjectHobject

Input region.

PolarTransRegionPolarTransRegionPolarTransRegionpolarTransRegionpolar_trans_region (output_object)  region(-array) objectHRegionHObjectHObjectHobject *

Output region.

RowRowRowrowrow (input_control)  number HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Row coordinate of the center of the arc.

Default: 256

Suggested values: 0, 16, 32, 64, 128, 240, 256, 480, 512

ColumnColumnColumncolumncolumn (input_control)  number HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Column coordinate of the center of the arc.

Default: 256

Suggested values: 0, 16, 32, 64, 128, 256, 320, 512, 640

AngleStartAngleStartAngleStartangleStartangle_start (input_control)  angle.rad HTuplefloatHTupleHtuple (real) (double) (double) (double)

Angle of the ray to be mapped to column coordinate 0 of PolarTransRegionPolarTransRegionPolarTransRegionpolarTransRegionpolar_trans_region.

Default: 0.0

Suggested values: 0.0, 0.78539816, 1.57079632, 3.141592654, 6.2831853, 12.566370616

Value range: -6.2831853 ≤ AngleStart AngleStart AngleStart angleStart angle_start ≤ 6.2831853

AngleEndAngleEndAngleEndangleEndangle_end (input_control)  angle.rad HTuplefloatHTupleHtuple (real) (double) (double) (double)

Angle of the ray to be mapped to column coordinate WidthWidthWidthwidthwidth-1 of PolarTransRegionPolarTransRegionPolarTransRegionpolarTransRegionpolar_trans_region.

Default: 6.2831853

Suggested values: 0.0, 0.78539816, 1.57079632, 3.141592654, 6.2831853, 12.566370616

Value range: -6.2831853 ≤ AngleEnd AngleEnd AngleEnd angleEnd angle_end ≤ 6.2831853

RadiusStartRadiusStartRadiusStartradiusStartradius_start (input_control)  number HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Radius of the circle to be mapped to row coordinate 0 of PolarTransRegionPolarTransRegionPolarTransRegionpolarTransRegionpolar_trans_region.

Default: 0

Suggested values: 0, 16, 32, 64, 100, 128, 256, 512

Value range: 0 ≤ RadiusStart RadiusStart RadiusStart radiusStart radius_start ≤ 32767

RadiusEndRadiusEndRadiusEndradiusEndradius_end (input_control)  number HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Radius of the circle to be mapped to row coordinate HeightHeightHeightheightheight-1 of PolarTransRegionPolarTransRegionPolarTransRegionpolarTransRegionpolar_trans_region.

Default: 100

Suggested values: 0, 16, 32, 64, 100, 128, 256, 512

Value range: 0 ≤ RadiusEnd RadiusEnd RadiusEnd radiusEnd radius_end ≤ 32767

WidthWidthWidthwidthwidth (input_control)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of the virtual output image.

Default: 512

Suggested values: 256, 320, 512, 640, 800, 1024

Value range: 2 ≤ Width Width Width width width ≤ 32767

HeightHeightHeightheightheight (input_control)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of the virtual output image.

Default: 512

Suggested values: 240, 256, 480, 512, 600, 1024

Value range: 2 ≤ Height Height Height height height ≤ 32767

InterpolationInterpolationInterpolationinterpolationinterpolation (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Interpolation method for the transformation.

Default: 'nearest_neighbor' "nearest_neighbor" "nearest_neighbor" "nearest_neighbor" "nearest_neighbor"

List of values: 'bilinear'"bilinear""bilinear""bilinear""bilinear", 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor"

See also

polar_trans_image_extpolar_trans_image_extPolarTransImageExtPolarTransImageExtpolar_trans_image_ext, polar_trans_image_invpolar_trans_image_invPolarTransImageInvPolarTransImageInvpolar_trans_image_inv, polar_trans_region_invpolar_trans_region_invPolarTransRegionInvPolarTransRegionInvpolar_trans_region_inv, polar_trans_contour_xldpolar_trans_contour_xldPolarTransContourXldPolarTransContourXldpolar_trans_contour_xld, polar_trans_contour_xld_invpolar_trans_contour_xld_invPolarTransContourXldInvPolarTransContourXldInvpolar_trans_contour_xld_inv

Module

Foundation