vector_angle_to_rigidVectorAngleToRigidVectorAngleToRigidvector_angle_to_rigidT_vector_angle_to_rigid
説明
vector_angle_to_rigidVectorAngleToRigidVectorAngleToRigidvector_angle_to_rigidT_vector_angle_to_rigid — 点座標と角度から剛体アフィン変換を計算する。
書式
vector_angle_to_rigid( point.y Row1, point.x Column1, angle.rad Angle1, point.y Row2, point.x Column2, angle.rad Angle2, out hom_mat2d HomMat2D )void VectorAngleToRigid( const HTuple& Row1, const HTuple& Column1, const HTuple& Angle1, const HTuple& Row2, const HTuple& Column2, const HTuple& Angle2, HTuple* HomMat2D )static void HOperatorSet.VectorAngleToRigid( HTuple row1, HTuple column1, HTuple angle1, HTuple row2, HTuple column2, HTuple angle2, out HTuple homMat2D )def vector_angle_to_rigid( row_1: Union[float, int], column_1: Union[float, int], angle_1: Union[float, int], row_2: Union[float, int], column_2: Union[float, int], angle_2: Union[float, int] ) -> Sequence[float]
Herror T_vector_angle_to_rigid( const Htuple Row1, const Htuple Column1, const Htuple Angle1, const Htuple Row2, const Htuple Column2, const Htuple Angle2, Htuple* HomMat2D )
void HHomMat2D::VectorAngleToRigid( const HTuple& Row1, const HTuple& Column1, const HTuple& Angle1, const HTuple& Row2, const HTuple& Column2, const HTuple& Angle2 )
void HHomMat2D::VectorAngleToRigid( double Row1, double Column1, double Angle1, double Row2, double Column2, double Angle2 )
void HHomMat2D.VectorAngleToRigid( HTuple row1, HTuple column1, HTuple angle1, HTuple row2, HTuple column2, HTuple angle2 )
void HHomMat2D.VectorAngleToRigid( double row1, double column1, double angle1, double row2, double column2, double angle2 )
説明
vector_angle_to_rigidVectorAngleToRigid は点対応と 2 つの対応する角度から剛体アフィン
変換、すなわち、回転と平行移動からなる変換を計算し、同次変換行列
HomMat2DhomMat2Dhom_mat_2d として返します。行列は 2 つの成分から構成されます。
つまり回転行列 R と平行移動ベクトル
t です。(hom_mat2d_rotateHomMat2dRotate または
hom_mat2d_translateHomMat2dTranslate を参照):
\[\begin{eqnarray*}
\textrm{HomMat2D} =
\mvHomMatrixTwoDRotTrans{\mvRotationMatrixVar{}{}}
{\mvTranslationVectorVar{}{}} =
\mvHomMatrixTwoDRotTrans{\mvMatrixPlain{1 & 0 \\ 0 & 1}}
{\mvTranslationVectorVar{}{}} \cdot
\mvHomMatrixTwoDRotTrans{\mvRotationMatrixVar{}{}}
{\mvVectorTwoDPlain{0}{0}} =
\mvHomTranslationMatrixVar{}{} \cdot \mvHomRotationMatrixVar{}{}
\end{eqnarray*}\]
元の点の座標は (Row1row1row_1,Column1column1column_1) に渡し、対応する角度は
Angle1angle1angle_1 に渡します。変換後の座標は、(Row2row2row_2,Column2column2column_2)
に渡し、対応する角度は、Angle2 に渡します。変換された点の座標は
(Row2,Column2) に渡され、対応する角度は Angle2angle2angle_2 に渡されます。
以下の方程式が同次ベクトルを使用する点の変換を記述します:
\[\begin{eqnarray*}
\mvHomVectorTwoD{\textrm{Row2}}{\textrm{Column2}} =
\textrm{HomMat2D} \cdot \mvHomVectorTwoD{\textrm{Row1}}{\textrm{Column1}}
\end{eqnarray*}\]
特に、オペレーター vector_angle_to_rigidVectorAngleToRigidはパターンマッチング
オペレーター(find_ncc_modelFindNccModel)の結果から固定アフィン変換を
構成するために有用で、参照画像を現在の画像へ変換するか、もしくはパラ
メーターが逆の順で与えられた場合、現在の画像を参照画像へと変換します。
HomMat2DhomMat2Dhom_mat_2d はアフィン変換を使ってデータを変化するオペレーター、
例えば、affine_trans_imageAffineTransImage などに直接使用することができます。
実行情報
実行情報
パラメーター
Row1row1row_1 (input_control) point.y → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)
元の点の行座標
Column1column1column_1 (input_control) point.x → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)
元の点の列座標
Angle1angle1angle_1 (input_control) angle.rad → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)
元の点の角度
Row2row2row_2 (input_control) point.y → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)
変換後の点の行座標
Column2column2column_2 (input_control) point.x → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)
変換後の点の列座標
Angle2angle2angle_2 (input_control) angle.rad → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[float, int]Htuple (double / Hlong)
変換後の点の角度
HomMat2DhomMat2Dhom_mat_2d (output_control) hom_mat2d → (real)HTuple (double)HHomMat2D, HTuple (double)Sequence[float]Htuple (double)
出力される変換行列
例
(HDevelop)
read_image (Image, 'face_masks/face_mask_01')
* Prepare NCC matching.
gen_rectangle2 (ROI, 616.5, 708.5, rad(-82.4054), 50, 35)
reduce_domain (Image, ROI, ImageReduced)
create_ncc_model (ImageReduced, 'auto', rad(0), rad(360), 'auto',\
'use_polarity', ModelID)
read_image (SearchImage, 'face_masks/face_mask_02')
find_ncc_model (SearchImage, ModelID, rad(0), rad(360), 0.7, 1, 0.5,\
'true', 0, Row, Column, Angle, Score)
get_ncc_model_region (ModelRegion, ModelID)
gen_contour_region_xld (ModelRegion, ModelContours, 'border_holes')
* Create transformation matrix for found match.
vector_angle_to_rigid (0, 0, 0, Row, Column, Angle, HomMat2D)
affine_trans_contour_xld (ModelContours, ContoursAffineTrans, HomMat2D)
他のオペレーターとの組み合わせ
組み合わせ
前処理の候補
get_ncc_model_regionGetNccModelRegion
後処理の候補
hom_mat2d_invertHomMat2dInvert, affine_trans_imageAffineTransImage, affine_trans_regionAffineTransRegion, affine_trans_contour_xldAffineTransContourXld, affine_trans_polygon_xldAffineTransPolygonXld, affine_trans_point_2dAffineTransPoint2d
他の選択候補
vector_to_rigidVectorToRigid
関連項目
vector_field_to_hom_mat2dVectorFieldToHomMat2d
モジュール
Foundation