将模板写入文件

* Writing a template to file

dev_close_window ()
read_image (For6, 'for6')
get_image_size (For6, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowID)
fill_interlace (For6, ImageFilled, 'odd')

*操作符fill_interlace计算插入的完整图像或从由两个半图像组成的视频图像中删除奇数/偶数行。

* gen_rectangle1 (Rectangle, 266, 390, 348, 435)
gen_rectangle1 (Rectangle, 78, 292, 129, 402)
* gen_rectangle1 (Rectangle, 258, 214, 296, 258)
area_center (Rectangle, Area, Row, Column)
reduce_domain (ImageFilled, Rectangle, ImageReduced)
pi := acos(0.0) * 2
* Preparing a pattern for template matching with rotation
create_template_rot (ImageReduced, 4, -pi, 2 * pi, pi / 16, 'sort', 'original', TemplateID)

*操作符create_template_rot对一个模式进行预处理,该模式作为图像传递,用于模板匹配。匹配的create_template扩展可以应用*于旋转模式。AngleStart和AngleExtend参数定义模式的最大旋转:AngleStart指定逆时针旋转的最大值,并将相对于这个角度的  *最大顺时针旋转的最大值展开。因此,角度扩展必须小于。通过参数AngleStep,可以指定最大角度分辨率(在最高分辨率级别   *上)

write_template (TemplateID, 'testt')

*将模板写入指定文件‘testt’(可以为C:/Users/Desktop/ee.shm)

* Deallocation of the memory of a template
clear_template (TemplateID)

操作符clear_template释放由create_template或create_template_rot创建的模板的内存。在执行操作符clear_template之后,就不能再使用该模板了

* Reading saved template from file
read_template ('testt', TemplateID)

*操作符read_template从用write_template编写的文件中读取匹配的模板。

dev_set_color ('red')
for Phi := -180 to 180 by 5
    hom_mat2d_identity (HomMat2DIdentity)

   *hom_mat2d_identity生成描述相同二维变换的齐次变换矩阵HomMat2DIdentity    

    hom_mat2d_rotate (HomMat2DIdentity, rad(Phi), 256, 256, HomMat2DRotate)

*hom_mat2d_rotate会以角度rad(Phi)向齐次二维变换矩阵HomMat2D添加一个旋转,并返回结果矩阵HomMat2DRotate。旋转是*由一个2×2描述旋转矩阵r是相对全球(即执行、固定)坐标系统,点(Px,Py)是变换的不动点
    * Apply an arbitrary affine transformation to the image
    affine_trans_image (ImageFilled, ImageAffinTrans, HomMat2DRotate, 'constant', 'false')

*affine_trans_image应用任意仿射二维变换,即、缩放、旋转、平移和倾斜(倾斜),到图像中给定的图像,返回ImageAffinTrans *中转换的图像。
*     add_noise_white (ImageAffinTrans, ImageAffinTrans, 30)
    * Searching the best matching of a template and a pyramid with rotation
    best_match_rot_mg (ImageAffinTrans, TemplateID, -pi, 2 * pi, 40, 'true', 4, Row, Column, Angle, Error)

*操作符best_match_rot_mg执行模板类和图像的匹配。它的工作原理类似于best_match_mg,它的扩展是模式可以类似地旋转到 *best_match_rot。-pi模式的最小旋转。2 * pi角度起始的最大正扩张。40灰度值的最大平均差。 'true'亚像素精度为“真”,4使用的*分辨率级别的数量。


    disp_arrow (WindowID, Row, Column, Row - cos(Angle) * 50, Column - sin(Angle) * 50, 1)

*在输出窗口中显示一个或几个箭头。箭头由开始(Row1,Column1)和结束(Row2,Column2)的坐标表示。箭头显示在箭头的末端。*箭头的大小由参数大小指定。


    AngleDeg := deg(Angle)

*赋值将一个新值赋给一个变量。
    DiffAngle := abs(AngleDeg - Phi)
endfor
clear_template (TemplateID)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值