An intelligent circuit breaker shell assembly gap detection method based on image processing

CN122048888BActive Publication Date: 2026-09-18SUZHOU MEILANRILAN ELECTRICAL CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610153573.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-02-03
Publication Date
2026-09-18
Estimated Expiration
2046-02-03

AI Technical Summary

Technical Problem

[0005]为解决上述现有固定参数的主动轮廓模型无法适应断路器外壳复杂边缘特征,导致难以兼顾抗噪性与间隙贴合精度的技术问题,本发明提供了一种基于图像处理的智能断路器外壳装配间隙检测方法,包括:对断路器外壳灰度图像执行形态学闭运算及连通域分析提取接缝连通域,对接缝连通域执行形态学细化算法及拓扑排序构建间隙序列;以间隙序列上任一像素点为目标像素点,基于目标像素点的切向量变化率与线性离散度获取像素点的曲率势能,根据目标像素点邻域内像素点的梯度方向与梯度幅值获取目标像素点的纹理熵;根据曲率势能与纹理熵获取松弛系数;所述切向量变化率根据目标像素点的前序与后序单位切向向量差值获取;所述线性离散度为序列邻域内各像素点到序列邻域内像素点拟合直线的欧氏距离平方和,其中,序列邻域为仅包含间隙序列上像素点的邻域;将间隙序列上像素点沿法线方向平移预设跨度值获取偏移点,并连接偏移点生成第一初始轮廓曲线;将间隙序列上像素点沿法线反方向平移预设跨度值获取偏移点,并连接偏移点生成第二初始轮廓曲线,对两初始轮廓曲线使用基于松弛系数改进能量泛函的主动轮廓模型,得到第一、第二轮廓曲线;根据两轮廓曲线间最大距离峰值与报警阈值判定装配间隙质量

Benefits of technology

[0020]The beneficial effects of this invention are as follows: This invention utilizes morphological closing operations to repair grayscale breaks in binarized images and combines connected component geometric feature analysis to screen seam connected components, overcoming interference caused by injection molding processes or reflections, thus providing a stable foundation for extracting the seam center skeleton; by introducing the tangent vector change rate and linear dispersion to construct curvature potential energy, and combining gradient direction distribution to calculate texture entropy, it measures the macroscopic structural bending of the contour and the stress whitening degree of the material surface, providing multi-dimensional feature basis for distinguishing real defects from imaging noise; by using relaxation coefficients to construct an improved energy functional, replacing the fixed parameter calculation method in the traditional active contour model, it spatially modulates the standard internal energy of the first and second initial contour curves point by point, maintaining high stiffness in flat areas to suppress noise, and reducing stiffness in small concave areas to promote accurate adsorption of real gap edges; by obtaining the maximum distance peak value of the evolved first and second contour curves, the maximum Euclidean distance is used to characterize the seam quality, avoiding the local defect features being masked by averaging processing, thus improving the rigor and reliability of the circuit breaker housing seam quality judgment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122048888B_ABST
    Figure CN122048888B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of image processing, and particularly relates to a kind of intelligent circuit breaker shell assembly gap detection method based on image processing, its method includes: performing morphological closing operation and connected component analysis to the circuit breaker shell gray image to extract joint connected component, construct gap sequence by morphological thinning algorithm and topological sorting;Curvature potential is obtained based on the tangent vector change rate of pixel point and linear dispersion, texture entropy is obtained according to gradient direction and gradient amplitude, relaxation coefficient is obtained according to curvature potential and texture entropy;Offset points are obtained by respectively translating preset span value of pixel points on gap sequence along positive and negative normal directions, first and second initial contour curves are generated by connecting offset points;The energy functional of active contour model is improved using relaxation coefficient and the minimum value is solved to obtain first and second contour curves;The gap quality is determined according to the maximum distance peak value between two contour curves.The present application improves detection accuracy by improving energy functional.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology. More specifically, this invention relates to a method for detecting assembly gaps in the housing of an intelligent circuit breaker based on image processing. Background Technology

[0002] In the precision manufacturing and assembly process of circuit breaker housings, measuring the width of the gap at the mold joint is a crucial step in evaluating the product's protection level and assembly quality. Its core function is to accurately monitor the fit of the housing edges, ensuring that defective products with assembly gaps exceeding design tolerances can be identified and intercepted in a timely manner. This ensures that the finished product will not cause safety accidents such as internal component moisture, electrical short circuits, or mechanical structure failures due to inadequate sealing during subsequent use.

[0003] Existing circuit breaker enclosure joint inspection equipment generally employs machine vision technology and utilizes active contour modeling algorithms to extract joint edges. The gap width is measured by calculating the distance between contour curves. This type of technology typically involves engineers pre-setting a set of globally unified internal energy functional weight parameters based on the image features of standard samples during the production line commissioning phase. These parameters determine the stiffness and elasticity of the contour curve during its evolution. During batch inspection, the computing unit drives the contour curve to strictly adhere to these pre-set physical characteristic parameters, combined with image gradient guidance, to approach the joint edge region, thereby obtaining the geometric contour of the gap.

[0004] However, in actual injection molding and assembly production processes, the optical characteristics and geometric morphology of the circuit breaker housing seam area exhibit a highly non-uniform distribution due to fluctuations in the injection molding process, differences in thermal shrinkage during demolding and cooling, and the reflective properties of the material. This is often accompanied by macroscopic wavy structural bending and chaotic texture gradients caused by assembly extrusion. Under such complex conditions, active contour models with fixed parameters cannot perceive the dynamic changes in local curvature and texture features of the seam area, making it difficult to adjust the stiffness characteristics of the contour curve accordingly. This results in the algorithm failing to achieve a balance between suppressing background noise and conforming to the actual minute gaps. This contour positioning deviation caused by the lack of spatial adaptive adjustment capability directly leads to deviations in the measured gap width from the true value, resulting in an increased misjudgment rate on the production line and failing to meet the stringent quality control requirements of high-precision automated production. Summary of the Invention

