# SemiGlobalMatching
**Repository Path**: bakili/SemiGlobalMatching
## Basic Information
- **Project Name**: SemiGlobalMatching
- **Description**: SGM,立体匹配最经典应用最广泛算法,4000+引用,兼顾效率和效果。完整实现,代码规范,注释清晰,博客教学,欢迎star!
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-04
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# SemiGlobalMatching
SGM,立体匹配最经典应用最广泛算法,4000+引用,兼顾效率和效果。完整实现,代码规范,注释清晰,博客教学,欢迎star!
# CSDN博客
[【恒叨立码】【码上实战】【立体匹配系列】经典SGM:(1)框架与类设计](https://ethanli.blog.csdn.net/article/details/105065660)
[【恒叨立码】【码上实战】【立体匹配系列】经典SGM:(2)代价计算](https://ethanli.blog.csdn.net/article/details/105142484)
[【恒叨立码】【码上实战】【立体匹配系列】经典SGM:(3)代价聚合](https://ethanli.blog.csdn.net/article/details/105316274)
[【恒叨立码】【码上实战】【立体匹配系列】经典SGM:(4)代价聚合2](https://ethanli.blog.csdn.net/article/details/105396761)
[【恒叨立码】【码上实战】【立体匹配系列】经典SGM:(5)视差优化](https://blog.csdn.net/rs_lys/article/details/105715526)
[【恒叨立码】【码上实战】【立体匹配系列】经典SGM:(6)视差填充](https://ethanli.blog.csdn.net/article/details/105897391)
[【恒叨立码】【码上实战】【立体匹配系列】经典SGM:(7)弱纹理优化](https://ethanli.blog.csdn.net/article/details/106168040)
# 环境
windows10 / visual studio 2015&2019
代码基本没有使用系统api,你可以非常方便的移植到linux,可能需要做极少量的修改
# 第三方库
opencv310
百度网盘连接:https://pan.baidu.com/s/1_WD-KdPyDBazEIim7NU3jA
提取码:aab4
解压后放将名称为OpenCV的文件夹复制到到3rdparty文件夹下
若运行时提示缺少opencv_310(d).dll,则在OpenCV文件夹里找到对应的dll文件复制到程序exe所在的目录即可(Opencv\dll\opencv_310(d).dll),带d为debug库,不带d为release库。
为便于移植,算法是不依赖任何图像库的,只在算法实验部分调用opencv库读取和显示图像,也可替换成其他图像库
# 算法引导
SGM步骤图
SGM类设计图
## 备注
算法优点:效果好,效率高,且可高度并行
算法缺点:效果非SOTA、内存占用高(可优化)、对弱纹理、重复纹理支持不太好
## 论文
1. Heiko Hirschmüller. Hirschmüller, H: Stereo processing by semiglobal matching and mutual information. IEEE PAMI 30(2), 328-341[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2008, 30(2):328-341.
2. Humenberger M , Engelke T , Kubinger W . A census-based stereo vision algorithm using modified Semi-Global Matching and plane fitting to improve matching quality[C]// IEEE Computer Society Conference on Computer Vision & Pattern Recognition-workshops. IEEE, 2010.
## 实验图
上行:左视图、右视图、初始代价结果、聚合代价结果
下行:一致性检查、唯一性约束+去小连通区、中值滤波、视差填充
## Github图片不显示的解决办法
修改hosts
C:\Windows\System32\drivers\etc\hosts
在文件末尾添加:
``` cpp
# GitHub Start
192.30.253.112 github.com
192.30.253.119 gist.github.com
151.101.184.133 assets-cdn.github.com
151.101.184.133 raw.githubusercontent.com
151.101.184.133 gist.githubusercontent.com
151.101.184.133 cloud.githubusercontent.com
151.101.184.133 camo.githubusercontent.com
151.101.184.133 avatars0.githubusercontent.com
151.101.184.133 avatars1.githubusercontent.com
151.101.184.133 avatars2.githubusercontent.com
151.101.184.133 avatars3.githubusercontent.com
151.101.184.133 avatars4.githubusercontent.com
151.101.184.133 avatars5.githubusercontent.com
151.101.184.133 avatars6.githubusercontent.com
151.101.184.133 avatars7.githubusercontent.com
151.101.184.133 avatars8.githubusercontent.com
# GitHub End
```