projective_trans_image T_projective_trans_image ProjectiveTransImage ProjectiveTransImage projective_trans_image (算子)
名称
projective_trans_image T_projective_trans_image ProjectiveTransImage ProjectiveTransImage projective_trans_image — 对图像应用投影变换。
签名
void ProjectiveTransImage (const HObject& Image , HObject* TransImage , const HTuple& HomMat2D , const HTuple& Interpolation , const HTuple& AdaptImageSize , const HTuple& TransformDomain )
HImage HImage ::ProjectiveTransImage (const HHomMat2D& HomMat2D , const HString& Interpolation , const HString& AdaptImageSize , const HString& TransformDomain ) const
HImage HImage ::ProjectiveTransImage (const HHomMat2D& HomMat2D , const char* Interpolation , const char* AdaptImageSize , const char* TransformDomain ) const
HImage HImage ::ProjectiveTransImage (const HHomMat2D& HomMat2D , const wchar_t* Interpolation , const wchar_t* AdaptImageSize , const wchar_t* TransformDomain ) const
(
Windows only)
HImage HHomMat2D ::ProjectiveTransImage (const HImage& Image , const HString& Interpolation , const HString& AdaptImageSize , const HString& TransformDomain ) const
HImage HHomMat2D ::ProjectiveTransImage (const HImage& Image , const char* Interpolation , const char* AdaptImageSize , const char* TransformDomain ) const
HImage HHomMat2D ::ProjectiveTransImage (const HImage& Image , const wchar_t* Interpolation , const wchar_t* AdaptImageSize , const wchar_t* TransformDomain ) const
(
Windows only)
static void HOperatorSet .ProjectiveTransImage (HObject image , out HObject transImage , HTuple homMat2D , HTuple interpolation , HTuple adaptImageSize , HTuple transformDomain )
HImage HImage .ProjectiveTransImage (HHomMat2D homMat2D , string interpolation , string adaptImageSize , string transformDomain )
HImage HHomMat2D .ProjectiveTransImage (HImage image , string interpolation , string adaptImageSize , string transformDomain )
描述
projective_trans_image projective_trans_image ProjectiveTransImage ProjectiveTransImage ProjectiveTransImage projective_trans_image applies the projective transformation
(homography) determined by the homogeneous transformation matrix
HomMat2D HomMat2D HomMat2D HomMat2D homMat2D hom_mat_2d on the input image Image Image Image Image image image and stores the
result into the output image TransImage TransImage TransImage TransImage transImage trans_image 。
If the parameter AdaptImageSize AdaptImageSize AdaptImageSize AdaptImageSize adaptImageSize adapt_image_size is set to
'false' "false" "false" "false" "false" "false" , TransImage TransImage TransImage TransImage transImage trans_image will have the same size as
Image Image Image Image image image ; if AdaptImageSize AdaptImageSize AdaptImageSize AdaptImageSize adaptImageSize adapt_image_size is 'true' "true" "true" "true" "true" "true" , the
output image size will be automatically adapted so that all
non-negative points of the transformed image are visible.
The parameter Interpolation Interpolation Interpolation Interpolation interpolation interpolation determines, which interpolation
method is used to determine the gray values of the output image.
For Interpolation Interpolation Interpolation Interpolation interpolation interpolation = 'nearest_neighbor' "nearest_neighbor" "nearest_neighbor" "nearest_neighbor" "nearest_neighbor" "nearest_neighbor" , the gray
value is determined from the nearest pixel in the input image. This
mode is very fast, but also leads to the typical “jagged”
appearance for large enlargements of the image. For
Interpolation Interpolation Interpolation Interpolation interpolation interpolation = 'bilinear' "bilinear" "bilinear" "bilinear" "bilinear" "bilinear" , the gray values are
interpolated bilinearly, leading to longer runtimes, but also to
significantly improved results.
The parameter TransformDomain TransformDomain TransformDomain TransformDomain transformDomain transform_domain can be used to determine
whether the domain of Image Image Image Image image image is also transformed. Since the
transformation of the domain costs runtime, this parameter should be
used to specify whether this is desired or not. If
TransformDomain TransformDomain TransformDomain TransformDomain transformDomain transform_domain is set to 'false' "false" "false" "false" "false" "false" the domain of
the input image is ignored and the complete image is transformed.
The projective transformation matrix could for example be created
using the operator vector_to_proj_hom_mat2d vector_to_proj_hom_mat2d VectorToProjHomMat2d VectorToProjHomMat2d VectorToProjHomMat2d vector_to_proj_hom_mat2d 。
In a homography the points to be projected are represented by
homogeneous vectors of the form (x,y,w). A Euclidean point can be
derived as (x',y') =
。
Just like in affine_trans_image affine_trans_image AffineTransImage AffineTransImage AffineTransImage affine_trans_image , x represents the row
coordinate while y represents the column coordinate in
projective_trans_image projective_trans_image ProjectiveTransImage ProjectiveTransImage ProjectiveTransImage projective_trans_image . With this convention, affine
transformations are a special case of projective transformations in
which the last row of HomMat2D HomMat2D HomMat2D HomMat2D homMat2D hom_mat_2d is of the form (0,0,c).
For images of type 'byte' "byte" "byte" "byte" "byte" "byte" or 'uint2' "uint2" "uint2" "uint2" "uint2" "uint2" the system
parameter 'int_zooming' "int_zooming" "int_zooming" "int_zooming" "int_zooming" "int_zooming" selects between fast calculation in
floating point arithmetics ('int_zooming' "int_zooming" "int_zooming" "int_zooming" "int_zooming" "int_zooming" = 'true' "true" "true" "true" "true" "true" )
and highly accurate floating point arithmetics
('int_zooming' "int_zooming" "int_zooming" "int_zooming" "int_zooming" "int_zooming" = 'false' "false" "false" "false" "false" "false" ). Especially for
Interpolation Interpolation Interpolation Interpolation interpolation interpolation = 'bilinear' "bilinear" "bilinear" "bilinear" "bilinear" "bilinear" , however, the faster
calculation can lead to minor gray value deviations since the
faster algorithm is less accurate and only has an accuracy around
times the size of the image. Therefore, when
applying large scales 'int_zooming' "int_zooming" "int_zooming" "int_zooming" "int_zooming" "int_zooming" = 'false' "false" "false" "false" "false" "false"
is recommended.
注意
The used coordinate system is the same as in
affine_trans_pixel affine_trans_pixel AffineTransPixel AffineTransPixel AffineTransPixel affine_trans_pixel 。This means that in fact not
HomMat2D HomMat2D HomMat2D HomMat2D homMat2D hom_mat_2d is applied but a modified version. Therefore,
applying projective_trans_image projective_trans_image ProjectiveTransImage ProjectiveTransImage ProjectiveTransImage projective_trans_image corresponds to the following
chain of transformations, which is applied to each point
of the image (input and output
pixels as homogeneous vectors):
As an effect, you might get unexpected results when creating projective
transformations based on coordinates that are derived from the
image, e.g., by operators like area_center_gray area_center_gray AreaCenterGray AreaCenterGray AreaCenterGray area_center_gray 。For
example, if you use this operator to calculate the center of gravity
of a rotationally symmetric image and then rotate the image around
this point using hom_mat2d_rotate hom_mat2d_rotate HomMat2dRotate HomMat2dRotate HomMat2dRotate hom_mat2d_rotate , the resulting image will
not lie on the original one. In such a case, you can compensate this
effect by applying the following translations to HomMat2D HomMat2D HomMat2D HomMat2D homMat2D hom_mat_2d
before using it in projective_trans_image projective_trans_image ProjectiveTransImage ProjectiveTransImage ProjectiveTransImage projective_trans_image :
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_image(Image, TransImage, HomMat2DAdapted, 'bilinear', 'false', 'false') projective_trans_image(Image, TransImage, HomMat2DAdapted, "bilinear", "false", "false") ProjectiveTransImage(Image, TransImage, HomMat2DAdapted, "bilinear", "false", "false") ProjectiveTransImage(Image, TransImage, HomMat2DAdapted, "bilinear", "false", "false") ProjectiveTransImage(Image, TransImage, HomMat2DAdapted, "bilinear", "false", "false") projective_trans_image(Image, TransImage, HomMat2DAdapted, "bilinear", "false", "false")
有关 HALCON 中使用的不同二维坐标系的说明,请参阅 变换 / 二维变换 一章的引言。
projective_trans_image projective_trans_image ProjectiveTransImage ProjectiveTransImage ProjectiveTransImage projective_trans_image can be executed on OpenCL devices if the input
image does not exceed the maximum size of image objects of the selected
device and the parameter TransformDomain TransformDomain TransformDomain TransformDomain transformDomain transform_domain is set to
'false' "false" "false" "false" "false" "false" . The result can diverge slightly from that calculated on
the CPU.
执行信息
支持 OpenCL 计算设备。
多线程类型:可重入(与非独占算子并行运行)。
多线程作用域:全局(可从任何线程调用)。
在元组级别上自动并行化。
在通道级别上自动并行化。
在内部数据级别上自动并行化。
参数
Image Image Image Image image image (输入对象) (multichannel-)image(-array) → object HImage HObject HImage Hobject (byte* / uint2* / real*) *允许用于计算设备
输入图像。
TransImage TransImage TransImage TransImage transImage trans_image (输出对象) (multichannel-)image(-array) → object HImage HObject HImage Hobject * (byte / uint2 / real)
输出图像。
HomMat2D HomMat2D HomMat2D HomMat2D homMat2D hom_mat_2d (输入控制) hom_mat2d → HHomMat2D , HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Homogeneous projective transformation matrix.
Interpolation Interpolation Interpolation Interpolation interpolation interpolation (输入控制) string → HTuple str HTuple Htuple (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"
AdaptImageSize AdaptImageSize AdaptImageSize AdaptImageSize adaptImageSize adapt_image_size (输入控制) string → HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
Adapt the size of the output image automatically?
默认值:
'false'
"false"
"false"
"false"
"false"
"false"
值列表:
'false' "false" "false" "false" "false" "false" , 'true' "true" "true" "true" "true" "true"
TransformDomain TransformDomain TransformDomain TransformDomain transformDomain transform_domain (输入控制) string → HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
Should the domain of the input image also be
transformed?
默认值:
'false'
"false"
"false"
"false"
"false"
"false"
值列表:
'false' "false" "false" "false" "false" "false" , 'true' "true" "true" "true" "true" "true"
List of values (for compute devices):
'false' "false" "false" "false" "false" "false"
可能的前趋
vector_to_proj_hom_mat2d vector_to_proj_hom_mat2d VectorToProjHomMat2d VectorToProjHomMat2d VectorToProjHomMat2d vector_to_proj_hom_mat2d ,
hom_vector_to_proj_hom_mat2d hom_vector_to_proj_hom_mat2d HomVectorToProjHomMat2d HomVectorToProjHomMat2d HomVectorToProjHomMat2d hom_vector_to_proj_hom_mat2d ,
proj_match_points_ransac proj_match_points_ransac ProjMatchPointsRansac ProjMatchPointsRansac ProjMatchPointsRansac proj_match_points_ransac ,
proj_match_points_ransac_guided proj_match_points_ransac_guided ProjMatchPointsRansacGuided ProjMatchPointsRansacGuided ProjMatchPointsRansacGuided proj_match_points_ransac_guided ,
hom_mat3d_project hom_mat3d_project HomMat3dProject HomMat3dProject HomMat3dProject hom_mat3d_project
另见
projective_trans_image_size projective_trans_image_size ProjectiveTransImageSize ProjectiveTransImageSize ProjectiveTransImageSize projective_trans_image_size ,
projective_trans_contour_xld projective_trans_contour_xld ProjectiveTransContourXld ProjectiveTransContourXld ProjectiveTransContourXld projective_trans_contour_xld ,
projective_trans_region projective_trans_region ProjectiveTransRegion ProjectiveTransRegion ProjectiveTransRegion projective_trans_region ,
projective_trans_point_2d projective_trans_point_2d ProjectiveTransPoint2d ProjectiveTransPoint2d ProjectiveTransPoint2d projective_trans_point_2d ,
projective_trans_pixel projective_trans_pixel ProjectiveTransPixel ProjectiveTransPixel ProjectiveTransPixel projective_trans_pixel
模块
基础