目的 在轮廓特征识别中,形状角理论已经被证明为一种有效方法.形状角的计算精度和时间开销取决于轮廓上各离散点处切线方向的计算效率.现有基于Vialard算法的切线方向计算方法在处理矩形轮廓时步骤烦琐且存在较大的误差,导致使用形状角识别矩形时效率不高.针对此问题,提出一种基于傅里叶拟合的离散点切线方向计算方法.方法 首先对离散点进行极坐标转化,然后使用傅里叶级数拟合整个轮廓,最后再对拟合之后的曲线求导,从而计算出轮廓上各点的切线方向.结果 在本文所给出的实例中,本文方法计算平均耗时为1.5775 s,传统方法平均耗时为156.155 s,且计算结果更加精确.结论 本文方法可以避免Vi-alard算法及其衍生方法在处理矩形轮廓时产生的过度迭代的问题,时间复杂度降低两个数量级,结果更加准确.最后,将所提的改进形状角计算方法应用矩形轮廓识别中,通过实例分析,验证了该方法的准确性和可靠性.
The fast recognition and classification of objects with rectangular shapes are an essential component in the automatic detection of printed circuit board (PCB) defects, such as through automatic optical inspection or automatic X-ray inspection. The image obtained generally covers only a certain part of a PCB that contains rectangular shapes. The amount, positions, orientations, and exact shapes are almost undetermined. Most traditional algorithms for rectangular region detection are based on the Hough transform or on its derivations. In these approaches, each potential region must be voted on in a 2D or 3D domain. This process increases time complexity and lowers computation speed. By contrast, shape angle theory is an effective method for detecting rectangular regions in contour inspection. Objective Shape angle theory can avoid the inaccuracy and computational inefficiency induced by Hough transform. The accuracy and time complexity of shape angle calculation depend on the efficiency of the tangent calculation at discrete points on the contour. This calculation is currently performed using either Vialard's algorithm or its derived methods. These procedures can be complicated and inaccurate when applied to rectangles with relatively smooth edges. Method A new method based on Fourier fitting has been proposed in this paper to solve this problem. A polar coordinate system transform is first applied to the discrete points. Then, Fourier series are used to fit envelopes and to calculate the derivative of the envelope function to obtain the tangent. Result The in- tegrated chip FUSION 878A is derived from a gray-scale image to verify the accuracy and reliability of this method. The average computing time of the proposed method is 1. 577 5 s. By contrast, the traditional approach reports an average computing time of 156. 155 s. The proposed method avoids iterations in handling rectangle contours. Therefore, time complexity is significantly reduced by two orders of magnitude. Moreover, the proposed method generat