[0005] To address the technical problem that existing fixed-parameter active contour models cannot adapt to the complex edge features of circuit breaker housings, resulting in a difficulty in balancing noise resistance and gap fitting accuracy, this invention provides an image processing-based intelligent circuit breaker housing assembly gap detection method. The method includes: performing morphological closing operations and connected component analysis on a grayscale image of the circuit breaker housing to extract the seam connected components; performing morphological thinning algorithms and topological sorting on the seam connected components to construct a gap sequence; taking any pixel in the gap sequence as the target pixel, obtaining the curvature potential energy of the pixel based on the tangent vector change rate and linear dispersion of the target pixel; obtaining the texture entropy of the target pixel based on the gradient direction and gradient magnitude of pixels in its neighborhood; and obtaining the relaxation coefficient based on the curvature potential energy and texture entropy. The rate of change of the tangent vector is obtained based on the difference between the preceding and succeeding unit tangent vectors of the target pixel; the linear dispersion is the sum of squared Euclidean distances from each pixel in the sequence neighborhood to the fitted straight line of the pixel in the sequence neighborhood, wherein the sequence neighborhood is the neighborhood containing only the pixels in the gap sequence; the pixels in the gap sequence are translated along the normal direction by a preset span value to obtain offset points, and the offset points are connected to generate the first initial contour curve; the pixels in the gap sequence are translated along the opposite direction of the normal by a preset span value to obtain offset points, and the offset points are connected to generate the second initial contour curve; an active contour model based on the relaxation coefficient improved energy functional is used on the two initial contour curves to obtain the first and second contour curves; the assembly gap quality is determined based on the maximum distance peak value between the two contour curves and the alarm threshold.

[0006] This invention addresses the limitation of localized grayscale breaks in the joint area of ​​circuit breaker housing images caused by injection molding processes or reflective properties. It performs topological restoration on the binarized image using morphological closing operations and filters the joint connected components based on pixel area and minimum bounding rectangle aspect ratio features, providing a continuous and reliable data foundation for subsequent skeleton extraction and gap sequence generation. By calculating the curvature potential energy and texture entropy of target pixels, the structural curvature of the contour and the stress whitening degree of the material surface are quantified, effectively distinguishing between macroscopic curvature reflecting assembly quality and imaging noise affecting detection accuracy. Through fusion... The curvature potential energy and texture entropy generate relaxation coefficients, and an improved energy functional is constructed to dynamically weight and modulate the standard internal energy term, driving the evolution of the first and second contour curves. This allows the contour curves to automatically reduce stiffness to absorb the real gap edges when encountering geometric curvature or stress texture features, while maintaining high stiffness in flat areas for smooth transition. This invention determines the quality of the circuit breaker housing joint by calculating the maximum distance peak of the full path pixel width sequence generated by the evolved first and second contour curves, effectively solving the problem that traditional fixed parameter models cannot balance smoothness and the fitting accuracy of small gaps.

[0007] Preferably, the process of performing a morphological thinning algorithm and topological sorting on the connected domain of the seam to construct a gap sequence includes: performing a morphological thinning algorithm on the connected domain of the seam to erode the connected domain of the seam into a seam center skeleton with a width of one pixel, and performing topological sorting on the pixels on the seam center skeleton using a contour tracking algorithm to generate a gap sequence with continuous positions.

[0008] Preferably, the tangent vector change rate is obtained based on the difference between the preceding and following unit tangent vectors of the target pixel, including: in the gap sequence, selecting a single point with an index position before the target pixel as the preceding neighboring pixel, and selecting a single point with an index position after the target pixel as the following neighboring pixel; constructing a coordinate difference vector from the preceding neighboring pixel to the target pixel based on the difference in the horizontal and vertical coordinates between the target pixel and the preceding neighboring pixel, and performing magnitude normalization processing to obtain the preceding unit tangent vector; constructing a coordinate difference vector from the target pixel to the following neighboring pixel based on the difference in the horizontal and vertical coordinates between the following neighboring pixel and the target pixel, and performing magnitude normalization processing to obtain the following unit tangent vector; calculating the square of the difference in magnitude between the preceding unit tangent vector and the following unit tangent vector as the tangent vector change rate of the target pixel.

[0009] Preferably, the curvature potential energy satisfies the expression: In the formula, The curvature potential energy of the target pixel. Let be the preceding unit tangent vector of the target pixel. Let be the subsequent unit tangent vector of the target pixel. This is the normalized linear dispersion within the neighborhood of the target pixel sequence, and its value is the linear dispersion of the target pixel divided by the square of the Euclidean distance between the first and last pixels in the index order within the neighborhood of the target pixel sequence. This represents the operation of vector magnitude.

[0010] This invention obtains curvature potential energy by calculating the rate of change of the tangent vector and the linear dispersion of the neighborhood. This energy can identify structural bending in the joint area of ​​the circuit breaker housing, distinguishing between actual gap defects and imaging noise or material variations. This curvature potential energy provides a basis for adaptive profile stiffness adjustment, enabling the profile to maintain high stiffness in flat areas to suppress noise, and reducing stiffness in defect areas for precise fit. This improves the accuracy of gap detection and lays the foundation for generating relaxation coefficients.

