为了对金相组织的多项组织含量进行定量分析,提出应用Canny算法和灰度等高线相结合的方法来产生封闭金相组织边缘。首先,采用高斯函数对金相组织的灰度图像进行模糊处理,然后,用Canny算法对模糊后的图像获取具有单边缘效应的原始边缘。通过最大类间方差法对原始边缘进行自动计算,获得抑制虚假边缘的阈值,并通过该阚值获取基础边缘。由于基础边缘具有不连续性,因此需根据基础边缘端点的邻域灰度中值计算所需的灰度等高线,同时根据设定的等高线和基础边缘融合的条件,以基础边缘的端点为起点生成封闭边缘。实验结果表明,该算法可有效地生成符合要求的封闭边缘,采用该算法产生的封闭边缘进行金相组织含量测定可使测量误差降低到±1%,可测组织含量范围达到5%~95%。该算法能满足多项金相组织含量测定的定量分析要求且具有普适性。
In order to quantitatively analyse the polyphase contents of metallographic structures, this paper presented an enclosing image edge extraction algorithm based on the Canny algorithm and a grayscale contour line. Firstly, the grayscale images of metallographic structure were blured with Gaussian blur,and then the initial edges with single edge effect in blured images were acquired using Canny algorithm. The thresholds were automatically calculated by the maximising variance betweenclass to reduce false edges and to obtain the basic edge for the next steps. According to the grayseale neighborhood of the end points of basic edge, the gray values of grayscale contour line were ealculated. On the basis fusion conditions of basic edge and grayscale contour line, the closing edge could be created from the end points of basic edge. Experimental results indicate that this algorithm can generate an enclosing edge efficiently. The error rate of the polyphase contents of metallographic structures has decreased to ± 1 % by using this algorithm. The proportion range of different sections about one metallographic image has increased to 5%-95%. The algorithm can satisfy the demand of quantitative analysis of the polyphase structure contents and is suitable for different shape metallographic structures.