Skip to content

polar_trans_regionpolar_trans_regionPolarTransRegionPolarTransRegionpolar_trans_regionpolar_trans_regionπŸ”—

Short descriptionπŸ”—

polar_trans_regionpolar_trans_regionPolarTransRegionPolarTransRegionpolar_trans_regionpolar_trans_region β€” Transform a region within an annular arc to polar coordinates.

SignatureπŸ”—

polar_trans_region( region Region, out region PolarTransRegion, number Row, number Column, angle.rad AngleStart, angle.rad AngleEnd, number RadiusStart, number RadiusEnd, extent.x Width, extent.y Height, string Interpolation )polar_trans_region( Region : PolarTransRegion : Row, Column, AngleStart, AngleEnd, RadiusStart, RadiusEnd, Width, Height, 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 )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 )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

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 )

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)

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 )

DescriptionπŸ”—

polar_trans_regionPolarTransRegion transforms a Regionregionregion within the annular arc specified by the center point (Rowrowrow, Columncolumncolumn), the radii RadiusStartradiusStartradius_start and RadiusEndradiusEndradius_end and the angles AngleStartangleStartangle_start and AngleEndangleEndangle_end to its polar coordinate version in a virtual image of the dimensions Widthwidthwidth x Heightheightheight.

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 Rowrowrow, Columncolumncolumn) 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 RadiusStartradiusStartradius_start and AngleStartangleStartangle_start. Analogously, the coordinate \((\textrm{Height}-1, \textrm{Width}-1)\) corresponds to the point in the input region that is specified by RadiusEndradiusEndradius_end and AngleEndangleEndangle_end. In the usual mode (AngleStartangleStartangle_start \(<\) AngleEndangleEndangle_end and RadiusStartradiusStartradius_start \(<\) RadiusEndradiusEndradius_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., AngleStartangleStartangle_start \(>\) AngleEndangleEndangle_end or RadiusStartradiusStartradius_start \(>\) RadiusEndradiusEndradius_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 RadiusEndradiusEndradius_end and RadiusStartradiusStartradius_start equals \(\textrm{Height}-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 RadiusStartradiusStartradius_start and the last row contains the circle with radius RadiusEndradiusEndradius_end. For complete circles, where the difference between AngleStartangleStartangle_start and AngleEndangleEndangle_end equals \(2 \pi\) (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 \(2 \pi\), but \(2 \pi (1 - \frac{1}{\textrm{Width}})\) degrees instead.

The parameter Interpolationinterpolationinterpolation is used to select the interpolation method 'bilinear'"bilinear" or 'nearest_neighbor'"nearest_neighbor". Setting Interpolationinterpolationinterpolation to '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 Regionregionregion, their polar transformations are computed individually and stored as a tuple in PolarTransRegionpolarTransRegionpolar_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" is set to 'true'"true" (see set_systemSetSystem). Otherwise empty output regions are discarded and the length of the input tuple Regionregionregion is most likely not equal to the length of the output tuple PolarTransRegionpolarTransRegionpolar_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 Widthwidthwidth or Heightheightheight are chosen greater than the dimensions of the current image, the system variable 'clip_region'"clip_region" should be set to 'false'"false" (see set_systemSetSystem). Otherwise, an output region that does not lie within the dimensions of the current image can produce an error message.

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.

  • Automatically parallelized on internal data level.

ParametersπŸ”—

Regionregionregion (input_object) region(-array) β†’ objectobjectHObjectHRegionHObjectHobject

Input region.

PolarTransRegionpolarTransRegionpolar_trans_region (output_object) region(-array) β†’ objectobjectHObjectHRegionHObjectHobject *

Output region.

Rowrowrow (input_control) number β†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Row coordinate of the center of the arc.

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

Columncolumncolumn (input_control) number β†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Column coordinate of the center of the arc.

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

AngleStartangleStartangle_start (input_control) angle.rad β†’ (real)(real)HTuple (double)HTuple (double)floatHtuple (double)

Angle of the ray to be mapped to column coordinate 00 of PolarTransRegionpolarTransRegionpolar_trans_region.

Default: 0.00.0
Suggested values: 0.0, 0.78539816, 1.57079632, 3.141592654, 6.2831853, 12.5663706160.0, 0.78539816, 1.57079632, 3.141592654, 6.2831853, 12.566370616
Value range: -6.2831853 ≀ AngleStart ≀ 6.2831853

AngleEndangleEndangle_end (input_control) angle.rad β†’ (real)(real)HTuple (double)HTuple (double)floatHtuple (double)

Angle of the ray to be mapped to column coordinate \(\textrm{Width}-1\) of PolarTransRegionpolarTransRegionpolar_trans_region.

Default: 6.28318536.2831853
Suggested values: 0.0, 0.78539816, 1.57079632, 3.141592654, 6.2831853, 12.5663706160.0, 0.78539816, 1.57079632, 3.141592654, 6.2831853, 12.566370616
Value range: -6.2831853 ≀ AngleEnd ≀ 6.2831853

RadiusStartradiusStartradius_start (input_control) number β†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Radius of the circle to be mapped to row coordinate 00 of PolarTransRegionpolarTransRegionpolar_trans_region.

Default: 00
Suggested values: 0, 16, 32, 64, 100, 128, 256, 5120, 16, 32, 64, 100, 128, 256, 512
Value range: 0 ≀ RadiusStart ≀ 32767

RadiusEndradiusEndradius_end (input_control) number β†’ (real / integer)(real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Radius of the circle to be mapped to row coordinate \(\textrm{Height}-1\) of PolarTransRegionpolarTransRegionpolar_trans_region.

Default: 100100
Suggested values: 0, 16, 32, 64, 100, 128, 256, 5120, 16, 32, 64, 100, 128, 256, 512
Value range: 0 ≀ RadiusEnd ≀ 32767

Widthwidthwidth (input_control) extent.x β†’ (integer)(integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of the virtual output image.

Default: 512512
Suggested values: 256, 320, 512, 640, 800, 1024256, 320, 512, 640, 800, 1024
Value range: 2 ≀ Width ≀ 32767

Heightheightheight (input_control) extent.y β†’ (integer)(integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of the virtual output image.

Default: 512512
Suggested values: 240, 256, 480, 512, 600, 1024240, 256, 480, 512, 600, 1024
Value range: 2 ≀ Height ≀ 32767

Interpolationinterpolationinterpolation (input_control) string β†’ (string)(string)HTuple (HString)HTuple (string)strHtuple (char*)

Interpolation method for the transformation.

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

Combinations with other operatorsπŸ”—

Combinations

See also

polar_trans_image_extPolarTransImageExt, polar_trans_image_invPolarTransImageInv, polar_trans_region_invPolarTransRegionInv, polar_trans_contour_xldPolarTransContourXld, polar_trans_contour_xld_invPolarTransContourXldInv

ModuleπŸ”—

Foundation