[0011] Preferably, obtaining the texture entropy of the target pixel based on the gradient direction and gradient magnitude of pixels in the neighborhood of the target pixel includes: selecting pixels in the neighborhood of the target pixel whose gradient magnitude is greater than a preset noise threshold as valid pixels; statistically analyzing the gradient direction distribution of valid pixels in the neighborhood of the target pixel, and calculating the Shannon entropy of valid pixels in the neighborhood of the target pixel according to the definition of information entropy; and calculating the texture entropy of the target pixel using the Shannon entropy of valid pixels in the neighborhood of the target pixel, the arithmetic mean of the gradient magnitudes of pixels in the neighborhood of the target pixel, and the arithmetic mean of the global gradient magnitudes of the grayscale image of the circuit breaker casing.

[0012] Preferably, the texture entropy satisfies the expression: In the formula, The texture entropy of the target pixel; Shannon entropy is the gradient direction distribution of effective pixels in the neighborhood of the target pixel. It is the arithmetic mean of the gradient magnitudes of pixels in the neighborhood of the target pixel; This is the arithmetic mean of the global gradient magnitude of the grayscale image of the circuit breaker casing. To prevent constants with a denominator of zero.

[0013] This invention obtains texture entropy by calculating the gradient direction distribution and the mean amplitude, which characterizes the degree of material stress whitening in the joint area of ​​the circuit breaker housing. It effectively identifies changes in the optical properties of the housing surface caused by assembly pressure, provides a basis for distinguishing between the real gap and surface optical interference, and reduces the misjudgment rate caused by surface reflection and stress whitening of the injection molded housing to gap detection.

[0014] Preferably, the relaxation coefficient satisfies the expression: In the formula, The relaxation coefficient for the target pixel; The curvature potential energy of the target pixel; The texture entropy of the target pixel; Gain parameters used to control the slope of the curve; Represented by natural constant Operations on exponential functions with base 0.

[0015] This invention generates a relaxation coefficient by fusing curvature potential energy and texture entropy, providing a stiffness adjustment basis for the active contour model in circuit breaker housing assembly gap detection. It maintains high stiffness in the straight joint area to suppress noise interference, and reduces stiffness in the structurally curved area to enhance edge fitting ability. This effectively balances the contradiction between noise resistance and contour fitting accuracy, improving the stability and reliability of gap detection.

[0016] Preferably, the step of using an active contour model based on an improved energy functional with relaxation coefficients to obtain the first and second contour curves includes: integrating the first and second initial contour curves into a merged curve; calculating the global cumulative value of the sum of the modulation internal constraint energy and the standard external energy of each pixel on the merged curve to obtain the total energy of the improved energy functional; using the gradient descent method to iteratively minimize the total energy, driving the first and second initial contour curves to move towards the true boundary of the seam; if the difference in total energy between two adjacent iterations is less than a preset convergence threshold, outputting the final first and second contour curves.

[0017] Preferably, the improved energy functional includes: In the formula, To improve the total energy value of the energy functional; This represents the total number of pixels included in the merged curve. For the pixel index on the merge curve; For the first curve on the merged curve The relaxation coefficient of each pixel; For the first curve on the merged curve Standard internal energy of each pixel; For the first curve on the merged curve Standard external energy for each pixel.

[0018] The improved energy functional driven profile adaptively fits the real gap edge constructed in this invention, which enables the detection of assembly gaps in circuit breaker housings to have good adaptability in the joint area. While suppressing background noise, it accurately captures the physical boundary of tiny gaps, solving the problem that traditional fixed parameter active profile models cannot balance noise resistance and edge fitting accuracy, and improving the reliability of assembly gap detection.

[0019] Preferably, the step of determining the assembly gap quality based on the distance between the two contour curves and the alarm threshold includes: obtaining the coordinate values ​​of the first contour curve and the second contour curve at each corresponding index position; calculating the Euclidean distance between each pair of corresponding coordinate points, and forming a full path pixel width sequence with all calculated distance values, and selecting the distance value with the largest value as the maximum distance peak value; when the maximum distance peak value is less than or equal to the preset alarm threshold, determining that the current circuit breaker housing joint quality is qualified; when the maximum distance peak value is greater than the preset alarm threshold, determining that the current circuit breaker housing joint quality is unqualified.

[0020] The beneficial effects of this invention are as follows: This invention utilizes morphological closing operations to repair grayscale breaks in binarized images and combines connected component geometric feature analysis to screen seam connected components, overcoming interference caused by injection molding processes or reflections, thus providing a stable foundation for extracting the seam center skeleton; by introducing the tangent vector change rate and linear dispersion to construct curvature potential energy, and combining gradient direction distribution to calculate texture entropy, it measures the macroscopic structural bending of the contour and the stress whitening degree of the material surface, providing multi-dimensional feature basis for distinguishing real defects from imaging noise; by using relaxation coefficients to construct an improved energy functional, replacing the fixed parameter calculation method in the traditional active contour model, it spatially modulates the standard internal energy of the first and second initial contour curves point by point, maintaining high stiffness in flat areas to suppress noise, and reducing stiffness in small concave areas to promote accurate adsorption of real gap edges; by obtaining the maximum distance peak value of the evolved first and second contour curves, the maximum Euclidean distance is used to characterize the seam quality, avoiding the local defect features being masked by averaging processing, thus improving the rigor and reliability of the circuit breaker housing seam quality judgment. Attached Figure Description

[0021] Figure 1 This is a flowchart of an image processing-based method for detecting assembly gaps in the housing of an intelligent circuit breaker, as described in this invention. Figure 2 This is a schematic diagram of the tangent vector change; Figure 3 It is an image of the circuit breaker casing; Figure 4 It is a contour evolution diagram. Detailed Implementation

