模板匹配(基于形状分析)


例程:variation_model_illumination.hdev

* This example demonstrates the print inspection using
* a variation model. The variation model is trained
* using a single model image. Before applying the print inspection,
* the images are scaled to the same gray value range like the model.
* 
dev_update_off ()
dev_close_window ()
* 
* Read model image and init visualization
read_image (ModelImage, 'cap_illumination/cap_illumination_01')
get_image_size (ModelImage, Width, Height)
dev_open_window (0, 0, Width/2, Height/2, 'black', WindowHandle)
set_display_font (WindowHandle, 12, 'courier', 'true', 'false')
* 
* Segment model region
dev_display (ModelImage)
* 取模型区域(区域,裁减的区域图片)
get_model_region (ModelImage, RegionROI, ImageReduced) 
* 取面积中心
area_center (RegionROI, Area, RowModel, ColumnModel)
dev_set_draw ('margin')
dev_set_color ('green')
dev_display (RegionROI)
* 
* Create model for shape-based-matching
disp_message (WindowHandle, 'Model generation...', 'window', 5, 10, 'green', 'false')
* 创建形状模型
create_scaled_shape_model (ImageReduced, 'auto', 0, rad(360), 'auto', 0.8, 1.2, 'auto', 'auto', 'use_polarity', 'auto', 'auto', ModelID)
* 取形状模型的轮廓
get_shape_model_contours (ModelContours, ModelID, 1)
* Transform model contours from the original position for visualization
* 构建二维变换同样的同质变换矩阵
hom_mat2d_identity (HomMat2DIdentity)
* 为一个同质二维变换矩阵添加一个转化
hom_mat2d_translate (HomMat2DIdentity, RowModel, ColumnModel, HomMat2DTranslate)
* 对XLD轮廓(contour)进行一个任意二维仿射变换。
affine_trans_contour_xld (ModelContours, ModelContoursAffinTrans, HomMat2DTr
  • 4
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值