School of Transportation and Logistics Engineering, Wuhan University of Technology, Wuhan 430063, China
Show less
文章历史+
Received
Published
Revised
2025-07-29
2026-08-18
2026-01-31
Online Date
2026-09-04
PDF (15709K)
摘要
为了实现更高精度的金属表面缺陷检测,提出基于双目视觉的金字塔SGBM(semi-global block matching)缺陷测量方法。首先,基于限制对比度自适应直方图均衡化(contrast limited adaptive histogram equalization,CLAHE)、双边滤波和导向滤波进行图像增强,去除图像中的多余噪声,使其更加清晰;其次利用图像金字塔和ORB(oriented FAST and rotated BRIEF)特征检测进行分层优化,提高算法的计算效率与精度;最后,通过视差后处理,使用加权最小二乘(weighted least squares,WLS)滤波与高斯权重的亚像素精修得到精度更高的视差图。实验结果表明,所提出的方法在金属表面缺陷测量中效果显著,重建出的三维点云结构清晰,改进后的金字塔SGBM算法精度有显著增强,金属表面缺陷尺寸测量相对误差小于5%,满足实际检测需求。本文所提方法可有效克服金属表面反光、复杂噪声对立体匹配的干扰,兼顾运算效率与测量鲁棒性,能够为工业场景下金属构件表面缺陷三维重建与定量尺寸检测提供技术参考和实用方案。
Abstract
To achieve higher-precision detection of metal surface defects, a defect measurement method based on binocular vision and pyramid SGBM(semi-global block matching)was proposed. First, image enhancement was performed using contrast limited adaptive histogram equalization (CLAHE), bilateral filtering, and guided filtering to remove redundant noise from images and improve their clarity. Second, hierarchical optimization was implemented using image pyramids and ORB (oriented FAST and rotated BRIEF) feature detection to enhance the computational efficiency and accuracy of the algorithm. Finally, through disparity post-processing, a more accurate disparity map was obtained using weighted least squares (WLS) filtering and subpixel refinement with Gaussian weights. Experimental results show that the proposed method achieves significant effects in metal surface defect measurement: the reconstructed 3D point cloud has a clear structure, the accuracy of the improved pyramid SGBM algorithm is significantly enhanced, and the relative error of metal surface defect size measurement is less than 5%, which meets the requirements of practical detection. The proposed method can effectively eliminate the interference of metal surface reflection and complex noise on stereo matching, while balancing computational efficiency and measurement robustness. It can provide technical reference and practical solutions for 3D reconstruction and quantitative dimension detection of surface defects of metal components in industrial scenarios.
QIAO Song, ZHAO Zhang-yan.
Metal Surface Defect Measurement Based on Binocular Vision[J].
Science Technology and Engineering, 2026, 26(23): 10041-10049 DOI:10.12404/j.issn.1671-1815.2505591
近年来,计算机技术的不断发展催生了机器视觉的缺陷检测,并迅速成为研究热点。周书华等[4]融合局部信息熵、梯度漂移等技术优化双目视觉测量;张枫吟等[5]设计了一种自动装车机车厢尺寸测量系统,进一步推动双目视觉测量的发展;吴洪臣等[6]提出了一种基于多线程半全局立体匹配的工件内部检测方法,改进后的 SGBM(semi-global block matching) 算法处理速度提高,欧式距离测量和区域面积测量均有较高的精度,满足工件内部检测需求;吕钦等[7]改进SGBM算法,解决铝合金件三维重建误匹配难题;Firmansyah等[8]基于FPGA硬件加速进行实时测量;Chen等[9]实现水下障碍实时识别测距;Zhao等[10]改进了双目立体视觉系统的测量精度;Huang等[11]、Zhang等[12]侧重于相机的校准性能;Wang等[13]改进 AD-Census 算法,提升检测精度与速度;Lin等[14]改进泊松重建计算猪的点云体积;Kong等[15]使用实例分割和点云处理对非侵入性鲬鱼进行质量估计;王浩[16]结合YOLOv8 与SGBM完成划痕三维尺寸测量;王然[17]结合图像分割与角点检测,实现物体尺寸高精度非接触测量;陈旭佳等[18]采用双目结构光三维重建技术,实现类球形水果外形指标的非接触、自动化高精度测量;谭斌等[19]利用YOLOv5(you only look once version 5)与视差计算的方法进行目标检测与测距系统设计,能准确检测室外目标障碍物,并实现目标测距;赵杰等[20]设计了一套用于移动机械臂抓取物料过程中的三维空间定位的双目检测方法;王晓初等[21]针对轨道纵向位移测量问题设计了一种基于双目视觉的轨道纵向位移测量方法;王杨等[22]提出一种双通道立体图像质量评价算法;郑坤等[23]基于改进的双目立体视觉实现海浪波面三维重建技术。上述情况说明,使用双目视觉技术对金属表面缺陷进行测量已经是一种成熟的检测技术,但是测量精度仍然是一个需要解决的问题。
针对金属表面缺陷纹理较少、光照不均、噪声干扰以及缺陷类型多样、形态各异等因素,提出一种基于双目视觉的金字塔SGBM缺陷测量方法。首先,使用CLAHE(contrast limited adaptive histogram equalization)、双边滤波和导向滤波进行图像增强,去除噪声、保留细节边缘并增加图像对比度;然后,基于ORB(oriented FAST and rotated BRIEF) 特征匹配与图像金字塔的分层优化,在提高算法计算速度的同时提升精度;最后,使用WLS滤波与高斯权重的亚像素精修进行视差后处理,提高视差图的精度。
通过对BM(block matching)局部匹配算法、基于SAD(sum of absolute differences)匹配算法与SGBM半全局匹配算法的研究学习。BM算法将图像分为小方块,然后在另一幅图里滑动比对位置,靠位移向量找最相似的小块进行计算,主要应用于实时性要求高、场景纹理丰富的场景,对纹理匮乏区域匹配精度低;SAD匹配算法是基于局部窗口像素灰度差异判断左右视图中像素的匹配程度,对噪声、光照变化敏感,弱纹理区域易匹配错误;SGBM算法使用块匹配代替逐像素匹配计算初始代价,提高效率,通过动态规划路径聚合减少冗余计算,降低内存消耗。
为了验证改进的金字塔SGBM算法的精准效果,选取Middlebury Stereo数据集[24-25]中venus、tsukuba、cones和teddy作为数据集,与BM算法、SAD算法与SGBM算法进行对比,结果如图7所示。另外,通过计算双目视差图与数据集图像的非遮挡区域、全局、视差不连续区域的误匹配率PBM(percentage of bad matching pixels)作为评价指标,计算公式为
ZhanXianglin, LiShuwen. Evaluation of micro-delamination defects in fiber metal laminates based on local defect resonance[J]. Laser & Optoelectronics Progress, 2021, 58(23): 247-255.
[3]
刘佳琪. 基于激光热成像的金属表面缺陷检测研究[D]. 太原: 中北大学, 2021.
[4]
LiuJiaqi. Research on metal surface defect detection based on laser thermography[D]. Taiyuan: North University of China, 2021.
[5]
李嘉兴. 钢板尺寸与缺陷的光学检测图像处理算法的研究[D]. 太原: 太原科技大学, 2024.
[6]
LiJiaxing. Research on optical inspection image processing algorithms for steel plate dimension and defect detection[D]. Taiyuan: Taiyuan University of Science and Technology, 2024.
ZhouShuhua, XuSixiang, DongChenchen, et al. Binocular vision measurement algorithm based on local information entropy and gradient drift[J]. Laser & Optoelectronics Progress, 2023, 60(12): 333-341.
LüQin, ZhouShiyang, WanBowei, et al. Research on 3D point-cloud reconstruction of aluminum alloy parts based on binocular vision[J]. Modular Machine Tool & Automatic Manufacturing Technique, 2025(2): 63-68.
[15]
FirmansyahI, YamaguchiY, MaruyamaT, et al. FPGA-based stereo matching for crop height measurement using monocular camera[J]. Microprocessors and Microsystems, 2024, 108: 105063.
[16]
ChenQ, LiuH, GanW Y. A real-time recognition and distance measurement method for underwater dynamic obstacles based on binocular vision[J]. Measurement, 2025, 252: 117329.
[17]
ZhaoH, MaW, JiP, et al. Modeling the measurement accuracy for binocular stereo vision system[J]. Optics Express, 2025, 33(9): 19051-19066.
[18]
HuangW, MiaoH, JiaoS, et al. A planar constraint optimization method to improve camera calibration for imperfect planar targets[J]. Optics and Lasers in Engineering, 2024, 180: 108273.
[19]
ZhangX, LüT, DanW, et al. High-precision binocular camera calibration method based on a 3D calibration object[J]. Applied Optics, 2024, 63(10): 2667-2682.
[20]
WangY N, GuM J, ZhuY F, et al. Improvement of AD-census algorithm based on stereo vision[J]. Sensors, 2022, 22(18): 6933.
[21]
LinJ, ChenH, WuR, et al. Calculating volume of pig point cloud based on improved poisson reconstruction[J]. Animals, 2024, 14(8): 1210.
[22]
KongM, LiB, ZhangY, et al. Non-intrusive mass estimation method for crucian carp using instance segmentation and point cloud processing[J]. Computers and Electronics in Agriculture, 2024, 226: 109445.
[23]
王浩. 高速动车组车轴划痕缺陷视觉检测技术研究[D]. 长春: 吉林大学, 2024.
[24]
WangHao. Research on visual inspection technology for scratch defects on high-speed EMU axles[D]. Changchun: Jilin University, 2024.
[25]
王然. 基于双目视觉的物体尺寸测量研究[D]. 唐山: 华北理工大学, 2023.
[26]
WangRan. Research on object dimension measurement based on binocular vision[D]. Tangshan: North China University of Science and Technology, 2023.
ChenXujia, PengYumeng, YuShengqi, et al. Measurement of shape indices for near-spherical fruits based on binocular structured-light 3-D reconstruction[J]. Transactions of the Chinese Society of Agricultural Engineering, 2024, 40(20): 187-194.
TanBin, WangTing. Design of an object detection and ranging system based on YOLOv5 and disparity computation[J]. Science Technology and Engineering, 2024, 24(21): 9015-9024.
ZhaoJie, WangZhicheng, HuangNanhai, et al. 3-D spatial positioning algorithm for materials based on binocular vision[J]. Science Technology and Engineering, 2023, 23(18): 7861-7867.
WangXiaochu, ZhongLongsheng, WangYi, et al. Longitudinal displacement measurement of railway tracks based on binocular vision[J]. Science Technology and Engineering, 2022, 22(27): 12167-12174.
ZhengKun, JiangWenzheng, LuXiao, et al. 3D reconstruction technology of ocean wave surface based on binocular stereoscopic vision[J]. Science Technology and Engineering, 2021, 21(6): 2392-2396.
[39]
ScharsteinD, SzeliskiR. A taxonomy and evaluation of dense two-frame stereo correspondence algorithms[J]. International Journal of Computer Vision, 2002, 47(1-3): 7-42.
[40]
SzeliskiS D. High-accuracy stereo depth maps using structured light[C]// IEEE Computer Society Conference on Computer Vision and Pattern Recognition. New York: IEEE, 2003: 195-202.