[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0023] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0024] This invention discloses a method for detecting assembly gaps in the housing of an intelligent circuit breaker based on image processing, referring to... Figure 1 This includes steps S1 to S6: S1. Acquire images of the circuit breaker casing and extract the gap sequence of the joint at the casing mold closing point using connected domain geometric features analysis.

[0025] It should be noted that during the production of circuit breaker housings, factors such as injection molding processes and surface reflectivity can cause localized grayscale breaks or blurring interference in the seam areas of the acquired images. Although such localized grayscale breaks do not represent the true discreteness of the physical assembly structure of the circuit breaker housing, they can affect the connected component extraction results obtained when identifying seam areas, causing subsequent area-based filtering algorithms to fail to completely extract the seam areas. Therefore, this invention utilizes morphological closing operations to perform topological repair on the binarized image before performing connected component analysis.

[0026] Specifically, an image of the circuit breaker casing is acquired and converted to grayscale to obtain a grayscale image of the circuit breaker casing. This grayscale image is then binarized to generate a binarized image. Rectangular structural elements of a preset size are constructed, and morphological closing operations are performed on the binarized image. Connectivity analysis is then performed on the binarized image after the closing operation, calculating the aspect ratio of the minimum bounding rectangle for each connected region. The connected region with the largest minimum bounding rectangle aspect ratio is selected and marked as the seam connected region, while other connected regions are filtered out. A morphological thinning algorithm is then applied to the seam connected region, eroding it into a single-pixel-width seam center skeleton. Finally, a contour tracking algorithm is used to perform topological sorting on the pixels on the seam center skeleton, generating a sequence of consecutively positioned gaps.

[0027] It should be added that the circuit breaker joints exhibit a continuous, slender strip shape, which distinguishes them from speckled noise and blocky slot structures. By selecting the connected regions with the largest aspect ratios and utilizing their geometric extension characteristics to eliminate interference, the joint locations are located, providing a basis for skeleton extraction.

[0028] The side length of the rectangular structural element determines the spatial scale of topology repair, with an empirical range of values. In this embodiment, the side length of the rectangular structural element is set to 3 pixels. In other embodiments, implementers can set the side length of the rectangular structural element according to the actual implementation situation. For example, when the gaps in the image are large, the side length can be appropriately increased to ensure connectivity; when it is necessary to retain small details, the side length can be appropriately decreased to avoid over-smoothing.

[0029] S2. Calculate the curvature potential energy of the target pixels on the gap sequence to characterize the degree of structural curvature of the contour.

[0030] It should be noted that during the demolding and cooling process, the circuit breaker housing may exhibit a gentle, wavy structural bend at its edge due to the release of internal stress. Both this wavy bend and the sawtooth jitter caused by imaging noise are manifested as changes in curvature values. However, the former is a key feature reflecting assembly quality, while the latter is an interference signal that affects detection accuracy. Therefore, this invention uses the linearity index of local straight-line fitting as a constraint term for curvature calculation to distinguish between macroscopic bending and microscopic jitter.

[0031] Specifically, any pixel in the gap sequence is taken as the target pixel. In the gap sequence, a single point with an index position before the target pixel is selected as the preceding neighbor pixel, and a single point with an index position after the target pixel is selected as the following neighbor pixel.

[0032] Based on the differences in the x-coordinate and y-coordinate between the target pixel and its preceding neighboring pixels, a coordinate difference vector is constructed pointing from the preceding neighboring pixels to the target pixel. This vector is then normalized to its magnitude to obtain the preceding unit tangential vector. Similarly, based on the differences in the x-coordinate and y-coordinate between the target pixel and its following neighboring pixels, a coordinate difference vector is constructed pointing from the target pixel to its following neighboring pixels. This vector is then normalized to its magnitude to obtain the following unit tangential vector.

[0033] The square of the difference between the preceding and following unit tangent vectors is calculated as the rate of change of the tangent vector of the target pixel. A sequence neighborhood centered on the target pixel is selected from the gap sequence. A linear fit is performed on the pixels within this neighborhood using the least squares method to obtain the fitted line. The sequence neighborhood contains only the Z pixels from the gap sequence. The sum of the squares of the Euclidean distances from each pixel within the sequence neighborhood to the fitted line is obtained as the linear dispersion. The Euclidean distance between the starting and ending pixels in the sequence neighborhood of the target pixel is calculated as the neighborhood span. The normalized linear dispersion is obtained by dividing the linear dispersion by the square of the neighborhood span. The curvature potential energy of the target pixel is calculated based on the rate of change of the tangent vector and the normalized linear dispersion.

[0034] It should be noted that since the beginning and end points of the gap sequence naturally lack preceding or following neighboring pixels, including them in the calculation would lead to missing data references or index out-of-bounds errors. Therefore, the target pixel does not include the beginning and end points of the gap sequence.

[0035] In this embodiment, Z is set to 5, meaning the sequence neighborhood contains only 5 consecutive pixels from the gap sequence within the neighborhood centered on the target pixel. In other embodiments, the implementer can adjust the number of pixels included in the sequence neighborhood according to the actual implementation situation.

[0036] Specifically, the curvature potential energy of the target pixel satisfies the expression: ; In the formula, The curvature potential energy of the target pixel. Let be the preceding unit tangent vector of the target pixel. Let be the subsequent unit tangent vector of the target pixel. This is the normalized linear dispersion within the neighborhood of the target pixel sequence, and its value is the linear dispersion of the target pixel divided by the square of the Euclidean distance between the first and last pixels in the index order within the neighborhood of the target pixel sequence. This represents the operation of vector magnitude.

