# shape_based_matching
update:
**[fusion implementation to run faster!](https://github.com/meiqua/shape_based_matching/issues/77)**
**[icp is also refined to be faster and easier to use](https://github.com/meiqua/shape_based_matching/issues/100)**
[Transforms in shape-based matching](./Transforms%20in%20shape-based%20matching.pdf)
[pose refine with icp branch](https://github.com/meiqua/shape_based_matching/tree/icp2D), 0.1-0.5 degree accuracy
[icp + subpixel branch](https://github.com/meiqua/shape_based_matching/tree/subpixel), < 0.1 degree accuracy
[icp + subpixel + sim3(previous is so3) branch](https://github.com/meiqua/shape_based_matching/tree/sim3), deal with scale error
try to implement halcon shape based matching, refer to machine vision algorithms and applications, page 317 3.11.5, written by halcon engineers
We find that shape based matching is the same as linemod. [linemod pdf](Gradient%20Response%20Maps%20for%20Real-TimeDetection%20of%20Textureless%20Objects.pdf)
halcon match solution guide for how to select matching methods([halcon documentation](https://www.mvtec.com/products/halcon/documentation/#reference_manual)):
![match](./match.png)
## steps
1. change test.cpp line 9 prefix to top level folder
2. in cmakeList line 23, change /opt/ros/kinetic to somewhere opencv3 can be found(if opencv3 is installed in default env then don't need to)
3. cmake make & run. To learn usage, see different tests in test.cpp. Particularly, scale_test are fully commented.
NOTE: On windows, it's confirmed that visual studio 17 works fine, but there are some problems with MIPP in vs13. You may want old codes without [MIPP](https://github.com/aff3ct/MIPP): [old commit](https://github.com/meiqua/shape_based_matching/tree/fc3560a1a3bc7c6371eacecdb6822244baac17ba)
## thoughts about the method
The key of shape based matching, or linemod, is using gradient orientation only. Though both edge and orientation are resistant to disturbance,
edge have only 1bit info(there is an edge or not), so it's hard to dig wanted shapes out if there are too many edges, but we have to have as many edges as possible if we want to find all the target shapes. It's quite a dilemma.
However, gradient orientation has much more info than edge, so we can easily match shape orientation in the overwhelming img orientation by template matching across the img.
Speed is also important. Thanks to the speeding up magic in linemod, we can handle 1000 templates in 20ms or so.
[Chinese blog about the thoughts](https://www.zhihu.com/question/39513724/answer/441677905)
## improvment
Comparing to opencv linemod src, we improve from 6 aspects:
1. delete depth modality so we don't need virtual func, this may speed up
2. opencv linemod can't use more than 63 features. Now wo can have up to 8191
3. simple codes for rotating and scaling img for training. see test.cpp for examples
4. nms for accurate edge selection
5. one channel orientation extraction to save time, slightly faster for gray img
6. use [MIPP](https://github.com/aff3ct/MIPP) for multiple platforms SIMD, for example, x86 SSE AVX, arm neon.
To have better performance, we have extended MIPP to uint8_t for some instructions.(Otherwise we can only use
half feature points to avoid int8_t overflow)
7. rotate features directly to speed up template extractions; selectScatteredFeatures more
evenly; exautive select all features if not enough rather than abort templates(but features <= 4 will abort)
## some test
### Example for circle shape
#### You can imagine how many circles we will find if use edges
![circle1](test/case0/1.jpg)
![circle1](test/case0/result/1.png)
#### Not that circular
![circle2](test/case0/2.jpg)
![circle2](test/case0/result/2.png)
#### Blur
![circle3](test/case0/3.png)
![circle3](test/case0/result/3.png)
### circle template before and after nms
#### before nms
![before](test/case0/features/no_nms_templ.png)
#### after nms
![after](test/case0/features/nms_templ.png)
### Simple example for arbitary shape
Well, the example is too simple to show the robustness
running time: 1024x1024, 60ms to construct response map, 7ms for 360 templates
test img & templ features
![test](./test/case1/result.png)
![templ](test/case1/templ.png)
### noise test
![test2](test/case2/result/together.png)
## some issues you may want to know
Well, issues are not clearly classified and many questions are discussed in one issue sometimes. For better reference, some typical discussions are pasted here.
[object too small?](https://github.com/meiqua/shape_based_matching/issues/13#issuecomment-474780205)
[failure case?](https://github.com/meiqua/shape_based_matching/issues/19#issuecomment-481153907)
[how to run even faster?](https://github.com/meiqua/shape_based_matching/issues/21#issuecomment-489664586)
没有合适的资源?快使用搜索试试~ 我知道了~
尝试实现基于 halcon 形状的匹配,由 halcon 工程师编写
共54个文件
png:18个
hxx:10个
h:7个
需积分: 5 0 下载量 199 浏览量
2024-09-21
21:57:52
上传
评论
收藏 6.04MB ZIP 举报
温馨提示
尝试实现halcon基于形状的匹配,由halcon工程师编写 . 我们发现基于形状的匹配与linemod相同。
资源推荐
资源详情
资源评论
收起资源包目录
shape_based_matching.zip (54个子文件)
shape_based_matching
CMakeLists.txt 1KB
Gradient Response Maps for Real-TimeDetection of Textureless Objects.pdf 2.73MB
LICENSE 1KB
line2Dup.h 10KB
test.cpp 19KB
MIPP
mipp_impl_AVX512.hxx 149KB
math
avx_mathfun.hxx 23KB
sse_mathfun.hxx 21KB
neon_mathfun.h 1KB
avx_mathfun.h 2KB
sse_mathfun.h 2KB
neon_mathfun.hxx 9KB
avx512_mathfun.h 600B
avx512_mathfun.hxx 20KB
mipp_impl_SSE.hxx 114KB
mipp_impl_NEON.hxx 94KB
mipp_scalar_op.hxx 6KB
mipp_impl_AVX.hxx 122KB
mipp_object.hxx 52KB
mipp.h 44KB
mipp_scalar_op.h 748B
Transforms in shape-based matching.pdf 115KB
line2Dup.cpp 53KB
test
case2
test_templ.yaml 614KB
train.png 17KB
test_info.yaml 14KB
test.png 220KB
result
result.png 219KB
templ.png 233B
together.png 224KB
case0
circle_templ.yaml 373KB
features
no_nms_templ.png 386B
nms_templ.png 218B
2.jpg 30KB
3.png 44KB
1.jpg 291KB
templ
circle.png 4KB
circle_info.yaml 5KB
4.png 299KB
result
3.png 42KB
1.png 962KB
2.png 286KB
case1
test_templ.yaml 2.36MB
train.png 188KB
test_info.yaml 14KB
test.png 207KB
result.png 132KB
templ.png 807B
ori_16bit_experiment
LUT16.txt 3KB
line2Dup_16bit_ori.cpp 51KB
LUT_gen.cpp 2KB
.gitignore 42B
match.png 112KB
README.md 5KB
共 54 条
- 1
资源评论
余十步
- 粉丝: 1677
- 资源: 172
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 算法竞赛中的离散化 概念总结和基本操作全解
- 算法竞赛位运算(简单易懂)
- 常用一维二维 前缀和与差分算法模板总结
- SAR成像算法+后向投影(BP)算法+星载平台实测数据
- 横向循环焦点轮播图横向循环焦点轮播图横向循环焦点轮播图横向循环焦点轮播图横向循环焦点轮播图横向循环焦点轮播图横向循环焦点轮播图横向循环焦点轮播图横向循环焦点轮播图横向循环焦点轮播图横向循环焦点轮播图横
- 基于Java和HTML的留言墙、验证码、计算器基础项目设计源码
- 基于JAVA C/C++的嵌入式设备组网平台物联网框架设计源码
- 基于Java开发的高性能全文检索工具包jsearch设计源码
- 基于多语言技术的pt遨游助手手机版设计源码
- 基于若依框架的染云盘V1.0.2设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功