代码拉取完成,页面将自动刷新
<?xml version="1.0" encoding="UTF-8"?>
<hdevelop file_version="1.2" halcon_version="20.11.1.0">
<procedure name="main">
<interface/>
<body>
<l>gen_rectangle1 (ROI_0, -1032.77, -1599.46, 944.863, 273.265)</l>
<l>gen_rectangle1 (TMP_Region, 400, -680.547, 1200, 1250.34)</l>
<l>union2 (ROI_0, TMP_Region, ROI_0)</l>
<l>gen_rectangle1 (TMP_Region, 200, -680.547, 300, 1250.34)</l>
<l>union2 (ROI_0, TMP_Region, ROI_0)</l>
<c></c>
<l>smallest_rectangle1 (ROI_0,\
Row1, Column1, Row2, Column2)</l>
<c></c>
<l>Column_Center:=\
real(Column1+Column2)/2.0</l>
<c></c>
<l>Row_Center:=\
real(Row1+Row2)/2.0</l>
<l>stop ()</l>
<c></c>
<c>* 1:上下</c>
<c>* 2:左右</c>
<c>* 3:上下左右</c>
<c></c>
<c></c>
<c>* 当前操作</c>
<l>nFlip:= 0</l>
<l>nRotate:= 1</l>
<c></c>
<l>GenMirrorRotateHom2d (Row_Center,\
Column_Center, \
nFlip, nRotate,\
HomMat2D1)</l>
<c></c>
<c>* 对区域仿射变换</c>
<l>affine_trans_region (ROI_0, \
RegionAffineTrans, \
HomMat2D1, \
'nearest_neighbor')</l>
<c></c>
<l>GenMirrorRotateHom2d (Row_Center,\
Column_Center, \
0, 2,\
HomMat2D2)</l>
<c></c>
<c>* 对区域仿射变换-------对原图直接操作的效果图</c>
<l>affine_trans_region (ROI_0, \
RegionAffineTrans2, \
HomMat2D2, \
'nearest_neighbor')</l>
<c></c>
<c></c>
<c>* 原来的矩阵 HomMat2D1</c>
<c>* 操作的矩阵 HomMat2D2</c>
<c>* 保存矩阵的逆 InverseMatrix</c>
<c>* 操作矩阵 </c>
<l>hom_mat2d_identity (InverseMatrix)</l>
<c></c>
<c>* 矩阵求逆</c>
<l>hom_mat2d_invert (HomMat2D1, HomMat2D1_Invert)</l>
<l>hom_mat2d_compose (HomMat2D1_Invert, InverseMatrix, InverseMatrix)</l>
<c></c>
<c>* 操作矩阵</c>
<l>hom_mat2d_compose (HomMat2D2, InverseMatrix, HomMat2DWork)</l>
<c></c>
<c>* 对区域仿射变换----------对变换后的图像进行操作</c>
<l>affine_trans_region (RegionAffineTrans, \
RegionAffineTrans3, \
HomMat2DWork, \
'nearest_neighbor')</l>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
<c></c>
</body>
<docu id="main">
<parameters/>
</docu>
</procedure>
<procedure name="GenMirrorRotateHom2d">
<interface>
<ic>
<par name="Row_Center" base_type="ctrl" dimension="0"/>
<par name="Column_Center" base_type="ctrl" dimension="0"/>
<par name="nFlip" base_type="ctrl" dimension="0"/>
<par name="nRotate" base_type="ctrl" dimension="0"/>
</ic>
<oc>
<par name="HomMat2DMirrorRotate" base_type="ctrl" dimension="0"/>
</oc>
</interface>
<body>
<l>hom_mat2d_identity (HomMat2DIdentity)</l>
<c>* 平移矩阵</c>
<l>hom_mat2d_translate (HomMat2DIdentity, \
-Row_Center,-Column_Center, \
HomMat2DTranslate)</l>
<c></c>
<c>* 缩放矩阵(镜像)</c>
<l>if (nFlip == 1)</l>
<l> hom_mat2d_scale(HomMat2DTranslate,\
-1, 1, 0, 0,HomMat2DMirror) </l>
<l>elseif (nFlip == 2)</l>
<l> hom_mat2d_scale(HomMat2DTranslate,\
1, -1, 0, 0,HomMat2DMirror) </l>
<l>elseif(nFlip == 3)</l>
<l> hom_mat2d_scale(HomMat2DTranslate,\
-1, -1, 0, 0,HomMat2DMirror)</l>
<l>else</l>
<l> hom_mat2d_scale(HomMat2DTranslate,\
1, 1, 0, 0,HomMat2DMirror)</l>
<l>endif</l>
<c></c>
<c>* 旋转矩阵</c>
<l>hom_mat2d_rotate (HomMat2DMirror, \
-rad(nRotate*90.0), \
0, 0, HomMat2DRotate)</l>
<c>* 再平移回来</c>
<l>hom_mat2d_translate(HomMat2DRotate, \
Row_Center,\
Column_Center, HomMat2DMirrorRotate)</l>
<l>return ()</l>
</body>
<docu id="GenMirrorRotateHom2d">
<parameters>
<parameter id="Column_Center"/>
<parameter id="HomMat2DMirrorRotate"/>
<parameter id="Row_Center"/>
<parameter id="nFlip"/>
<parameter id="nRotate"/>
</parameters>
</docu>
</procedure>
<procedure name="GenMirrorRotateHom2dSubpixel">
<interface>
<ic>
<par name="Row_Center" base_type="ctrl" dimension="0"/>
<par name="Column_Center" base_type="ctrl" dimension="0"/>
<par name="nFlip" base_type="ctrl" dimension="0"/>
<par name="nRotate" base_type="ctrl" dimension="0"/>
</ic>
<oc>
<par name="HomMat2DMirrorRotate" base_type="ctrl" dimension="0"/>
</oc>
</interface>
<body>
<c></c>
<l>dAngle:=nRotate*90.0</l>
<c></c>
<l>hom_mat2d_identity (HomMat2DIdentity)</l>
<l>hom_mat2d_translate (HomMat2DIdentity, \
-Row_Center-0.5,-Column_Center-0.5, \
HomMat2DTranslate)</l>
<c></c>
<l>if (nFlip == 1)</l>
<l> hom_mat2d_scale(HomMat2DTranslate,\
-1, 1, 0, 0,HomMat2DMirror) </l>
<l>elseif (nFlip == 2)</l>
<l> hom_mat2d_scale(HomMat2DTranslate,\
1, -1, 0, 0,HomMat2DMirror) </l>
<l>elseif(nFlip == 3)</l>
<l> hom_mat2d_scale(HomMat2DTranslate,\
-1, -1, 0, 0,HomMat2DMirror)</l>
<l>else</l>
<l> hom_mat2d_scale(HomMat2DTranslate,\
1, 1, 0, 0,HomMat2DMirror)</l>
<l>endif</l>
<c></c>
<c>* 旋转矩阵</c>
<l>hom_mat2d_rotate (HomMat2DMirror, \
-rad(dAngle),0,0, \
HomMat2DRotate)</l>
<c>* 平移矩阵</c>
<l>hom_mat2d_translate(HomMat2DRotate, \
Row_Center,\
Column_Center, HomMat2DMirrorRotate)</l>
<c></c>
<l>if (dAngle != int(dAngle)\
or int(dAngle)%180 == 0)</l>
<l> hom_mat2d_translate_local (HomMat2DMirrorRotate, \
0.5,0.5, \
HomMat2DMirrorRotate)</l>
<l>endif</l>
<l>return ()</l>
</body>
<docu id="GenMirrorRotateHom2dSubpixel">
<parameters>
<parameter id="Column_Center"/>
<parameter id="HomMat2DMirrorRotate"/>
<parameter id="Row_Center"/>
<parameter id="nFlip"/>
<parameter id="nRotate"/>
</parameters>
</docu>
</procedure>
</hdevelop>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。