[0037] in, Represents the rate of change of the tangent vector. The larger the value, the more drastic the change in the tangent direction at the target pixel in the gap sequence extension trend, and the higher the degree of geometric curvature. The larger the value, the higher the probability that the target pixel will be identified as a geometric inflection point; The smaller the value, the slower the change in the tangent direction at the target pixel, tending towards a straight line, making... The smaller the value, the higher the probability that the target pixel will be identified as a flat region.

[0038] For example, Figure 2 This is a schematic diagram of tangent vector changes. In the upper part of the image, where the gap sequence shows greater curvature, the preceding unit tangent vector... With the subsequent unit tangential vector The difference lies in the direction, which leads to their difference. The relatively large magnitude indicates that the tangent direction at the target pixel changes along the extension trend of the gap sequence, resulting in a relatively high degree of geometric curvature. Therefore, the target pixel is more likely to be identified as a geometric inflection point. Conversely, in the flat region of the gap sequence shown in the lower part of the image, the preceding unit tangent vector... With the subsequent unit tangential vector The directions tend to be consistent, making their differences The relatively small modulus indicates that the tangent direction at the target pixel changes little, tends to be a straight line, has a relatively low degree of geometric curvature, and the probability of the target pixel being judged as a flat region is relatively high. Figure 2 The demonstration showed that the magnitude of the difference between the preceding and following unit tangential vectors can reflect the degree of geometric curvature at the target pixel in the gap sequence.

[0039] This represents the adaptive linear suppression term, where the constant 1 is the baseline regularization factor, used to set the suppression baseline under noise-free conditions and prevent the denominator from being zero. The larger the value, the greater the average deviation of the pixels in the neighborhood of the target pixel sequence from the fitted line, indicating a more severe degree of interference from jagged high-frequency noise in that region. This results in a larger denominator value and a greater impact on curvature potential energy. The stronger the suppression effect, the more effectively it can shield the pseudo-curvature signal caused by imaging jitter. The smaller the value, the denser and smoother the distribution of pixels in the neighborhood of the target pixel sequence. This indicates a higher reliability of the region as a smooth straight line segment or a structurally curved segment, reflecting a real physical structure. Consequently, the denominator term approaches the reference constant 1 more closely, thus affecting the geometric curvature potential energy. The weaker the interference suppression, the more accurate the preservation of the true geometric deformation details of the target pixel.

[0040] S3. Calculate the texture entropy of each target pixel on the gap sequence to characterize the stress whitening degree of the material.

[0041] It should be noted that when the circuit breaker housing material is subjected to excessive compression or tensile stress, the texture gradient on the material surface will become disordered due to changes in molecular structure and other reasons. This texture gradient change may not form a significant fracture in the macroscopic geometry, but it will affect the judgment of potential structural defects in the product. This invention uses information entropy to measure the degree of disorder in texture distribution to assist in the detection of stress defects.

[0042] Specifically, the Sobel gradient operator is used to perform convolution operations on the grayscale image of the circuit breaker enclosure to calculate the gradient magnitude and gradient direction angle of each pixel in the grayscale image. The gradient direction angle is mapped to a half-cycle value range of 0 degrees to 180 degrees, and the range is divided into K equally spaced direction intervals. A neighborhood of the target pixel is constructed with the target pixel as the center and the side length as the preset neighborhood size. Pixels in the neighborhood of the target pixel whose gradient magnitude is greater than a preset noise threshold are marked as valid pixels. The number of gradient direction angles of all valid pixels in the neighborhood of the target pixel that enter each direction interval is counted and divided by the total number of valid pixels in the neighborhood of the target pixel to obtain the gradient direction distribution of the valid pixels in the neighborhood of the target pixel. Calculate the Shannon entropy of the gradient direction distribution of effective pixels in the neighborhood of the target pixel. Calculate the texture entropy of the target pixel based on the Shannon entropy of the gradient direction distribution of effective pixels in the neighborhood of the target pixel, the average local gradient magnitude of pixels in the neighborhood of the target pixel, and the average global gradient magnitude of the grayscale image of the circuit breaker casing.

[0043] In this embodiment, the preset neighborhood size is set to 5×5 pixels, the preset noise threshold is set to 20, and the number of directional intervals is [not specified]. Set to 18. In other embodiments, implementers can set preset parameters according to the actual implementation situation. For example, when the area of ​​the stress whitening region to be detected is large, the neighborhood size can be appropriately increased to obtain more macroscopic statistical features; when the overall signal-to-noise ratio of the acquired image is low, the noise threshold can be appropriately increased to reduce false judgments; when it is necessary to capture more subtle changes in texture direction, the K value can be appropriately increased to improve angular resolution.

[0044] Specifically, the texture entropy of the target pixel satisfies the expression: ; In the formula, The texture entropy of the target pixel; Shannon entropy is the gradient direction distribution of effective pixels in the neighborhood of the target pixel. It is the arithmetic mean of the gradient magnitudes of pixels in the neighborhood of the target pixel; This is the arithmetic mean of the global gradient magnitude of the grayscale image of the circuit breaker casing. To prevent constants with a denominator of zero, in this embodiment, The value is set to 10 to the power of negative 6; implementers can adjust this value according to the actual situation. .

[0045] in, This reflects the disorder of gradient direction. The larger the value, the more uniform and chaotic the gradient direction distribution around the target pixel is, and the higher the possibility that there are microcracks or stress whitening phenomena at the location of the target pixel. The larger the value of R, the higher the probability that the area where the target pixel is located is judged to be a physical stress defect. The smaller the value, the more uniform the gradient direction around the target pixel, and the smoother the surface at the location of the target pixel. The smaller R is, the higher the probability that the area where the target pixel is located is judged as a normal material surface.

