请选择 进入手机版 | 继续访问电脑版

Hello Mat

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 712|回复: 2

并行计算

[复制链接]

2

主题

2

帖子

18

积分

新手上路

Rank: 1

积分
18
发表于 2017-8-6 11:25:14 | 显示全部楼层 |阅读模式
并行计算-Halcon12.0-win32:
游客,如果您要查看本帖隐藏内容请回复

模板匹配模型:
  1. * 创建形变模型
  2. create_shape_model (Obj, 'auto', rad(-20), rad(20), 'auto', \
  3.                     'auto', 'use_polarity', 30, 10, ModelID)
  4. get_shape_model_contours (ModelXLD, ModelID, 1)
  5. * 显示 创建形变模型
  6. * area_center (Obj, Area, Row, Column)
  7. * hom_mat2d_identity (HomMat2DIdentity)
  8. * hom_mat2d_translate (HomMat2DIdentity, Row, Column, HomMat2DTranslate)
  9. * affine_trans_contour_xld (ModelXLD,ContoursAffinTrans, HomMat2DTranslate)
  10. * dev_set_line_width (2)
  11. * dev_set_color ('yellow')
  12. * dev_display (Obj)
  13. * dev_display (ContoursAffinTrans)

  14. * 在原图上查找匹配模板
  15. * count_seconds (S1)
  16. find_shape_model (Image, ModelID, rad(-20), rad(20), \
  17.                   0.7, 0, 0.0, ['least_squares','max_deformation 16'], \
  18.                   0, 0.6, Row, Column, Angle, Score)
  19. * count_seconds (S2)
  20. * Runtime := (S2 - S1) * 1000
  21. * Clear the model
  22. clear_shape_model (ModelID)
  23. return ()
复制代码

Mask创建过程,我采用MATLAB:
  1. clc,clear,close all
  2. im = imread('43.bmp');
  3. imshow(im)
  4. im1 = im( 917:930, 1351:1366 );
  5. imshow(im1)

  6. k=1;
  7. for i=1:size(im1,1)
  8.     for j=1:size(im1,2)
  9.         row(1,k) = i-1;
  10.         col(1,k) = j-1;
  11.         gray(1,k) = im1(i,j);
  12.         k=k+1;
  13.     end
  14. end

  15. row_sequence = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13]
  16. col_sequence = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
  17. gray_sequence = [243,198,201,215,222,224,238,231,247,248,255,255,255,255,255,255,246,196,205,219,217,207,206,210,209,211,211,220,216,225,233,251,248,202,222,221,205,193,211,227,239,229,230,221,210,203,203,221,239,205,212,182,123,109,142,214,251,254,255,255,239,235,214,206,235,204,196,126,71,63,90,173,247,255,255,255,251,248,219,207,235,206,203,122,64,60,81,159,235,255,255,255,255,253,217,212,220,211,222,164,94,80,110,192,246,255,255,253,255,250,212,217,216,211,246,213,175,164,187,225,253,253,241,226,219,218,203,222,203,218,255,248,243,241,252,249,249,232,185,145,129,149,170,215,202,226,255,255,255,255,255,255,235,180,107,73,68,100,155,211,203,232,255,255,255,255,255,245,209,125,67,54,58,93,152,227,204,196,201,216,216,223,233,224,184,112,68,56,69,98,163,232,240,218,202,192,191,193,189,188,163,122,100,93,95,126,177,249,255,255,255,255,247,237,227,213,193,177,166,170,158,167,209,255]
复制代码



回复

使用道具 举报

0

主题

1

帖子

632

积分

高级会员

Rank: 4

积分
632
发表于 2017-10-10 09:53:43 | 显示全部楼层
支持一下支持一下
回复 支持 反对

使用道具 举报

0

主题

8

帖子

26

积分

新手上路

Rank: 1

积分
26
发表于 2017-10-13 22:17:28 | 显示全部楼层
xuexiyixialalaallahaha
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


Python|Opencv|MATLAB|Halcom.cn  

GMT+8, 2019-5-19 21:35 , Processed in 0.089368 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表