projective_trans_regionT_projective_trans_regionProjectiveTransRegionProjectiveTransRegionprojective_trans_region (算子)

名称

projective_trans_regionT_projective_trans_regionProjectiveTransRegionProjectiveTransRegionprojective_trans_region — 对区域应用投影变换。

签名

projective_trans_region(Regions : TransRegions : HomMat2D, Interpolation : )

Herror T_projective_trans_region(const Hobject Regions, Hobject* TransRegions, const Htuple HomMat2D, const Htuple Interpolation)

void ProjectiveTransRegion(const HObject& Regions, HObject* TransRegions, const HTuple& HomMat2D, const HTuple& Interpolation)

HRegion HRegion::ProjectiveTransRegion(const HHomMat2D& HomMat2D, const HString& Interpolation) const

HRegion HRegion::ProjectiveTransRegion(const HHomMat2D& HomMat2D, const char* Interpolation) const

HRegion HRegion::ProjectiveTransRegion(const HHomMat2D& HomMat2D, const wchar_t* Interpolation) const   ( Windows only)

HRegion HHomMat2D::ProjectiveTransRegion(const HRegion& Regions, const HString& Interpolation) const

HRegion HHomMat2D::ProjectiveTransRegion(const HRegion& Regions, const char* Interpolation) const

HRegion HHomMat2D::ProjectiveTransRegion(const HRegion& Regions, const wchar_t* Interpolation) const   ( Windows only)

static void HOperatorSet.ProjectiveTransRegion(HObject regions, out HObject transRegions, HTuple homMat2D, HTuple interpolation)

HRegion HRegion.ProjectiveTransRegion(HHomMat2D homMat2D, string interpolation)

HRegion HHomMat2D.ProjectiveTransRegion(HRegion regions, string interpolation)

def projective_trans_region(regions: HObject, hom_mat_2d: Sequence[float], interpolation: str) -> HObject

描述

projective_trans_regionprojective_trans_regionProjectiveTransRegionProjectiveTransRegionProjectiveTransRegionprojective_trans_region applies the projective transformation specified by the homogeneous matrix HomMat2DHomMat2DHomMat2DHomMat2DhomMat2Dhom_mat_2d on the regions in RegionsRegionsRegionsRegionsregionsregions and returns the transformed regions in TransRegionsTransRegionsTransRegionsTransRegionstransRegionstrans_regions

For creation and interpretation details of this matrix see also projective_trans_imageprojective_trans_imageProjectiveTransImageProjectiveTransImageProjectiveTransImageprojective_trans_image

If 'clip_region'"clip_region""clip_region""clip_region""clip_region""clip_region" is set to its default value 'true'"true""true""true""true""true" by set_system('clip_region', 'true')set_system("clip_region", "true")SetSystem("clip_region", "true")SetSystem("clip_region", "true")SetSystem("clip_region", "true")set_system("clip_region", "true") or if the transformation is degenerated and thus produces infinite regions, the output region is clipped by the rectangle with upper left corner (0, 0) and lower right corner ('width'"width""width""width""width""width", 'height'"height""height""height""height""height"), where 'width'"width""width""width""width""width" and 'height'"height""height""height""height""height" are system variables (see also get_systemget_systemGetSystemGetSystemGetSystemget_system). If 'clip_region'"clip_region""clip_region""clip_region""clip_region""clip_region" is 'false'"false""false""false""false""false", the output region is not clipped except by the maximum supported coordinate size 'MAX_FORMAT'"MAX_FORMAT""MAX_FORMAT""MAX_FORMAT""MAX_FORMAT""MAX_FORMAT". This may result in extremely memory and time intensive computations, so use with care.

注意

The used coordinate system is the same as in affine_trans_pixelaffine_trans_pixelAffineTransPixelAffineTransPixelAffineTransPixelaffine_trans_pixel。This means that in fact not HomMat2DHomMat2DHomMat2DHomMat2DhomMat2Dhom_mat_2d is applied but a modified version. Therefore, applying projective_trans_regionprojective_trans_regionProjectiveTransRegionProjectiveTransRegionProjectiveTransRegionprojective_trans_region corresponds to the following chain of transformations, which is applied to each point of the region (input and output pixels as homogeneous vectors):

