linemod c++ 代码梳理

233-589 colorgradient map 2D

1374 high level detector api

部分参考来自  https://blog.csdn.net/qq_36537774/article/details/89354339?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_baidulandingword-1&spm=1001.2101.3001.4242

源码地址 https://github.com/meiqua/shape_based_matching/blob/python_binding/line2Dup.cpp

Feature:x,y,orientation 一个像素点和它的方向 

Candidate:quantitized pyramid里面的一个struct,有一个feature和它的的score,有一个函数是把score高的feature排到前面  

ColorGradient 是由modality 继承过来,作用是computes quantized gradient orientations from a color image  

Modality有两个子类 2d的ColorGradient 和3d的depth normal 

Modality的主要作用是通过公有函数process计算输入图片的 量化后的 图像金字塔  返回的是一个指向 量化后的 图像金字塔的指针 

 这里Ptr是一个智能指针(smart pointer),随便指啥都可以 

Template:储存了一个feature向量(一张template上的多个像素点),template的h,w,以及所在的pyramid level 

Template pyramid:通过typedef新定义的一组template组成的vector,本身template是由一组feature得到的vector。 

Templatemap:把string映射到template pyramid的map,可能是针对2d和3d的modality有两种template pyramid 

一. 训练

1.1 旋转缩放 选定的template 图

rot_num = max(int((rot_deg_range[1]-rot_deg_range[0]) / rot_deg_range[2]), 1)
scale_num = max(int((scale_range[1]-scale_range[0]) / scale_range[2]), 1)
for rot_deg in np.linspace(rot_deg_range[0], rot_deg_range[1], rot_num):
for scale in np.linspace(scale_range[0], scale_range[1], scale_num):
templ_img, M = linemod.rotateTemplate(img, rot_deg, scale)

1.2 把旋转缩放之后的template 图加入Detector中

is_add_success = linemod.addTemplate(templ_img, "0", info)

template_id, rect = self.detector.addTemplate([img], class_id, mask)

 

1.2.1 在旋转缩放之后的template图像上得到一个 quantized pyramid

Ptr<ColorGradientPyramid> qp = modality->process(source, object_mask);

这里是通过2d的colorgradient map中的计算功能得到

这个是 直接构造一个 ColorGradientPyramid 对象,返回其指针
ColorGradientPyramid 构造函数中 update(); ,内部是
quantizedOrientations(src, magnitude, angle, weak_threshold);
先做 高斯模糊, 然后 在水平和垂直方向 调用 Sobel,
调用 phase 计算梯度方向,

调用 hysteresisGradient, 主要输出就是

  • 3
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值