[0046] This represents the amplitude contrast weighting term. The larger the value, the higher the texture contrast in the texture analysis neighborhood is compared to the global background. The higher the degree to which the texture entropy signal is amplified, the larger the texture entropy R is, and the higher the probability that the target pixel is a physical change of the solid surface. The smaller the value, the lower the contrast of the texture analysis neighborhood, the less the texture entropy signal is amplified, the smaller the texture entropy R, and the lower the probability that the target pixel is a physical change of the solid surface.

[0047] S4. The relaxation coefficient is generated by fusing curvature potential energy and texture entropy, and the first and second initial contour curves are constructed.

[0048] It should be noted that the contour shape of the circuit breaker housing seam may contain both smooth straight lines and tiny depressions due to design requirements or assembly errors. A uniform stiffness parameter does not affect the extraction of simple contours, but it will affect the evolution effect when accurately fitting such complex mixed contours. Therefore, this invention integrates geometric features with physical texture features to generate dynamically changing relaxation coefficients.

[0049] Specifically, the relaxation coefficient of the target pixel is obtained based on its curvature potential energy and texture entropy. The sum of the preceding and following unit tangent vectors of the target pixel is calculated, and this sum is normalized to obtain the unit tangent vector of the target pixel. The unit vector perpendicular to the unit tangent vector is then calculated as the normal direction of the target pixel. The target pixel is translated along the normal direction by a preset span to obtain the offset point in the normal direction; the target pixel is also translated along the opposite direction of the normal by a preset span to obtain the offset point in the opposite direction of the normal. After traversing all pixels in the gap sequence, according to the topological index order of the gap sequence, all offset points in the normal direction are sequentially connected to form a first initial contour curve, and all offset points in the opposite direction of the normal are sequentially connected to generate a second initial contour curve.

[0050] In this embodiment, the preset span value is used to set the initial distance between the first initial contour curve and the second initial contour curve relative to the seam center skeleton. The empirical range is... Pixels. In this embodiment, the preset span value is set to 10 pixels. In other embodiments, the implementer can set the preset span value according to the actual implementation situation. For example, when the estimated width of the seam to be detected is large, the value can be appropriately increased to ensure that the contour curve is located outside the seam; when the seam is thin and the background interference is close, the value can be appropriately decreased.

[0051] Specifically, the relaxation coefficient of the target pixel satisfies the expression: ; In the formula, The relaxation coefficient for the target pixel; The curvature potential energy of the target pixel; The texture entropy of the target pixel; Gain parameters used to control the slope of the curve; Represented by natural constant Operations on exponential functions with base 0.

[0052] In this embodiment, This represents a sensitivity parameter used to adjust the relaxation coefficient's response rate to changes in the feature. The empirical range is... In this embodiment, the sensitivity parameter is set to 1. In other embodiments, the implementer can set the sensitivity parameter according to the actual implementation situation. For example, when the system needs to respond drastically to weak features, this parameter can be increased appropriately; when a smooth transition is required, this parameter can be decreased appropriately.

[0053] The term represents the joint strength of geometric and physical characteristics. A larger value indicates that the target pixel is more likely to possess both obvious geometric curvature and stress texture features simultaneously. This increases the probability that the target pixel is located in a region of true stress micro-deformation, causing the exponent term to approach zero. The smaller the value, the lower the stiffness of the first and second initial contour curves at the position corresponding to the target pixel, and the higher the probability that the first and second initial contour curves will deform to fit the depression. The smaller the value, the more likely the target pixel is to have only geometric curvature features, stress texture features, or no features. The higher the probability that the target pixel belongs to a normal edge or noise, the closer the exponent term is to 1. The larger the value, the higher the stiffness of the first and second initial contour curves at the position corresponding to the target pixel, and the higher the probability that the first and second initial contour curves will maintain a smooth transition to resist noise interference.

[0054] S5. An improved energy functional is constructed based on the relaxation coefficient to drive the contour curve to iteratively evolve to the edge of the real gap.

[0055] It should be noted that active contour models typically use globally fixed elastic and stiffness coefficients to construct their internal energy terms. This fixed-parameter mechanism struggles to balance the smoothness and noise resistance requirements of the contour in flat regions with the precise fit requirements in areas with minute defects: if the parameters are set too high, the contour cannot fit into minute assembly gaps; if the parameters are set too low, the contour is easily affected by image noise, resulting in false edges. Therefore, this invention constructs an improved energy functional with spatially adaptive stiffness characteristics through relaxation coefficients, and uses dynamic weights to modulate the internal energy of the active contour model point by point, enabling the contour curve to more accurately adhere to the real gap edges.

[0056] Specifically, the relaxation coefficient is multiplied by the standard internal energy term of the active contour model algorithm to replace the fixed parameter calculation method in the standard active contour model algorithm. Combined with the standard external energy term in the active contour model algorithm, an improved energy functional is constructed. Pixels in the first and second initial contour curves are integrated and defined as a merged curve. The relaxation coefficient of each pixel on the merged curve is multiplied by the standard internal energy and summed with the standard external energy. The summation of all pixels on the merged curve is accumulated to obtain the total energy value of the improved energy functional. Addressing the nonlinear optimization characteristics of the improved energy functional, a numerical iterative method based on gradient descent is adopted. The goal of minimizing the total energy of the improved energy functional is transformed into a dynamic contour curve evolution process. Iterative calculations minimize this accumulated sum, synchronously driving the first and second initial contour curves to move towards the true boundary of the seam. During the iteration process, the total energy difference between two adjacent iterations is calculated. When this difference is less than a preset convergence threshold, the iterative calculation stops, and the final evolved first and second contour curves are output.

