Halcon基于形状匹配的人脸追踪

halcon基于形状匹配的人脸追踪  
*打开摄像头句柄acqhandle
open_framegrabber ('directshow', 1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1, 'false', 'default', '[0] usb2.0 hd uvc webcam', 0, -1, acqhandle)
*从摄像头抓取一张图片
grab_image (image, acqhandle)
*抓完关闭摄像头
close_framegrabber (acqhandle)
dev_close_window ()
get_image_size (image, width, height)
dev_open_window (0, 0, width, height, 'black', windowhandle)
*打开一个窗口,尺寸400*400,黑色背景,句柄赋予windowhandle
dev_set_draw ('margin')
*'margin'只显示轮廓,'fille'显示填充
dev_display (image)
*定义数组显示提示信息
message[0] := ' 提 示:'
message[1] := '右键画面开始创建识别区域,按左键结束'
*显示数组中的提示信息
disp_message (windowhandle, message[0], 'window', 12, 12, 'red', 'true')
disp_message (windowhandle, message[1], 'window', 48, 12, 'black', 'true')
*继续提示语显示
disp_continue_message (windowhandle, 'black', 'true')
draw_rectangle1 (windowhandle, row1, column1, row2, column2)
*鼠标在打开的窗口绘制一个矩形,输出左上右下点的坐标
gen_rectangle1 (rectangle, row1, column1, row2, column2)
*得到一个矩形
reduce_domain (image, rectangle, imagereduced)
*缩小图像的域,取image与rectangle的交集,句柄imagereduced,诣在从原图上扣取画出的区域
*执行断点处
stop()
*准备一个可变形模型,用于平面标定匹配轮廓。
*create_planar_uncalib_deformable_model (imagereduced, 'auto', [], [], 'auto', 1, [], 'auto', 1, [], 'auto', 'none', 'use_polarity', 'auto', 'auto', [], [], modelid)
create_planar_uncalib_deformable_model (imagereduced, 5, rad(0), rad(360), rad(1), 1, 1, 0.02, 1, 1, 0.02, 'none', 'use_polarity', [42,57], 10, [], [], modelid)
*create_planar_calib_deformable_model_xld(template::numlevel,anglestart,angleextent,anglestep,scalermin,scalermax,scalerstep,scalecmin,scalecmax,scalecstep,optimization,metric,contrast,mincontrast,genparamname,genparamvalue:modelid
*template输入模板
*numlevels 输入金字塔最大层数(‘auto’(默认), 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
*anglestart 在最小的旋转模式(-3.14, -1.57, -0.79, -0.39(默认), -0.20, 0.0),
*angleextent 在旋转的角(6.29, 3.14, 1.57, 0.79(默认), 0.39(输入条件:大于等于0))
*anglestep 输入角度的步长(分辨率)(‘auto’(默认), 0.0175, 0.0349, 0.0524, 0.0698, 0.0873,(输入条件:(anglestep > 0) && (anglestep 0))
*scalermax 在行方向上的图案的最大尺度(1.0(默认), 1.1, 1.2, 1.3, 1.4, 1.5(输入条件:scalermax >= scalermin))
*scalerstep 在行方向上的刻度步长(分辨率)(‘auto’(默认), 0.01, 0.02, 0.05, 0.1, 0.15, 0.2,(输入条件:scalecstep > 0))
*scalecmin 行方向上的图案的最小尺度( 0.5, 0.6, 0.7, 0.8, 0.9, 1.0(默认)(输入条件:scalermin > 0))
*scalecstep 在列方向上的刻度步长(分辨率)(‘auto’(默认), 0.01, 0.02, 0.05, 0.1, 0.15, 0.2,(输入条件:scalecstep > 0))
*optimization 一种用于生成模型的优化方法( ‘auto’(默认), ‘none’, ‘point_reduction_low’, ‘point_reduction_medium’, ‘point_reduction_high’)
*metric ( ‘use_polarity’, ‘ignore_global_polarity’, ‘ignore_part_polarity’, ‘ignore_local_polarity’,‘ignore_color_polarity’(默认))
*contrast 搜索图像中物体的对比度
*mincontrast 搜索图像中物体的最小对比度(1, 2, 3, 5(默认), 7, 10, 20, 30, 40)
*genparamname 泛型参数名([],‘part_size’)
*genparamvalue 泛型参数的值( [], ‘small’, ‘medium’, ‘big’)
*modelid 模型的句柄
get_deformable_model_contours (modelcontours, modelid, 1)
*返回可变形模型的轮廓表示,输出:输入模板轮廓,级别1、2、3、4、5、6、7、8、9、10(level >= 1)
*测量输入轮廓的面积与中心值
area_center (rectangle, modelregionarea, refrow, refcolumn)
*仿射变换
vector_angle_to_rigid (0, 0, 0, refrow, refcolumn, 0, hommat2d)
*对xld轮廓进行任意仿射2d变换
affine_trans_contour_xld (modelcontours, transcontours, hommat2d)
dev_set_color ('green')
dev_set_draw ('margin')
dev_display (image)
dev_display (rectangle)
dev_display (transcontours)
stop ()
open_framegrabber ('directshow', 1, 1, 0, 0, 0, 0, 'default', 8, 'rgb', -1, 'false', 'default', '[0] usb2.0 hd uvc webcam', 0, -1, acqhandle)
while (true)
grab_image (image, acqhandle)
find_planar_uncalib_deformable_model (image, modelid, rad(0), rad(360), 1, 1, 1, 1, 0.5, 0, 0.5, 5, 0.75, ['subpixel'], ['least_squares_very_high'], resulthommat2d, score)
    dev_display (image)
    for i := 0 to |score| - 1 by 1
        temphommat2d := resulthommat2d[i*9:i*9+8]
        projective_trans_contour_xld (modelcontours, transcontours, temphommat2d)
*       将射影变换应用于 xld 轮廓
        dev_set_color ('green')
       * dev_display (transcontours)
        *xld转换成region
        gen_region_contour_xld (transcontours, region, 'filled')
        union1 (region, regionunion)
        *对区域,生成最小外接矩形
        smallest_rectangle1 (regionunion, row1, column1, row2, column2)
        *使用绿色矩形框,框选匹配结果
      * dev_set_color ('green')
       disp_rectangle1 (windowhandle, row1, column1, row2, column2)
      *使用红色勾画匹配结果轮廓
*        stop ()
    endfor
endwhile


语音识别技术的发展史
基于5G+AIoT实现零碳的解决方案
购买博蓝特股权,乾照光电向上游LED产业延伸
以太坊2.0的升级会对加密世界带来什么影响
韶音骨传导耳机究竟如何?韶音南卡旗舰机对比评测
Halcon基于形状匹配的人脸追踪
iPhone8什么时候上市?iPhone8最新消息:最新图泄露,后置指纹识别、快充、超薄
世界首款360度全景VR相机PILOT Era介绍
Manz助力FOPLP封装发展 具有独特的优势
物联网移动应用平台为物联网开发带来敏捷技术和可用库
如何打造中国的数字化无人工厂
大华视频警务督察解决方案的应用特点及实例分析
数字信号隔离,实现更好的设计
国产化航空航天连接器厂商华丰科技登录科创板
揭秘小米AI音箱的语音交互的优势
STM32片上外设时钟使能 失能和复位的区别
任正非称苹果是华为的老师 但是美国2009年就开始入侵华为服务器
戴森发布智能家居新品,台灯风扇与吸尘机器人争奇斗艳
如何利用无线电模块制作一台Arduino调频收音机
手机影像的下一个赛道会是模块化吗?