因此,当基于区域派生的坐标(例如通过 area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center 等算子)创建投影变换时,可能会得到意外的结果。例如,若使用此算子计算旋转对称区域的重心,随后通过 hom_mat2d_rotatehom_mat2d_rotateHomMat2dRotateHomMat2dRotateHomMat2dRotatehom_mat2d_rotate 围绕该点旋转该区域,则旋转后的区域将不会位于原始区域之上。在这种情况下,您可以在将 HomMat2DHomMat2DHomMat2DHomMat2DhomMat2Dhom_mat_2d 用于 projective_trans_regionprojective_trans_regionProjectiveTransRegionProjectiveTransRegionProjectiveTransRegionprojective_trans_region 之前,通过应用以下变换来补偿这种影响:
hom_mat2d_translate(HomMat2D, 0.5, 0.5, HomMat2DTmp)hom_mat2d_translate(HomMat2D, 0.5, 0.5, HomMat2DTmp)HomMat2dTranslate(HomMat2D, 0.5, 0.5, HomMat2DTmp)HomMat2dTranslate(HomMat2D, 0.5, 0.5, HomMat2DTmp)HomMat2dTranslate(HomMat2D, 0.5, 0.5, HomMat2DTmp)hom_mat2d_translate(HomMat2D, 0.5, 0.5, HomMat2DTmp)
hom_mat2d_translate_local(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)hom_mat2d_translate_local(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)HomMat2dTranslateLocal(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)HomMat2dTranslateLocal(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)HomMat2dTranslateLocal(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)hom_mat2d_translate_local(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)
projective_trans_region(Region, TransRegion, HomMat2DAdapted, 'bilinear')projective_trans_region(Region, TransRegion, HomMat2DAdapted, "bilinear")ProjectiveTransRegion(Region, TransRegion, HomMat2DAdapted, "bilinear")ProjectiveTransRegion(Region, TransRegion, HomMat2DAdapted, "bilinear")ProjectiveTransRegion(Region, TransRegion, HomMat2DAdapted, "bilinear")projective_trans_region(Region, TransRegion, HomMat2DAdapted, "bilinear")

有关 HALCON 中使用的不同二维坐标系的说明,请参阅 变换 / 二维变换 一章的引言。

执行信息

参数

RegionsRegionsRegionsRegionsregionsregions (输入对象)  region(-array) objectHRegionHObjectHRegionHobject

Input regions.

TransRegionsTransRegionsTransRegionsTransRegionstransRegionstrans_regions (输出对象)  region(-array) objectHRegionHObjectHRegionHobject *

Output regions.

HomMat2DHomMat2DHomMat2DHomMat2DhomMat2Dhom_mat_2d (输入控制)  hom_mat2d HHomMat2D, HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Homogeneous projective transformation matrix.

InterpolationInterpolationInterpolationInterpolationinterpolationinterpolation (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Interpolation method for the transformation.

默认值: 'bilinear' "bilinear" "bilinear" "bilinear" "bilinear" "bilinear"

值列表: 'bilinear'"bilinear""bilinear""bilinear""bilinear""bilinear", 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor"

可能的前趋

vector_to_proj_hom_mat2dvector_to_proj_hom_mat2dVectorToProjHomMat2dVectorToProjHomMat2dVectorToProjHomMat2dvector_to_proj_hom_mat2d, hom_vector_to_proj_hom_mat2dhom_vector_to_proj_hom_mat2dHomVectorToProjHomMat2dHomVectorToProjHomMat2dHomVectorToProjHomMat2dhom_vector_to_proj_hom_mat2d, proj_match_points_ransacproj_match_points_ransacProjMatchPointsRansacProjMatchPointsRansacProjMatchPointsRansacproj_match_points_ransac, proj_match_points_ransac_guidedproj_match_points_ransac_guidedProjMatchPointsRansacGuidedProjMatchPointsRansacGuidedProjMatchPointsRansacGuidedproj_match_points_ransac_guided, hom_mat3d_projecthom_mat3d_projectHomMat3dProjectHomMat3dProjectHomMat3dProjecthom_mat3d_project

另见

projective_trans_imageprojective_trans_imageProjectiveTransImageProjectiveTransImageProjectiveTransImageprojective_trans_image, projective_trans_image_sizeprojective_trans_image_sizeProjectiveTransImageSizeProjectiveTransImageSizeProjectiveTransImageSizeprojective_trans_image_size, projective_trans_contour_xldprojective_trans_contour_xldProjectiveTransContourXldProjectiveTransContourXldProjectiveTransContourXldprojective_trans_contour_xld, projective_trans_point_2dprojective_trans_point_2dProjectiveTransPoint2dProjectiveTransPoint2dProjectiveTransPoint2dprojective_trans_point_2d, projective_trans_pixelprojective_trans_pixelProjectiveTransPixelProjectiveTransPixelProjectiveTransPixelprojective_trans_pixel

模块

基础