[0057] It should be noted that this step only makes a nonlinear improvement to the weighting method of the standard internal energy term, while retaining the definition of the standard external energy term and the variational solution framework in the existing active contour model algorithm. Since this is the standard form of the existing algorithm, the implementation principle of the existing algorithm will not be described here.

[0058] The preset convergence threshold is used to determine whether the iterative evolution has reached a stable state. The empirical range is... In this embodiment, the convergence threshold is set to 0.1. In other embodiments, implementers can set the convergence threshold according to the actual implementation situation. For example, when the detection accuracy requirement is extremely high, the threshold can be appropriately reduced to increase the number of iterations; when the online detection speed requirement is high, the threshold can be appropriately increased to shorten the calculation time.

[0059] Specifically, the improved energy functional satisfies the mathematical expression: ; In the formula, To improve the total energy value of the energy functional; This represents the total number of pixels included in the merged curve. For the pixel index on the merge curve; For the first curve on the merged curve The relaxation coefficient of each pixel; For the first curve on the merged curve Standard internal energy of each pixel; For the first curve on the merged curve Standard external energy for each pixel.

[0060] in, Indicates the first curve on the merged curve Modulation internal constraint energy of each pixel. The smaller the value, the lower the standard internal energy. The stronger the weight suppression, the more thoroughly the constraint of the improved energy functional on the geometric deformation of the merged curve is released, resulting in the contour curve at the corresponding pixel point exhibiting higher flexibility and local adaptability. Its shape retention tendency is weakened, making the contour curve at this pixel point more likely to deform under the traction of standard external energy to embed into the real assembly gap edge, promoting the fit of the tiny gap. The larger the value, the higher the standard internal energy. The higher the weight retention, the stronger the penalty for non-smooth abrupt changes in the profile curve maintained by the improved energy functional. This results in the profile curve at the corresponding pixel exhibiting stronger rigidity and overall continuity, enhancing its resistance to deformation. Consequently, the profile curve at this pixel tends to ignore noise interference such as injection mold marks or surface stains, maintaining the smooth and continuous shape that the gap edge of the circuit breaker housing should have.

[0061] For example, Figure 3 Image of the circuit breaker enclosure. Figure 4 This is a diagram showing the evolution of the outline. Figure 4 The two continuous curves extending vertically represent the first and second contour curves after evolution. Driven by the improved energy functional, they are absorbed to the actual physical edges on both sides of the circuit breaker housing seam. The region enclosed between the two curves represents the locked assembly gap range. The generation of the first and second contour curves achieves adaptive fitting of complex seam morphology, transforming discrete image gradient features into definite geometric boundaries, thus providing data support for subsequent seam quality determination based on the full path pixel width.

[0062] S6. Determine the quality of the circuit breaker housing joints based on the maximum distance peak between the first and second contour curves.

[0063] It should be noted that the failure of the circuit breaker housing seam usually stems from excessive local gaps. In order to prevent the local defect features from being masked by averaging and to meet the real-time requirements of high-speed production lines, this invention uses the maximum Euclidean distance in the pixel coordinate system as the judgment index.

[0064] Specifically, the coordinate values ​​of the first contour curve and the second contour curve at their respective index positions are obtained. The Euclidean distance between each pair of corresponding coordinate points is calculated, and all the calculated distance values ​​are combined into a full path pixel width sequence. The distance value with the largest value is selected as the maximum distance peak.

[0065] Furthermore, when the maximum distance peak value is less than or equal to the preset alarm threshold, the current circuit breaker housing joint quality is determined to be qualified; when the maximum distance peak value is greater than the preset alarm threshold, the current circuit breaker housing joint quality is determined to be unqualified.

[0066] In this embodiment, the preset alarm threshold is set to 35 pixels. In other embodiments, the implementer can adjust the preset alarm threshold according to the actual resolution of the imaging system. For example, when the magnification of the imaging system increases, the threshold should be increased accordingly to match the physical size standard.

Claims

1. A method for detecting assembly gaps in the housing of an intelligent circuit breaker based on image processing, characterized in that, include: Morphological closing operations and connected component analysis are performed on the grayscale image of the circuit breaker casing to extract the seam connected components. Morphological thinning algorithms and topological sorting are then performed on the seam connected components to construct the gap sequence. Taking any pixel in the gap sequence as the target pixel, the curvature potential energy of the pixel is obtained based on the tangent vector change rate and linear dispersion of the target pixel. The texture entropy of the target pixel is obtained based on the gradient direction and gradient magnitude of the pixels in the neighborhood of the target pixel. The relaxation coefficient is obtained based on the curvature potential energy and texture entropy. The tangent vector change rate is obtained based on the difference between the preceding and following unit tangent vectors of the target pixel. The linear dispersion is the sum of squared Euclidean distances from each pixel in the sequence neighborhood to the fitted lines of the pixels in the sequence neighborhood, where the sequence neighborhood is the neighborhood containing only the pixels in the gap sequence. The pixels in the gap sequence are translated along the normal direction by a preset span value to obtain offset points, and the offset points are connected to generate the first initial contour curve; the pixels in the gap sequence are translated along the opposite direction of the normal by a preset span value to obtain offset points, and the offset points are connected to generate the second initial contour curve; an active contour model based on the relaxation coefficient improved energy functional is used on the two initial contour curves to obtain the first and second contour curves; the assembly gap quality is determined according to the distance between the two contour curves and the alarm threshold. The process of using an active contour model based on an improved energy functional with relaxation coefficients to obtain first and second contour curves includes: integrating the first and second initial contour curves into a merged curve; calculating the global cumulative value of the sum of the modulation internal constraint energy and the standard external energy of each pixel on the merged curve to obtain the total energy of the improved energy functional; iteratively minimizing the total energy using the gradient descent method to drive the first and second initial contour curves to move towards the true boundary of the seam; and outputting the final first and second contour curves if the difference in total energy between two adjacent iterations is less than a preset convergence threshold.

