# 块匹配算法

块匹配算法是一种视频运动估计方法：将当前帧划分为互不重叠的块，对每个块在参考帧的搜索窗口中扫描，寻找最佳匹配块，两者之间的位移被记录为运动矢量。<sup>[1](https://momrach.es/documentos/cicos2018/2012_Santamaria_Trujillo%20-%20A%20Comparison%20of%20Block-Matching%20Motion%20Estimation%20Algorithms.pdf)</sup> 它是视频序列中运动编码的标准技术，应用于视频压缩、立体视觉和目标跟踪。<sup>[1](https://momrach.es/documentos/cicos2018/2012_Santamaria_Trujillo%20-%20A%20Comparison%20of%20Block-Matching%20Motion%20Estimation%20Algorithms.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 目的 | 降低视频编码中的时间冗余；编码器传输运动矢量加预测残差，而非完整帧<sup>[1](https://momrach.es/documentos/cicos2018/2012_Santamaria_Trujillo%20-%20A%20Comparison%20of%20Block-Matching%20Motion%20Estimation%20Algorithms.pdf)</sup> |
| 匹配度量 | 均方误差（MSE）和绝对差之和（SAD）；SAD计算开销更小，结果接近MSE<sup>[1](https://momrach.es/documentos/cicos2018/2012_Santamaria_Trujillo%20-%20A%20Comparison%20of%20Block-Matching%20Motion%20Estimation%20Algorithms.pdf)</sup> |
| 计算占比 | 运动估计通常占视频编码器总计算量的60–80%<sup>[3](https://www.sciencedirect.com/science/article/abs/pii/S0923596504000748)</sup> |
| 全搜索 | 穷举检查搜索窗口中的每个位置，视频质量最优但计算代价高<sup>[9](https://www.sciencedirect.com/science/article/abs/pii/S0957417419306372)</sup> |
| 菱形搜索 | 朱和马的菱形搜索性能接近NTSS，平均计算量最多减少22%<sup>[2](https://pubmed.ncbi.nlm.nih.gov/18255398/)</sup> |
| 现代实践 | 在现代视频编码标准中，可变块大小块匹配是常规运动估计的首选方法<sup>[5](https://www.sciencedirect.com/topics/computer-science/block-motion-estimation)</sup> |

## 工作原理

在典型的块匹配算法中，当前帧的每个亮度块与参考帧搜索区域中的候选块（即原块的位移副本）进行匹配。选取失真最小的候选块，其位移被记录为运动矢量。编码器随后传输运动矢量以及当前帧与运动补偿预测之间的残差；预测越好，误差信号越小，传输比特率越低。<sup>[6](https://link.springer.com/article/10.1155/2010/210937)</sup>

候选块与参考块之间的失真由代价函数衡量。两种最常用的度量是均方误差和绝对差之和：

\[ \mathrm{SAD}(X, Y) = \sum_{i=0}^{M-1} \sum_{j=0}^{N-1} \lvert X(i, j) - Y(i, j) \rvert \]

MSE在质量上比SAD更精确，但SAD使用更广，因为它计算开销更小且结果接近MSE。<sup>[1](https://momrach.es/documentos/cicos2018/2012_Santamaria_Trujillo%20-%20A%20Comparison%20of%20Block-Matching%20Motion%20Estimation%20Algorithms.pdf)</sup> 最昂贵的操作是计算一对块的失真，因此块匹配算法的速度取决于所探索的块数。<sup>[1](https://momrach.es/documentos/cicos2018/2012_Santamaria_Trujillo%20-%20A%20Comparison%20of%20Block-Matching%20Motion%20Estimation%20Algorithms.pdf)</sup>

该方法基于简化假设：物体在平行于相机平面的平面内做平移运动，因此不考虑相机缩放和物体旋转；光照在空间和时间上均匀；忽略一个物体对另一个物体的遮挡以及暴露背景。<sup>[6](https://link.springer.com/article/10.1155/2010/210937)</sup> 块匹配还受孔径问题困扰，且块尺寸越小问题可能越严重。<sup>[8](https://arxiv.org/abs/2110.01805)</sup>

## 全搜索与快速算法

**全搜索**是最简单的块匹配方法：它计算搜索窗口中每个可能位置的匹配代价，因此能找到最精确的运动矢量，但代价是巨大的计算量。<sup>[9](https://www.sciencedirect.com/science/article/abs/pii/S0957417419306372)</sup> 其规整的数据流使其特别适合硬件实现，许多硬件设计专注于数据复用；然而，作为一种暴力算法，它不利用序列中运动活动的信息。<sup>[3](https://www.sciencedirect.com/science/article/abs/pii/S0923596504000748)</sup>

快速算法在保持预测质量的同时减少搜索点数。由于自然序列中的运动矢量呈中心偏置，集中在零位移位置附近，快速搜索从中心附近开始并向外扩展。命名的算法包括三步搜索（TSS，古贺等人，1981）、新三步搜索（NTSS，李、曾和利乌，1994）、四步搜索（4SS，波和马，1996）、共轭方向搜索（CDS，斯里尼瓦桑和拉奥，1985）以及块基梯度下降搜索（BBGDS，刘和费格，1996）。<sup>[9](https://www.sciencedirect.com/science/article/abs/pii/S0957417419306372)</sup>

**基于模式的搜索**用固定的几何模式替代穷举扫描，该模式反复以当前最优点为中心。朱和马的菱形搜索于2000年在研究常见测试序列中运动矢量分布后提出，使用两种菱形模式：小菱形搜索模式（SDSP）和大菱形搜索模式（LDSP）。仿真结果表明，它大大优于TSS，性能接近NTSS，平均计算量最多减少22%，在均方误差性能和所需搜索点数上均优于4SS和BBGDS。<sup>[2](https://pubmed.ncbi.nlm.nih.gov/18255398/)</sup> 六边形搜索（HS）使用小六边形和大六边形模式，与DS相比PSNR略有折衷，但所需计算量显著更少。<sup>[4](https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/iet-ipr.2017.0641)</sup>

**基于预测的搜索**利用相邻块之间的连贯性。自适应十字模式搜索（ARPS）使用相邻块的运动矢量来预测自身的运动矢量，通常以极低的计算量提供更高的PSNR，优于其他算法。<sup>[4](https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/iet-ipr.2017.0641)</sup> TZ搜索（TZS）算法将五个运动矢量预测器——中值、左、上、右上和零——与菱形和光栅搜索方法相结合。<sup>[4](https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/iet-ipr.2017.0641)</sup>

2012年，山谷大学[多媒体](https://www.edgepedia.org/zh/multimedia)与视觉实验室的玛丽亚·桑塔玛丽亚和玛丽亚·特鲁希略进行了一项比较，实现了七种算法——全搜索、三步搜索、四步搜索、菱形搜索、六边形块搜索、多方向梯度下降搜索和快速方向梯度下降搜索——并从预测质量（PSNR、SSIM）和效率（探索块数）两方面进行评估。在分析的算法中，多方向和快速方向梯度下降搜索给出了最佳的预测质量，快速方向变体在高品质和低响应时间之间取得了平衡。六边形块搜索的预测质量较低，但受块大小变化的影响最小。<sup>[1](https://momrach.es/documentos/cicos2018/2012_Santamaria_Trujillo%20-%20A%20Comparison%20of%20Block-Matching%20Motion%20Estimation%20Algorithms.pdf)</sup>

## 在视频编码标准中的应用

包括ISO MPEG-1、MPEG-2和MPEG-4以及ITU-T H.261、H.262、H.263和H.264在内的视频压缩标准使用基于块的运动补偿来消除时间冗余。<sup>[3](https://www.sciencedirect.com/science/article/abs/pii/S0923596504000748)</sup> 当前标准在宏块或编码单元级别而非单个像素级别执行运动估计，解码器同时接收运动矢量（通常表示像素分数单位的位移）和残差预测误差。<sup>[7](https://technav.ieee.org/topic/motion-estimation/)</sup> 可变块大小块匹配现在被认为是一种更灵活的方法，在现代视频编码标准中是常规运动估计的首选。<sup>[5](https://www.sciencedirect.com/topics/computer-science/block-motion-estimation)</sup>

块匹配并非唯一的运动估计方法。相位相关是一种频域技术，是电视标准转换（如美国和欧盟帧率之间的帧率转换）的首选方法，因为它产生的运动场比块匹配运动估计更平滑、熵更低，显著减少运动伪影。<sup>[5](https://www.sciencedirect.com/topics/computer-science/block-motion-estimation)</sup>

## 学习型替代方案

传统块匹配依赖计算密集的搜索过程。一种自监督卷积方法——复合块平移网络（CBT-Net）——使用三帧同时进行无搜索的多块尺寸运动估计，并以多尺度结构相似性损失进行训练。当用于AV1中的帧间预测时，与SVT-AV1编码器中的块匹配运动估计系统相比，其运动矢量预测在MS-SSIM和VMAF质量指标下分别给出平均Bjontegaard-delta码率改进−1.70%和−1.52%。<sup>[8](https://arxiv.org/abs/2110.01805)</sup>

## References

1. [María Santamaría and María Trujillo (2012). A Comparison of Block-Matching Motion Estimation Algorithms. 7CCC, Medellín, Colombia.](https://momrach.es/documentos/cicos2018/2012_Santamaria_Trujillo%20-%20A%20Comparison%20of%20Block-Matching%20Motion%20Estimation%20Algorithms.pdf)
2. [Shan Zhu and Kai-Kuang Ma (2000). A new diamond search algorithm for fast block-matching motion estimation. IEEE Transactions on Image Processing 9(2):287–290.](https://pubmed.ncbi.nlm.nih.gov/18255398/)
3. [A simple and efficient block motion estimation algorithm based on full-search array architecture. ScienceDirect.](https://www.sciencedirect.com/science/article/abs/pii/S0923596504000748)
4. [Shinde (2018). Efficient direction-oriented search algorithm for block motion estimation. IET Image Processing.](https://ietresearch.onlinelibrary.wiley.com/doi/10.1049/iet-ipr.2017.0641)
5. [Block Motion Estimation – an overview. ScienceDirect Topics.](https://www.sciencedirect.com/topics/computer-science/block-motion-estimation)
6. [Boudlal, Nsiri, and Aboutajdine (2010). Modeling of Video Sequences by Gaussian Mixture: Application in Motion Estimation by Block Matching Method. EURASIP Journal on Advances in Signal Processing.](https://link.springer.com/article/10.1155/2010/210937)
7. [Motion estimation. IEEE Technology Navigator.](https://technav.ieee.org/topic/motion-estimation/)
8. [Paul, Norkin, and Bovik (2021). Self-Supervised Learning of Perceptually Optimized Block Motion Estimates for Video Compression. arXiv:2110.01805.](https://arxiv.org/abs/2110.01805)
9. [Hexagon Based Compressed Diamond Algorithm for motion estimation and its dedicated VLSI system for HD videos. ScienceDirect.](https://www.sciencedirect.com/science/article/abs/pii/S0957417419306372)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 工程与制造 › 电气与电子工程 › Circuits and signal processing › Adaptive and robust signal processing

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/block-matching-algorithm

English original: https://www.edgepedia.org/block-matching-algorithm
