Creat_average_shape_model.hdev例程相关学习(二)

 从(一)的各种模板匹配和寻找对象不说,最后在图中找到了8个器件,
get_shape_model_contours (ModelContours, ModelID, 1)
gen_empty_obj (Templates)
这两个代码后53有个一求刚性仿射变换的算子, vector_angle_to_rigid ( : :  Row1 Column1 Angle1 Row2 Column2 Angle2  :  HomMat2D )
  / Row2 \                  / Row1 \
| Column2 |  = HomMat2D * | Column1 |  大概就是计算这么一个玩意。
 
 \ 1 /                      \ 1 / 
这将参考图像转换为当前图像或(如果参数传递顺序相反)从当前图像与参考图像。(帮助文档翻译)  
计算了一堆仿射变换2D矩阵,还做了hom_mat2d_invert变化,但是不明白到底为什么还要做这个变化。帮助文档也很奇怪,见下:

    / ra rb tc \

    | rd re tf |   
      \ 0 0 1 /
  is stored as the tuple [ra, rb, tc, rd, re, tf]. However, it is also possible to process full 3×3 matrices, which represent a projective 2D transformation.
明白了,最后用新仿射变换后的一个新的模板来匹配这八个器件,代码思路和前面匹配差不多,时间少了很多,但是我认为前面的匹配更加好用。

1模板匹配使用的重要算子

find_scaled_shape_model ( Image  : :  ModelID AngleStart AngleExtent ScaleMin ScaleMax MinScore NumMatches MaxOverlap SubPixel NumLevels Greediness  :  Row Column Angle Scale Score )  

find_shape_model(Image : :  //搜索图像

                   ModelID, //模板句柄

                  AngleStart,  // 搜索时的起始角度

                  AngleExtent, //搜索时的角度范围,必须与创建模板时的有交集

                  MinScore, //最小匹配值,输出的匹配的得分Score 大于该值

                  NumMatches, //定义要输出的匹配的最大个数

                  MaxOverlap, //当找到的目标存在重叠时,且重叠大于该值时选择一个好的输出

                 SubPixel, //计算精度的设置,五种模式,多选2,3

                 NumLevels, //搜索时金字塔的层数

                Greediness : //贪婪度,搜索启发式,一般都设为0.9,越高速度快,容易出现找不到的情况

                  Row ,   Column ,   Angle ,   Score )   //输出匹配位置的行和列坐标、角度、得分。  
find_scaled_shape_model  (Image, ModelID, rad(0), rad(180), 0.77, 0.78, MinScore1, 0, 0, 'interpolation', 2, 0.7, Row, Column, Angle, Scale, Score)
    这里面 
  NumMatches ,给了0是说全部返回的意思。
    If  SubPixel  is set to  'interpolation'  (or  'true' ) the position as well as the rotation and scale are determined with subpixel accuracy. In this mode, the model's pose is interpolated from the score function.

**********************************************************************************************************************
    SubPixel 确定找到的目标是否使用亚像素精度提取, 也就是说选用了interpolation是一个用score function来进行内插插值的像素精度选择方法?这点帮助文档没有看明白,插值我懂,但插值为何还能干这事呢。
**********************************************************************************************************************
 
    偶然发现了scaled算子的母算子把,find_shape_model算子,介绍如上,已经完全明白了,通过这个算子结合之前的算子可以找到匹配模板的各种信息, Row ,   Column ,  是匹配出来物体的中心的R W坐标(R为上下 W为左右),Angle是rotation情况,还有scale是缩放程度,最后score得分来评判匹配程度,如果物体被遮挡比较严重,那么得分基本在0.5之下。

get_shape_model_params  (ModelID, NumLevels, AngleStart, AngleExtent, AngleStep, ScaleMin, ScaleMax, ScaleStep, Metric, MinContrast)
  

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值