2. The method for detecting assembly gaps in the housing of an intelligent circuit breaker based on image processing according to claim 1, characterized in that, The process of performing a morphological thinning algorithm and topological sorting on the connected domain of the seam to construct a gap sequence includes: performing a morphological thinning algorithm on the connected domain of the seam to erode the connected domain of the seam into a seam center skeleton with a width of one pixel; and performing topological sorting on the pixels on the seam center skeleton using a contour tracking algorithm to generate a gap sequence with continuous positions.

3. The method for detecting assembly gaps in the housing of an intelligent circuit breaker based on image processing according to claim 1, characterized in that, The tangent vector change rate is obtained based on the difference between the preceding and following unit tangent vectors of the target pixel, including: in the gap sequence, selecting a single point with an index position before the target pixel as the preceding neighbor pixel, and selecting a single point with an index position after the target pixel as the following neighbor pixel; constructing a coordinate difference vector from the preceding neighbor pixel to the target pixel based on the difference in the horizontal and vertical coordinates between the target pixel and the preceding neighbor pixel, and performing magnitude normalization processing to obtain the preceding unit tangent vector; constructing a coordinate difference vector from the target pixel to the following neighbor pixel based on the difference in the horizontal and vertical coordinates between the following neighbor pixel and the target pixel, and performing magnitude normalization processing to obtain the following unit tangent vector; calculating the square of the difference magnitude between the preceding and following unit tangent vectors as the tangent vector change rate of the target pixel.

4. The method for detecting assembly gaps in the housing of an intelligent circuit breaker based on image processing according to claim 1, characterized in that, The curvature potential energy satisfies the expression: ; In the formula, The curvature potential energy of the target pixel. Let be the preceding unit tangent vector of the target pixel. Let be the subsequent unit tangent vector of the target pixel. This is the normalized linear dispersion within the neighborhood of the target pixel sequence, and its value is the linear dispersion of the target pixel divided by the square of the Euclidean distance between the first and last pixels in the index order within the neighborhood of the target pixel sequence. This represents the operation of vector magnitude.

5. The method for detecting assembly gaps in the housing of an intelligent circuit breaker based on image processing according to claim 1, characterized in that, The step of obtaining the texture entropy of the target pixel based on the gradient direction and gradient magnitude of the pixels in the neighborhood of the target pixel includes: selecting pixels in the neighborhood of the target pixel whose gradient magnitude is greater than a preset noise threshold as valid pixels; statistically analyzing the gradient direction distribution of the valid pixels in the neighborhood of the target pixel, and calculating the Shannon entropy of the valid pixels in the neighborhood of the target pixel according to the definition of information entropy; and calculating the texture entropy of the target pixel using the Shannon entropy of the valid pixels in the neighborhood of the target pixel, the arithmetic mean of the gradient magnitudes of the pixels in the neighborhood of the target pixel, and the arithmetic mean of the global gradient magnitudes of the grayscale image of the circuit breaker casing.

6. The method for detecting assembly gaps in the housing of an intelligent circuit breaker based on image processing according to claim 5, characterized in that, The texture entropy satisfies the expression: ; In the formula, The texture entropy of the target pixel; Shannon entropy is the gradient direction distribution of effective pixels in the neighborhood of the target pixel. It is the arithmetic mean of the gradient magnitudes of the pixels in the neighborhood of the target pixel; This is the arithmetic mean of the global gradient magnitude of the grayscale image of the circuit breaker casing. To prevent constants with a denominator of zero.

7. The method for detecting assembly gaps in the housing of an intelligent circuit breaker based on image processing according to claim 1, characterized in that, The relaxation coefficient satisfies the expression: ; In the formula, The relaxation coefficient for the target pixel; The curvature potential energy of the target pixel; The texture entropy of the target pixel; Gain parameters used to control the slope of the curve; Represented by natural constant Operations on exponential functions with base 0.

8. The method for detecting assembly gaps in the housing of an intelligent circuit breaker based on image processing according to claim 1, characterized in that, The improved energy functional satisfies the expression: ; In the formula, To improve the total energy value of the energy functional; This represents the total number of pixels included in the merged curve. For the pixel index on the merge curve; For the first curve on the merged curve The relaxation coefficient of each pixel; For the first curve on the merged curve Standard internal energy of each pixel; For the first curve on the merged curve Standard external energy for each pixel.

9. The method for detecting assembly gaps in the housing of an intelligent circuit breaker based on image processing according to claim 1, characterized in that, The method of determining the assembly gap quality based on the distance between the two contour curves and the alarm threshold includes: obtaining the coordinate values ​​of the first contour curve and the second contour curve at each corresponding index position; calculating the Euclidean distance between each pair of corresponding coordinate points, and forming a full path pixel width sequence with all calculated distance values, and selecting the distance value with the largest value as the maximum distance peak value; when the maximum distance peak value is less than or equal to the preset alarm threshold, the current circuit breaker housing joint quality is determined to be qualified; when the maximum distance peak value is greater than the preset alarm threshold, the current circuit breaker housing joint quality is determined to be unqualified.

Citation Information

Patent Citations

  • Welding seam gap measuring method, medium and equipment

    CN119559234A

  • Forging heat treatment deformation detection method and system

    CN121304664A