An industrial vision-based industrial control cabinet quality detection method and system
Patent Information
- Application Number
- CN202611171629.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-04
- Publication Date
- 2026-10-27
AI Technical Summary
[0003]传统的工控机柜质量检测方法,虽然能够通过拍照记录、图像比对和人工检验数据归档,对工控机柜是否满足设计要求和装配规范进行确认,但是,在自动化产线连续检测过程中,工控机柜的定位孔可能因遮挡、边缘缺失、成像角度变化或整体位置偏移而出现识别不稳定的情况
本发明通过定位孔局部失真度对边缘断裂、首尾闭合偏差、轮廓离散程度、遮挡比例和参照距离偏差进行综合表征,使定位孔异常不再仅以图像是否相似来判断,而是能够转化为可比较的失真程度;同时,结合参照部件图像区分机柜整体位置变化和定位孔识别偏差,使正常状态、待修正状态和异常状态分别对应不同的坐标确定方式。由此,在定位孔清晰时能够以常规机柜坐标系完成质量判断,在定位孔存在可修正偏差时能够以修正后的机柜坐标系继续判断,在定位孔异常时能够利用备用参考点形成重建后的机柜坐标系,进而通过机柜位姿评估标签把位姿偏差转化为合格、待复检和不合格的检测结果。该方案起到了增强自动化产线质量检测连续性、提高定位孔异常场景下位姿判断可靠性、细化工控机柜质量判定层级的作用。
Smart Images

Figure CN122989629A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual inspection technology, and in particular to a method and system for quality inspection of industrial control cabinets based on industrial vision. Background Technology
[0002] Traditional industrial control cabinet quality inspection methods refer to quality confirmation methods for industrial control cabinets during the production assembly and factory inspection processes. The focus of these methods typically includes cabinet structure, component installation, wiring areas, labeling status, and overall appearance, as well as other aspects related to the quality of the industrial control cabinet. They usually combine image acquisition, measuring tools, photographic recording, image comparison, and inspection data archiving to confirm whether the industrial control cabinet meets design requirements, assembly specifications, and inspection requirements.
[0003] Traditional industrial control cabinet quality inspection methods, while capable of confirming whether cabinets meet design requirements and assembly specifications through photographic recording, image comparison, and manual inspection data archiving, suffer from instability in identification during continuous inspection on automated production lines. Issues such as obstruction, missing edges, changes in imaging angle, or overall positional shifts in the positioning holes can lead to inconsistent identification. In such cases, traditional methods rely heavily on one-time comparisons of appearance or partial images, failing to distinguish between localized distortions of the positioning holes and overall cabinet positional changes. Furthermore, they struggle to obtain coordinate data for pose determination when positioning holes are abnormal. This results in quality inspection results that are merely rough assessments of pass or fail, lacking corresponding support for determining intermediate states requiring re-inspection, correction, or coordinate reconstruction. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of existing technologies and to propose a method and system for quality inspection of industrial control cabinets based on industrial vision.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: a method for quality inspection of industrial control cabinets based on industrial vision, comprising the following steps: The system acquires images of the current industrial control cabinet on the automated production line, identifies the positioning holes of the industrial control cabinet and the images of the reference components adjacent to the positioning holes in the image, and calculates the local distortion of the positioning holes in the current industrial control cabinet image. Obtain the set of auxiliary reference pixel coordinates in the reference component image, and combine it with the local distortion of the positioning hole to determine the status of the positioning hole in the current industrial control cabinet image; Determine the rack coordinate system corresponding to the positioning holes in their respective states; Determine the rack pose evaluation label corresponding to the rack coordinate system; The quality of the industrial control cabinet is evaluated by referring to the cabinet coordinate system and the corresponding cabinet pose, and the quality inspection results of the industrial control cabinet are generated.
[0006] As a further aspect of the present invention, the step of acquiring the current industrial control cabinet image on the automated production line, identifying the positioning holes of the industrial control cabinet and the adjacent reference component images in the industrial control cabinet image, and calculating the local distortion of the positioning holes in the current industrial control cabinet image includes: The system acquires images of the current industrial control cabinet on the automated production line using an industrial camera, identifies the positioning holes and their edge contours in the current industrial control cabinet image, counts all pixels at the edge contours of the positioning holes, generates an edge pixel set, and simultaneously extracts reference component images adjacent to the positioning holes from the current industrial control cabinet image. The system obtains the cabinet frame edge pixel coordinates, hole and slot contour pixel coordinates, and cabinet outer contour pixel coordinates from the reference component images, thus obtaining a basic reference pixel coordinate set. Calculate the Euclidean distance between adjacent pixels in the edge pixel set, filter pixels whose Euclidean distance is greater than a preset connected pixel distance threshold as broken pixels, accumulate the Euclidean distances of all broken pixels to obtain the length of the broken part, obtain the first and last pixels in the edge pixel set, calculate the first-to-last distance between the first and last pixels, fit the center pixel coordinates and ellipse circumference of the positioning hole using an ellipse fitting algorithm with reference to the edge pixel set, calculate the distance variance between each pixel in the edge pixel set and the center pixel coordinates, calculate the ratio between the length of the broken part and the ellipse circumference as the local occlusion ratio, calculate the actual distance between the center pixel coordinates and the hole groove contour pixel coordinates in the basic reference pixel coordinate set, and calculate the distance difference between the actual distance and the preset standard pixel distance; The length of the fractured portion, the distance between the beginning and end, the distance variance, the local occlusion ratio, and the distance difference are normalized respectively. The weighted sum of the normalized fractured portion length, the normalized beginning and end distance, the normalized distance variance, the normalized local occlusion ratio, and the normalized distance difference is calculated as the local distortion of the positioning hole in the current industrial control cabinet image.
[0007] As a further aspect of the present invention, the step of obtaining the set of auxiliary reference pixel coordinates in the reference component image and determining the state of the positioning holes in the current industrial control cabinet image, in conjunction with the local distortion of the positioning holes, includes: By combining the pixel coordinates of the cabinet frame edge, the pixel coordinates of the slot outline, and the pixel coordinates of the cabinet outer outline, an auxiliary reference pixel coordinate set is obtained; The average coordinates of the cabinet frame edge pixel coordinates, the hole and slot contour pixel coordinates, and the cabinet outer contour pixel coordinates in the auxiliary reference pixel coordinate set are calculated to obtain the geometric center pixel coordinates. The coordinate difference between the center pixel coordinates of the positioning hole and the geometric center pixel coordinates is calculated. When the coordinate difference is greater than the preset pixel difference threshold, the coordinate difference is determined as the overall position change of the cabinet. When the coordinate difference is less than or equal to the preset pixel difference threshold, the coordinate difference is determined as the positioning hole recognition deviation. When the change in the overall position of the cabinet is determined to be a certain amount and the local distortion of the positioning hole is less than or equal to a preset distortion degree judgment threshold, the positioning hole position in the current industrial control cabinet image is determined to be in a normal state. When the deviation in the positioning hole recognition is determined to be a certain amount and the local distortion of the positioning hole is less than or equal to the distortion degree judgment threshold, the positioning hole position in the current industrial control cabinet image is determined to be in a state to be corrected. When the local distortion of the positioning hole is greater than the distortion degree judgment threshold, the positioning hole position in the current industrial control cabinet image is determined to be in an abnormal state.
[0008] As a further aspect of the present invention, determining the cabinet coordinate system corresponding to the positioning hole in its respective state includes: Pixels in the edge pixel set whose Euclidean distance is less than or equal to a preset connectivity distance threshold are selected to obtain a set of connected pixels. The set of connected pixels is combined as an effective edge pixel segment. A coordinate system reconstruction path based on an auxiliary reference pixel coordinate set is obtained. At the same time, the pixel coordinates of the backup reference points in the coordinate system reconstruction path are obtained. The pixel coordinates of the backup reference points are selected according to the order of the coordinate system reconstruction path and correspond to the edge of the cabinet frame, the outline of the slot, or the outer outline of the cabinet. Obtain the intrinsic and extrinsic parameter matrices of the industrial camera, calculate the product of the intrinsic and extrinsic parameter matrices to obtain the spatial coordinate transformation matrix, and for the positioning holes belonging to the normal state, calculate the slope of the line connecting the pixel coordinates of the corresponding cabinet frame edge and the pixel coordinates of the hole groove contour as the initial planar attitude angle. Call the spatial coordinate transformation matrix to map the center pixel coordinates of the positioning hole to the initial center physical coordinates and the initial planar attitude angle to the initial physical attitude angle. Combine the initial center physical coordinates and the initial physical attitude angle as the conventional cabinet coordinate system. For the positioning holes belonging to the state to be corrected, the reference center pixel coordinates of the positioning holes are fitted according to the effective edge pixel segments using an ellipse fitting algorithm. The slope of the line connecting the edge pixel coordinates of the computer cabinet frame and the outer contour pixel coordinates of the cabinet is used as the reference plane attitude angle. The spatial coordinate transformation matrix is called to map the reference center pixel coordinates to the reference center physical coordinates and the reference plane attitude angle to the reference physical attitude angle. The reference center physical coordinates and the reference physical attitude angle are combined to form the cabinet coordinate system after position correction. For the positioning holes belonging to the abnormal state, the spatial coordinate transformation matrix is called to map the pixel coordinates of the backup reference point to the backup physical coordinates, and the backup physical coordinates are combined as the reconstructed cabinet coordinate system.
[0009] As a further aspect of the present invention, the determination of the rack pose evaluation label corresponding to the rack coordinate system includes: Obtain the current pose parameters of the conventional rack coordinate system and the position-corrected rack coordinate system or the reconstructed rack coordinate system in the preset global reference coordinate system; The difference between the current pose parameters and the preset standard pose parameters of the cabinet coordinate system is calculated as the pose deviation difference. The ratio between the preset maximum allowable deviation value and the pose deviation difference is calculated as the pose reliability probability. The confidence level of the rack coordinate system is determined based on the pose confidence probability. The rack coordinate system corresponding to the current positioning hole state is combined with the rack coordinate system confidence level to obtain the rack pose evaluation label corresponding to each rack coordinate system.
[0010] As a further aspect of the present invention, the method of using a reference cabinet coordinate system and the cabinet pose evaluation label corresponding to the cabinet coordinate system to detect the quality of the industrial control cabinet and generate the quality inspection result of the industrial control cabinet includes: When the confidence level of the cabinet coordinate system in the cabinet pose evaluation label is greater than the preset first confidence judgment threshold, the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system will be used as the qualification judgment basis to generate the current qualified quality inspection result of the industrial control cabinet, indicating that the current industrial control cabinet under the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system meets the assembly accuracy standard. When the cabinet coordinate system confidence level in the cabinet pose evaluation label is between the first confidence judgment threshold and the preset second confidence judgment threshold, the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system will be used as the basis for re-inspection judgment, and the quality inspection result of the current industrial control cabinet to be re-inspected will be generated, indicating that the current industrial control cabinet under the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system has a risk of assembly deviation; When the reliability level of the cabinet coordinate system in the cabinet pose evaluation label is less than the second reliability judgment threshold, the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system will be used as the basis for anomaly judgment, and a quality inspection result of the current industrial control cabinet will be generated indicating that the current industrial control cabinet under the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system has not met the assembly accuracy standard.
[0011] An industrial vision-based quality inspection system for industrial control cabinets, the system comprising: The image acquisition module acquires images of the current industrial control cabinet on the automated production line, identifies the positioning holes of the industrial control cabinet and the images of the reference components adjacent to the positioning holes in the image of the industrial control cabinet, and calculates the local distortion of the positioning holes in the current industrial control cabinet image. The status determination module obtains the set of auxiliary reference pixel coordinates in the reference component image, and determines the status of the positioning hole in the current industrial control cabinet image by combining the local distortion of the positioning hole. The coordinate system generation module determines the cabinet coordinate system corresponding to the positioning hole in its respective state; The pose label determination module determines the rack pose evaluation label corresponding to the rack coordinate system. The inspection result generation module evaluates the quality of the industrial control cabinet by referring to the cabinet coordinate system and the corresponding cabinet pose, and generates the quality inspection results of the industrial control cabinet.
[0012] Compared with the prior art, the advantages and positive effects of the present invention are as follows: This invention comprehensively characterizes edge breakage, beginning and end closure deviation, contour dispersion, occlusion ratio, and reference distance deviation by assessing the local distortion of positioning holes. This transforms positioning hole anomalies from simply judging image similarity into comparable distortion levels. Simultaneously, it distinguishes between overall cabinet position changes and positioning hole identification deviations by combining reference component images, allowing different coordinate determination methods for normal, corrective, and abnormal states. Therefore, when positioning holes are clear, quality judgment can be completed using the conventional cabinet coordinate system; when positioning holes have correctable deviations, judgment can continue using the corrected cabinet coordinate system; and when positioning holes are abnormal, a reconstructed cabinet coordinate system can be formed using backup reference points. Furthermore, the cabinet pose evaluation label converts pose deviations into acceptable, re-inspection required, and unacceptable test results. This solution enhances the continuity of quality inspection on automated production lines, improves the reliability of pose judgment in scenarios with abnormal positioning holes, and refines the quality judgment hierarchy of chemical control cabinets. Attached Figure Description
[0013] Figure 1 This is a schematic diagram of the steps of the method of the present invention; Figure 2 This is a flowchart illustrating the steps and principles of the method of the present invention. Figure 3 This is a block diagram of the system of the present invention. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0015] Please see Figure 1-2 This invention provides a technical solution: a method for quality inspection of industrial control cabinets based on industrial vision, comprising the following steps: S1: Acquire the current industrial control cabinet image on the automated production line, identify the positioning holes of the industrial control cabinet and the images of adjacent reference components in the industrial control cabinet image, and calculate the local distortion of the positioning holes in the current industrial control cabinet image, including: The system acquires images of the current industrial control cabinet on the automated production line using an industrial camera, identifies the positioning holes and their edge contours in the current industrial control cabinet image, counts all pixels at the edge contours of the positioning holes, generates an edge pixel set, and simultaneously extracts reference component images adjacent to the positioning holes from the current industrial control cabinet image. The system obtains the cabinet frame edge pixel coordinates, hole and slot contour pixel coordinates, and cabinet outer contour pixel coordinates from the reference component images, thus obtaining a basic reference pixel coordinate set. After the industrial control cabinet enters the detection position on the automated production line, the industrial camera receives the production line's image capture trigger signal. The industrial camera lens is directly facing the assembly surface of the current industrial control cabinet. The image of the current industrial control cabinet is a pixel matrix output by the industrial camera. Each pixel in the pixel matrix corresponds to horizontal pixel coordinates, vertical pixel coordinates, and grayscale value. After importing the image of the current industrial control cabinet into the HALCON image processing software, the hole-like boundary is first traced along the grayscale change position between the grayscale of the cabinet panel and the grayscale of the cavity in the current industrial control cabinet image. The positioning hole is the hole-like structure on the current industrial control cabinet used for installation and positioning. The edge contour position of the positioning hole is the pixel boundary corresponding to the outer edge of the hole-like structure. Then, the horizontal and vertical pixel coordinates of the edge contour position of the positioning hole are read point by point. Pixels with identical vertical and horizontal pixel coordinates are retained only once. These retained pixels are then arranged according to the continuous direction of the positioning hole's edge contour. Next, the cabinet frame edge, slot contour, and cabinet outer contour are read from adjacent image areas around the positioning hole. The cabinet frame edge pixel coordinates represent the pixel position of the industrial control cabinet frame edge in the current industrial control cabinet image; the slot contour pixel coordinates represent the pixel position of the outer edge of the adjacent slot in the current industrial control cabinet image; and the cabinet outer contour pixel coordinates represent the pixel position of the outer boundary of the industrial control cabinet in the current industrial control cabinet image. Finally, all pixels at the positioning hole's edge contour position form an edge pixel set, and the cabinet frame edge pixel coordinates, slot contour pixel coordinates, and cabinet outer contour pixel coordinates form a base reference pixel coordinate set.
[0016] Calculate the Euclidean distance between adjacent pixels in the edge pixel set, filter pixels whose Euclidean distance is greater than a preset connected pixel distance threshold as broken pixels, accumulate the Euclidean distances of all broken pixels to obtain the length of the broken part, obtain the first and last pixels in the edge pixel set, calculate the first-to-last distance between the first and last pixels, use an ellipse fitting algorithm to fit the center pixel coordinates of the hole and the circumference of the ellipse with reference to the edge pixel set, calculate the distance variance between each pixel in the edge pixel set and the center pixel coordinates, calculate the ratio between the length of the broken part and the circumference of the ellipse as the local occlusion ratio, calculate the actual distance between the center pixel coordinates and the hole groove contour pixel coordinates in the basic reference pixel coordinate set, and calculate the distance difference between the actual distance and the preset standard pixel distance; After obtaining the edge pixel set, the horizontal and vertical pixel coordinates of two adjacent pixels are read according to the arrangement order of the edge pixel set. The Euclidean distance between adjacent pixels is the straight-line interval between two adjacent edge pixels in the same pixel coordinate plane. The square root of the difference in horizontal pixel coordinates² + the difference in vertical pixel coordinates² = the Euclidean distance between adjacent pixels. The preset connected pixel distance threshold is obtained from the complete edge image of the positioning holes of a qualified industrial control cabinet of the same specification. First, the Euclidean distance between adjacent pixels of continuous edges in the complete edge image of the positioning holes is read, and then the maximum value of the Euclidean distance between adjacent pixels of continuous edges is written into the preset connected pixel distance threshold. The Euclidean distance between adjacent pixels... When the distance exceeds a preset connected pixel distance threshold, the next pixel is recorded as a broken pixel. The sum of the Euclidean distances between adjacent pixels corresponding to all broken pixels equals the length of the broken portion. The first pixel is the first pixel in the edge pixel set, and the last pixel is the last pixel in the edge pixel set. The first-to-last distance is the square root of the sum of the horizontal pixel coordinate difference² and the vertical pixel coordinate difference² between the first and last pixels. When running the ellipse fitting algorithm in HALCON image processing software, the input is the horizontal and vertical pixel coordinates of each pixel in the edge pixel set. First, a quadratic algebraic relationship of the ellipse is established. The quadratic algebraic relationship is: horizontal pixel coordinate² × horizontal quadratic coefficient + horizontal pixel coordinate × vertical pixel coordinate × intersection coefficient + vertical pixel coordinate² × vertical quadratic coefficient + horizontal pixel coordinate × horizontal linear coefficient + vertical pixel coordinate × vertical linear coefficient + constant coefficient = 0. Next, the horizontal and vertical pixel coordinates of each pixel in the edge pixel set are substituted point-by-point into the elliptic quadratic algebraic relationship to obtain the algebraic deviation value for each pixel. The sum of the algebraic deviation values² for each pixel yields the sum of squared algebraic distances. Then, within the range of coefficient combinations that can form a closed elliptical contour, the horizontal quadratic coefficient, intersection coefficient, and vertical quadratic coefficient are changed... The coefficients of the horizontal first-order term, the vertical first-order term, and the constant term, and the set of coefficients that minimizes the sum of squared algebraic distances, are used as the elliptic algebraic parameters; then, the central denominator = 4 × horizontal quadratic coefficient × vertical quadratic coefficient - cross term coefficient², the numerator of the horizontal coordinate component = cross term coefficient × vertical first-order coefficient - 2 × vertical quadratic coefficient × horizontal first-order coefficient, the numerator of the vertical coordinate component = cross term coefficient × horizontal first-order coefficient - 2 × horizontal quadratic coefficient × vertical first-order coefficient, the horizontal coordinate component = horizontal coordinate component numerator / central denominator, the vertical coordinate component = vertical coordinate component numerator / central denominator, and the horizontal coordinate component and the vertical coordinate component form the center pixel coordinates of the positioning hole;Then, based on the elliptic algebraic parameters, the pixel dimensions of the major and minor semi-axis are obtained. The sum of three times the major and minor semi-axis pixel dimensions is multiplied by the sum of three times the major and minor semi-axis pixel dimensions, and the square root of the product is obtained. The square root is then subtracted from the sum of three times the major and minor semi-axis pixel dimensions, and the difference is multiplied by pi to obtain the ellipse circumference. The average of the squared deviations between the distance between each pixel and the center pixel coordinates and the average of all distances equals the distance variance. The length of the broken section / ellipse circumference equals the local occlusion ratio. The preset standard pixel distance is obtained from the distance between the center pixel coordinates and the hole / groove contour pixel coordinates of the positioning hole in the standard installation position of the same specification industrial control cabinet. The absolute deviation between the actual distance between the center pixel coordinates and the hole / groove contour pixel coordinates in the base reference pixel coordinate set and the preset standard pixel distance is used as the distance difference.
[0017] The length of the fractured part, the distance between the beginning and end, the distance variance, the local occlusion ratio, and the distance difference are normalized respectively. The weighted sum of the normalized fractured part length, the normalized beginning and end distance, the normalized distance variance, the normalized local occlusion ratio, and the normalized distance difference is used as the local distortion of the positioning hole in the current industrial control cabinet image. After obtaining the fracture length, head-to-tail distance, distance variance, local occlusion ratio, and distance difference, normalization processing converts the values of different dimensions to a unified range of 0 to 1. The lower and upper normalization reference limits are obtained from preset qualified and abnormal images of the same specification industrial control cabinet, respectively. The minimum record of the corresponding indicator for the preset qualified image is written into the lower normalization reference limit, and the maximum record of the corresponding indicator for the preset abnormal image is written into the upper normalization reference limit. The fracture length, head-to-tail distance, distance variance, local occlusion ratio, and distance difference are compared with the corresponding lower and upper normalization reference limits, respectively. When the current value is less than or equal to the corresponding lower normalization reference limit, the normalized value of the current value is 0; when the current value is greater than or equal to the corresponding upper normalization reference limit, the normalized value of the current value is 1; when the current value is greater than the corresponding lower normalization reference limit and less than the corresponding upper normalization reference limit, the normalized value of the current value = the deviation between the current value and the corresponding lower normalization reference limit / the deviation between the corresponding upper normalization reference limit and the corresponding upper normalization reference limit. The difference between the lower limits of the normalized reference is used; the weight is the proportion of each normalized index when it is included in the calculation of the local distortion of the positioning hole. First, positive importance is assigned to the defect correlation degree of the broken part length, the distance between the first and last ends, the distance variance, the local occlusion ratio, and the distance difference. When the number of edge breaks increases, the importance of the broken part length increases; when the value of the first and last end closure deviation increases, the importance of the first and last end distance increases; when the value of the distance dispersion from the edge point to the center increases, the importance of the distance variance increases; when the value of the occlusion ratio increases, the importance of the local occlusion ratio increases; when the value of the distance deviation between the positioning hole and the hole groove contour increases, the importance of the distance difference increases. Then, each importance is divided by the sum of the five importance values to obtain the corresponding weight. Normalized broken part length × broken part length weight + normalized first and last end distance × first and last end distance weight + normalized distance variance × distance variance weight + normalized local occlusion ratio × local occlusion ratio weight + normalized distance difference × distance difference weight = local distortion of the positioning hole in the current industrial control cabinet image.
[0018] S2: Obtain the set of auxiliary reference pixel coordinates in the reference component image, and combine it with the local distortion of the positioning holes to determine the status of the positioning holes in the current industrial control cabinet image, including: The pixel coordinates of the combined cabinet frame edge, the pixel coordinates of the slot outline, and the pixel coordinates of the cabinet outer outline are used to obtain an auxiliary reference pixel coordinate set. The reference component image is the cabinet structure image area adjacent to the positioning hole. After obtaining the reference component image, the pixel coordinates of the cabinet frame edge, the hole and slot outline, and the cabinet outer contour are read from the reference component image. Each pixel coordinate retains both horizontal and vertical pixel coordinates. Next, different category tags are written for the pixel coordinates of the cabinet frame edge, hole and slot outline, and cabinet outer contour. The category tags are used to distinguish whether the pixel coordinates come from the cabinet frame edge, hole and slot outline, or cabinet outer contour. Then, the three types of coordinates are arranged according to the category tags. For duplicate coordinates with the same horizontal and vertical pixel coordinates, only the coordinates read for the first time are retained. Finally, the pixel coordinates of the cabinet frame edge, hole and slot outline, and cabinet outer contour are arranged in the order of cabinet frame edge pixel coordinates first, hole and slot outline pixel coordinates in the middle, and cabinet outer contour pixel coordinates last to form an auxiliary reference pixel coordinate set.
[0019] The average coordinates of the cabinet frame edge pixel coordinates, the hole and slot outline pixel coordinates, and the cabinet outer outline pixel coordinates in the auxiliary reference pixel coordinate set are calculated to obtain the geometric center pixel coordinates. The coordinate difference between the center pixel coordinates of the positioning hole and the geometric center pixel coordinates is calculated. When the coordinate difference is greater than the preset pixel difference threshold, the coordinate difference is determined as the overall position change of the cabinet. When the coordinate difference is less than or equal to the preset pixel difference threshold, the coordinate difference is determined as the positioning hole recognition deviation. After obtaining the auxiliary reference pixel coordinate set, the horizontal and vertical pixel coordinates of the rack frame edge pixel coordinates, slot contour pixel coordinates, and rack outer contour pixel coordinates are read respectively. The average coordinate value is the concentrated position of the same type of pixel coordinates in the horizontal and vertical directions. The sum of the horizontal pixel coordinates of the rack frame edge pixel coordinates / the number of horizontal pixel coordinates of the rack frame edge pixel coordinates = the average horizontal pixel coordinates of the rack frame edge pixel coordinates. The sum of the vertical pixel coordinates of the rack frame edge pixel coordinates / the number of vertical pixel coordinates of the rack frame edge pixel coordinates = the average vertical pixel coordinates of the rack frame edge pixel coordinates. Average value; Sum of horizontal pixel coordinates of the slot / hole contour / Number of horizontal pixel coordinates of the slot / hole contour = Average value of horizontal pixel coordinates of the slot / hole contour; Sum of vertical pixel coordinates of the slot / hole contour / Number of vertical pixel coordinates of the slot / hole contour = Average value of vertical pixel coordinates of the slot / hole contour; Sum of horizontal pixel coordinates of the outer contour of the rack / Number of horizontal pixel coordinates of the outer contour of the rack = Average value of horizontal pixel coordinates of the outer contour of the rack; Sum of vertical pixel coordinates of the outer contour of the rack / Number of vertical pixel coordinates of the outer contour of the rack = Average value of horizontal pixel coordinates of the outer contour of the rack; The average vertical pixel coordinate of the outline pixel coordinate; the horizontal pixel coordinate of the geometric center pixel coordinate = the sum of the average horizontal pixel coordinates of the rack frame edge pixel coordinates, the average horizontal pixel coordinates of the hole / slot outline pixel coordinates, and the average horizontal pixel coordinates of the rack outer outline pixel coordinates / 3; the vertical pixel coordinate of the geometric center pixel coordinate = the sum of the average vertical pixel coordinates of the rack frame edge pixel coordinates, the average vertical pixel coordinates of the hole / slot outline pixel coordinates, and the average vertical pixel coordinates of the rack outer outline pixel coordinates / 3; the horizontal coordinate difference between the center pixel coordinate of the positioning hole and the geometric center pixel coordinate² + the horizontal coordinate difference between the center pixel coordinate of the positioning hole and the geometric center pixel coordinate. The square root of the vertical coordinate difference² between the center pixel coordinate and the geometric center pixel coordinate of the positioning hole is equal to the coordinate difference. The preset pixel difference threshold is obtained from the coordinate difference between the center pixel coordinate and the geometric center pixel coordinate of the positioning hole in the standard placement state of the same specification industrial control cabinet. First, the coordinate difference values in multiple standard placement state images are read, and then the maximum value of the coordinate difference values in multiple standard placement state images is written into the preset pixel difference threshold. When the coordinate difference is greater than the preset pixel difference threshold, the coordinate difference is used as the overall position change of the cabinet. When the coordinate difference is less than or equal to the preset pixel difference threshold, the coordinate difference is used as the positioning hole recognition deviation.
[0020] When the change is determined to be an overall positional change of the cabinet and the local distortion of the positioning hole is less than or equal to the preset distortion threshold, the positioning hole position in the current industrial control cabinet image is determined to be in a normal state. When the change is determined to be a positioning hole recognition deviation and the local distortion of the positioning hole is less than or equal to the distortion threshold, the positioning hole position in the current industrial control cabinet image is determined to be in a state to be corrected. When the local distortion of the positioning hole is greater than the distortion threshold, the positioning hole position in the current industrial control cabinet image is determined to be in an abnormal state. After obtaining the coordinate difference judgment category, local distortion degree of the positioning hole, and distortion degree judgment threshold, the coordinate difference judgment category is derived from the comparison result of the coordinate difference and the preset pixel difference threshold. The local distortion degree of the positioning hole is derived from the weighted sum of the broken part length, the distance between the beginning and end, the distance variance, the local occlusion ratio, and the distance difference. The distortion degree judgment threshold is the boundary value of the positioning hole edge distortion entering the abnormal judgment. The distortion degree judgment threshold is obtained from the preset acceptable positioning hole image and the preset unacceptable positioning hole image of the same specification industrial control cabinet. First, the local distortion degree of the positioning hole in the preset acceptable positioning hole image and the preset unacceptable positioning hole image are obtained respectively. Then, the distortion degree in the preset acceptable positioning hole image is... The maximum value of the local distortion of the positioning hole is written into the distortion degree judgment threshold. After the local distortion of the positioning hole is compared with the distortion degree judgment threshold, if the judgment category of the coordinate difference is the change in the overall position of the cabinet and the local distortion of the positioning hole is less than or equal to the distortion degree judgment threshold, the normal state is taken as the state of the positioning hole position in the current industrial control cabinet image. If the judgment category of the coordinate difference is the positioning hole recognition deviation and the local distortion of the positioning hole is less than or equal to the distortion degree judgment threshold, the state to be corrected is taken as the state of the positioning hole position in the current industrial control cabinet image. If the local distortion of the positioning hole is greater than the distortion degree judgment threshold, the abnormal state is taken as the state of the positioning hole position in the current industrial control cabinet image.
[0021] S3: Determine the rack coordinate system corresponding to the positioning hole in its current state, including: Pixels with an Euclidean distance less than or equal to a preset connectivity distance threshold are selected from the edge pixel set to obtain a connected pixel set. The connected pixel set is combined as an effective edge pixel segment. A coordinate system reconstruction path based on an auxiliary reference pixel coordinate set is obtained. At the same time, the pixel coordinates of the backup reference points in the coordinate system reconstruction path are obtained. The pixel coordinates of the backup reference points are selected according to the order of the coordinate system reconstruction path and correspond to the edge of the cabinet frame, the outline of the slot, or the outer outline of the cabinet. The Euclidean distance between adjacent pixels in the edge pixel set is calculated using the previously mentioned distance calculation results for adjacent edge pixels. Both the preset connectivity distance threshold and the preset connected pixel distance threshold are used to characterize whether adjacent edge pixels are continuous. The preset connectivity distance threshold is written according to the process of obtaining the preset connected pixel distance threshold. When the Euclidean distance between adjacent pixels is less than or equal to the preset connectivity distance threshold, the adjacent pixels participating in the comparison are written into the same connected pixel set. When the Euclidean distance between adjacent pixels is greater than the preset connectivity distance threshold, a break marker is written between the adjacent pixels participating in the comparison. Then, the connected pixel set is segmented according to the break markers. The segmented connected pixels... The continuous pixel sequence is preserved according to the original arrangement order of the edge pixel set, and the starting pixel coordinates and ending pixel coordinates of the continuous pixel sequence are used as the pixel segment boundary. Then, the arrangement order of the cabinet frame edge pixel coordinates, the hole and slot contour pixel coordinates, and the cabinet outer contour pixel coordinates in the auxiliary reference pixel coordinate set is read, and the coordinate access order is formed according to the arrangement order. Finally, the continuous pixel sequence between the pixel segment boundaries forms the effective edge pixel segment, and the coordinate access order forms the coordinate system reconstruction path. The cabinet frame edge pixel coordinates, hole and slot contour pixel coordinates, or cabinet outer contour pixel coordinates selected in the coordinate system reconstruction path are used as the backup reference point pixel coordinates.
[0022] Obtain the intrinsic and extrinsic parameter matrices of the industrial camera, calculate the product of the intrinsic and extrinsic parameter matrices to obtain the spatial coordinate transformation matrix. For positioning holes belonging to the normal state, calculate the slope of the line connecting the pixel coordinates of the corresponding cabinet frame edge and the pixel coordinates of the hole groove contour, and use it as the initial planar attitude angle. Call the spatial coordinate transformation matrix to map the center pixel coordinates of the positioning hole to the initial center physical coordinates, and map the initial planar attitude angle to the initial physical attitude angle. Combine the initial center physical coordinates and the initial physical attitude angle as the conventional cabinet coordinate system. The process of mapping the center pixel coordinates of the positioning hole to the initial center physical coordinates is as follows: calculate the product of the spatial coordinate transformation matrix and the center pixel coordinates of the positioning hole, and use this product as the initial center physical coordinates representing the translation reference in the three-dimensional physical space. The process of mapping the initial planar attitude angle to the initial physical attitude angle is as follows: extract the rotation component of the spatial coordinate transformation matrix, calculate the transformation value of the rotation component and the initial planar attitude angle, and use this transformation value as the initial physical attitude angle representing the deflection attitude in the three-dimensional physical space. The intrinsic and extrinsic parameter matrices of the industrial camera are read from the industrial camera calibration record. The intrinsic parameter matrix contains the pixel imaging parameters of the industrial camera, while the extrinsic parameter matrix contains the spatial position and attitude parameters of the industrial camera relative to the physical coordinates. After reading the industrial camera calibration record in the HALCON image processing software, the intrinsic parameter matrix × extrinsic parameter matrix = spatial coordinate transformation matrix. For positioning holes belonging to the normal state, the pixel coordinates of the cabinet frame edge and the pixel coordinates of the hole groove contour are read. The difference in vertical pixel coordinates between the cabinet frame edge and hole groove contour pixel coordinates / the difference in horizontal pixel coordinates between the cabinet frame edge and hole groove contour pixel coordinates = the slope of the connecting line. The slope of the connecting line is written into the initial plane attitude angle. After the center pixel coordinates of the positioning hole are written into a coordinate column, the spatial coordinate transformation matrix × the center pixel coordinates of the positioning hole = the initial center physical coordinates. After reading the rotation component from the spatial coordinate transformation matrix, the rotation component × the initial plane attitude angle = the initial physical attitude angle. Finally, the combination of the initial center physical coordinates and the initial physical attitude angle forms the conventional cabinet coordinate system.
[0023] For positioning holes belonging to the state to be corrected, an ellipse fitting algorithm is used to fit the reference center pixel coordinates of the positioning hole based on the effective edge pixel segments. The slope of the line connecting the edge pixel coordinates of the computer cabinet frame and the outer contour pixel coordinates of the cabinet is used as the reference plane attitude angle. The spatial coordinate transformation matrix is called to map the reference center pixel coordinates to the reference center physical coordinates and the reference plane attitude angle to the reference physical attitude angle. The reference center physical coordinates and the reference physical attitude angle are combined as the cabinet coordinate system after position correction. The process of fitting the reference center pixel coordinates of the positioning hole based on the effective edge pixel segments using the ellipse fitting algorithm is as follows: obtain the horizontal and vertical pixel coordinates of each pixel in the effective edge pixel segments; construct a quadratic algebraic equation containing the horizontal and vertical pixel coordinates; calculate the minimum value of the sum of squared algebraic distances at each pixel point of the quadratic algebraic equation, extract the coefficients of each equation at the minimum value of the sum of squared algebraic distances to generate ellipse algebraic parameters; extract the horizontal and vertical coordinate components representing the center position in the ellipse algebraic parameters, and combine the horizontal and vertical coordinate components as the reference center pixel coordinates. For the positioning holes belonging to the state to be corrected, first read the horizontal and vertical pixel coordinates of each pixel in the effective edge pixel segment; when running the ellipse fitting algorithm in HALCON image processing software, the input is the horizontal and vertical pixel coordinates of each pixel in the effective edge pixel segment. First, establish the ellipse quadratic algebraic relationship, which is: horizontal pixel coordinate² × horizontal quadratic coefficient + horizontal pixel coordinate × vertical pixel coordinate × cross term coefficient + vertical pixel coordinate² × vertical quadratic coefficient + horizontal pixel coordinate × horizontal linear coefficient + vertical pixel coordinate × vertical linear coefficient + constant term coefficient = 0; then, substitute the horizontal and vertical pixel coordinates of each pixel in the effective edge pixel segment into the ellipse quadratic algebraic relationship point by point to obtain the algebraic deviation value corresponding to each pixel. The sum of the algebraic deviation values² corresponding to each pixel is used to obtain the sum of squared algebraic distances; then, within the range of coefficient combinations that can form a closed ellipse contour, The coefficients that minimize the sum of squared algebraic distances are obtained by changing the coefficients of the horizontal quadratic term, the cross term, the vertical quadratic term, the horizontal linear term, the vertical linear term, and the constant term. These coefficients are then used as the elliptic algebraic parameters. Next, the horizontal and vertical coordinate components representing the center position are extracted from the elliptic algebraic parameters according to the extraction process of the center pixel coordinates of the positioning holes. The combination of the horizontal and vertical components forms the reference center pixel coordinates. Then, the difference between the vertical pixel coordinates of the cabinet frame edge pixel coordinates and the cabinet outer contour pixel coordinates / the difference between the horizontal pixel coordinates of the cabinet frame edge pixel coordinates and the cabinet outer contour pixel coordinates equals the reference plane attitude angle. Then, the spatial coordinate transformation matrix multiplied by the reference center pixel coordinates equals the reference center physical coordinates, and the rotation component of the spatial coordinate transformation matrix multiplied by the reference plane attitude angle equals the reference physical attitude angle. Finally, the combination of the reference center physical coordinates and the reference physical attitude angle forms the position-corrected cabinet coordinate system.
[0024] For positioning holes belonging to abnormal states, the spatial coordinate transformation matrix is called to map the pixel coordinates of the backup reference point to backup physical coordinates, and the backup physical coordinates are combined as the reconstructed cabinet coordinate system. After the positioning hole is determined to be in an abnormal state, the pixel coordinates of the backup reference points in the coordinate system reconstruction path are read. The pixel coordinates of the backup reference points are the reference coordinates selected from the edge of the rack frame, the outline of the hole slot, or the outer outline of the rack when the positioning hole is in an abnormal state. Then, the pixel coordinates of the backup reference points are arranged according to the order of the coordinate system reconstruction path, and each pixel coordinate of the backup reference points is written as a coordinate column participating in the spatial coordinate transformation matrix operation. Then, the spatial coordinate transformation matrix × the pixel coordinates of the backup reference points = the backup physical coordinates. Next, all the backup physical coordinates are arranged according to the order of the coordinate system reconstruction path. Finally, the combination of all the backup physical coordinates forms the reconstructed rack coordinate system.
[0025] S4: Determine the rack pose evaluation labels corresponding to the rack coordinate system, including: Obtain the current pose parameters of the standard rack coordinate system, as well as the rack coordinate system after position correction or reconstruction, in the preset global reference coordinate system; After obtaining the standard rack coordinate system, the position-corrected rack coordinate system, or the reconstructed rack coordinate system, the physical coordinates and physical attitude angles in the corresponding rack coordinate system are read. The physical coordinates represent the translational position of the industrial control rack in three-dimensional physical space, and the physical attitude angles represent the deflection angles of the industrial control rack in three-dimensional physical space. Next, the origin, coordinate axis directions, and attitude reference directions in the preset global reference coordinate system are read. The preset global reference coordinate system serves as the unified physical coordinate reference for the detection position on the automated production line. Then, the coordinate offset between the physical coordinates and the origin in the preset global reference coordinate system is written into the current translational pose parameters. Next, the angular offset between the physical attitude angle and the attitude reference direction in the preset global reference coordinate system is written into the current attitude pose parameters. Finally, the combination of the current translational pose parameters and the current attitude pose parameters forms the current pose parameters.
[0026] Calculate the difference between the current pose parameters and the preset standard pose parameters of the cabinet coordinate system as the pose deviation difference. Calculate the ratio between the preset maximum allowable deviation value and the pose deviation difference as the pose reliability probability. After obtaining the current pose parameters and the preset rack coordinate system standard pose parameters, each item in the current pose parameters corresponds to the same item in the preset rack coordinate system standard pose parameters. The preset rack coordinate system standard pose parameters serve as the pose reference for a qualified industrial control rack of the same specification in a standard assembly position. The preset rack coordinate system standard pose parameters are obtained from the industrial control rack in the standard assembly position. First, the translation pose parameters and attitude pose parameters of the conventional rack coordinate system in the standard assembly position are read, and then the read translation pose parameters and attitude pose parameters are written into the preset rack coordinate system standard pose. Parameters; The absolute deviation between the corresponding item in the current pose parameters and the corresponding item in the preset cabinet coordinate system standard pose parameters = pose deviation difference; The preset maximum allowable deviation value is obtained from the allowable translation deviation and allowable attitude deviation in the industrial control cabinet assembly accuracy standard. The allowable translation deviation is written into the preset maximum allowable deviation value of the translation class, and the allowable attitude deviation is written into the preset maximum allowable deviation value of the attitude class; Preset maximum allowable deviation value / pose deviation difference = pose reliability probability; Finally, the ratio between the pose deviation difference value and the preset maximum allowable deviation value forms the pose reliability probability.
[0027] The confidence level of the rack coordinate system is determined based on the pose confidence probability. The rack coordinate system corresponding to the current positioning hole state is combined with the rack coordinate system confidence level to obtain the rack pose evaluation label corresponding to each rack coordinate system. The specific process of determining the rack coordinate system confidence level based on the pose confidence probability is as follows: when the pose confidence probability is greater than the upper probability threshold, a high confidence level representing the accuracy of the rack pose is generated as the rack coordinate system confidence level; when the pose confidence probability is less than or equal to the upper probability threshold but greater than the lower probability threshold, a medium confidence level representing the controllable error of the rack pose is generated as the rack coordinate system confidence level; when the pose confidence probability is less than or equal to the lower probability threshold, a low confidence level representing the rack pose exceeding the tolerance is generated as the rack coordinate system confidence level. After obtaining the pose confidence probability, the upper and lower probability thresholds are read. The upper probability threshold is the boundary between high and medium confidence levels, and the lower probability threshold is the boundary between medium and low confidence levels. Both thresholds are derived from the ratio between a preset maximum allowable deviation and a preset grade deviation. When the preset grade deviation is close to the preset maximum allowable deviation, the corresponding threshold is close to 1; when the preset grade deviation is lower than the preset maximum allowable deviation, the corresponding threshold is greater than 1; and as the difference between the preset grade deviation and the preset maximum allowable deviation increases, the corresponding threshold increases accordingly. When the pose confidence probability is greater than the upper probability threshold, the high confidence level is considered the machine. The cabinet coordinate system reliability level is determined as follows: when the pose reliability probability is less than or equal to the upper probability threshold and greater than the lower probability threshold, a medium reliability level is used as the cabinet coordinate system reliability level; when the pose reliability probability is less than or equal to the lower probability threshold, a low reliability level is used as the cabinet coordinate system reliability level. Next, the current positioning hole status is read: if the current positioning hole status is normal, the standard cabinet coordinate system is read; if the current positioning hole status is pending correction, the position-corrected cabinet coordinate system is read; if the current positioning hole status is abnormal, the reconstructed cabinet coordinate system is read. Finally, the combination of the cabinet coordinate system corresponding to the current positioning hole status and the cabinet coordinate system reliability level forms the cabinet pose evaluation label for each cabinet coordinate system.
[0028] S5: Evaluate the quality of the industrial control cabinet by referencing the cabinet coordinate system and its corresponding cabinet pose, and generate the quality inspection results, including: When the confidence level of the cabinet coordinate system in the cabinet pose evaluation label is greater than the preset first confidence judgment threshold, the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system will be used as the qualification judgment basis to generate the current qualified quality inspection result of the industrial control cabinet, indicating that the current industrial control cabinet under the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system meets the assembly accuracy standard. After obtaining the rack pose evaluation label, the rack coordinate system reliability level and the preset first reliability judgment threshold are read from the rack pose evaluation label. The preset first reliability judgment threshold is the reliability level boundary value corresponding to the pass / fail judgment. The preset first reliability judgment threshold is obtained according to the rack coordinate system reliability level order. The high reliability level is higher than the preset first reliability judgment threshold, and the medium and low reliability levels are not higher than the preset first reliability judgment threshold. When the rack coordinate system reliability level is greater than the preset first reliability judgment threshold, the conventional rack coordinate system, the rack coordinate system after position correction, or the reconstructed rack coordinate system is used as the basis for pass / fail judgment, and the quality inspection result of the current industrial control rack is generated.
[0029] When the confidence level of the cabinet coordinate system in the cabinet pose evaluation label is between the first confidence judgment threshold and the preset second confidence judgment threshold, the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system will be used as the basis for re-inspection judgment, and the quality inspection result of the current industrial control cabinet to be re-inspected will be generated, indicating that the current industrial control cabinet under the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system has the risk of assembly deviation; When the pass / fail judgment does not generate a pass / fail quality inspection result for the current industrial control cabinet, the cabinet coordinate system reliability level, the first reliability judgment threshold, and the preset second reliability judgment threshold in the cabinet pose evaluation label are read. The preset second reliability judgment threshold is the reliability level boundary value between the re-inspection judgment and the failure judgment. The first reliability judgment threshold and the preset second reliability judgment threshold are obtained in the order of the cabinet coordinate system reliability level. The medium reliability level is between the first reliability judgment threshold and the preset second reliability judgment threshold, and the low reliability level is lower than the preset second reliability judgment threshold. When the cabinet coordinate system reliability level is less than or equal to the first reliability judgment threshold and greater than or equal to the preset second reliability judgment threshold, the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system is used as the basis for the re-inspection judgment, and the quality inspection result of the current industrial control cabinet to be re-inspected is generated.
[0030] When the confidence level of the cabinet coordinate system in the cabinet pose evaluation label is less than the second confidence judgment threshold, the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system will be used as the basis for anomaly judgment, and a quality inspection result of the current industrial control cabinet will be generated, indicating that the current industrial control cabinet under the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system has not met the assembly accuracy standard. When the re-inspection judgment fails to generate a quality inspection result for the current industrial control cabinet to be re-inspected, the cabinet coordinate system reliability level and the second reliability judgment threshold in the cabinet pose evaluation label are read. The second reliability judgment threshold is the reliability level boundary value corresponding to the non-conformance judgment. The second reliability judgment threshold is obtained in the order of the cabinet coordinate system reliability level. The low reliability level is lower than the second reliability judgment threshold, and the high reliability level and medium reliability level are not lower than the second reliability judgment threshold. When the cabinet coordinate system reliability level is less than the second reliability judgment threshold, the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system is used as the basis for anomaly judgment, and a quality inspection result of non-conformance for the current industrial control cabinet is generated.
[0031] Please see Figure 3 An industrial vision-based quality inspection system for industrial control cabinets, comprising: The image acquisition module acquires images of the current industrial control cabinet on the automated production line, identifies the positioning holes of the industrial control cabinet and the images of the reference components adjacent to the positioning holes in the image of the industrial control cabinet, and calculates the local distortion of the positioning holes in the current industrial control cabinet image. The status determination module obtains the set of auxiliary reference pixel coordinates in the reference component image, and determines the status of the positioning hole in the current industrial control cabinet image by combining the local distortion of the positioning hole. The coordinate system generation module determines the cabinet coordinate system corresponding to the positioning hole in its respective state; The pose label determination module determines the rack pose evaluation label corresponding to the rack coordinate system. The inspection result generation module evaluates the quality of the industrial control cabinet by referring to the cabinet coordinate system and the corresponding cabinet pose, and generates the quality inspection results of the industrial control cabinet.
[0032] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. A method for quality inspection of industrial control cabinets based on industrial vision, characterized in that, Includes the following steps: The system acquires images of the current industrial control cabinet on the automated production line, identifies the positioning holes of the industrial control cabinet and the images of the reference components adjacent to the positioning holes in the images, and calculates the local distortion of the positioning holes in the current industrial control cabinet image. Obtain the set of auxiliary reference pixel coordinates in the reference component image, and combine it with the local distortion of the positioning hole to determine the status of the positioning hole in the current industrial control cabinet image; Determine the rack coordinate system corresponding to the positioning holes in their respective states; Determine the rack pose evaluation label corresponding to the rack coordinate system; The quality of the industrial control cabinet is evaluated by referring to the cabinet coordinate system and the corresponding cabinet pose, and the quality inspection results of the industrial control cabinet are generated.
2. The industrial vision-based quality inspection method for industrial control cabinets according to claim 1, characterized in that, The process of acquiring current industrial control cabinet images from the automated production line, identifying positioning holes in the industrial control cabinet images and adjacent reference component images, and calculating the local distortion of positioning holes in the current industrial control cabinet image includes: The system acquires images of the current industrial control cabinet on the automated production line using an industrial camera, identifies the positioning holes and their edge contours in the current industrial control cabinet image, counts all pixels at the edge contours of the positioning holes, generates an edge pixel set, and simultaneously extracts reference component images adjacent to the positioning holes from the current industrial control cabinet image. The system obtains the cabinet frame edge pixel coordinates, hole and slot contour pixel coordinates, and cabinet outer contour pixel coordinates from the reference component images, thus obtaining a basic reference pixel coordinate set. Calculate the Euclidean distance between adjacent pixels in the edge pixel set, filter pixels whose Euclidean distance is greater than a preset connected pixel distance threshold as broken pixels, accumulate the Euclidean distances of all broken pixels to obtain the length of the broken part, obtain the first and last pixels in the edge pixel set, calculate the first-to-last distance between the first and last pixels, fit the center pixel coordinates and ellipse circumference of the positioning hole using an ellipse fitting algorithm with reference to the edge pixel set, calculate the distance variance between each pixel in the edge pixel set and the center pixel coordinates, calculate the ratio between the length of the broken part and the ellipse circumference as the local occlusion ratio, calculate the actual distance between the center pixel coordinates and the hole groove contour pixel coordinates in the basic reference pixel coordinate set, and calculate the distance difference between the actual distance and the preset standard pixel distance; The length of the fractured portion, the distance between the beginning and end, the distance variance, the local occlusion ratio, and the distance difference are normalized respectively. The weighted sum of the normalized fractured portion length, the normalized beginning and end distance, the normalized distance variance, the normalized local occlusion ratio, and the normalized distance difference is calculated as the local distortion of the positioning hole in the current industrial control cabinet image.
3. The industrial vision-based quality inspection method for industrial control cabinets according to claim 2, characterized in that, The process of obtaining the set of auxiliary reference pixel coordinates in the reference component image, and combining it with the local distortion of the positioning holes, to determine the state of the positioning holes in the current industrial control cabinet image includes: By combining the pixel coordinates of the cabinet frame edge, the pixel coordinates of the slot outline, and the pixel coordinates of the cabinet outer outline, an auxiliary reference pixel coordinate set is obtained; The average coordinates of the cabinet frame edge pixel coordinates, the hole and slot contour pixel coordinates, and the cabinet outer contour pixel coordinates in the auxiliary reference pixel coordinate set are calculated to obtain the geometric center pixel coordinates. The coordinate difference between the center pixel coordinates of the positioning hole and the geometric center pixel coordinates is calculated. When the coordinate difference is greater than the preset pixel difference threshold, the coordinate difference is determined as the overall position change of the cabinet. When the coordinate difference is less than or equal to the preset pixel difference threshold, the coordinate difference is determined as the positioning hole recognition deviation. When the change in the overall position of the cabinet is determined to be a certain amount and the local distortion of the positioning hole is less than or equal to a preset distortion degree judgment threshold, the positioning hole position in the current industrial control cabinet image is determined to be in a normal state. When the deviation in the positioning hole recognition is determined to be a certain amount and the local distortion of the positioning hole is less than or equal to the distortion degree judgment threshold, the positioning hole position in the current industrial control cabinet image is determined to be in a state to be corrected. When the local distortion of the positioning hole is greater than the distortion degree judgment threshold, the positioning hole position in the current industrial control cabinet image is determined to be in an abnormal state.
4. The industrial vision-based quality inspection method for industrial control cabinets according to claim 3, characterized in that, The determination of the cabinet coordinate system corresponding to the positioning hole in its respective state includes: Pixels in the edge pixel set whose Euclidean distance is less than or equal to a preset connectivity distance threshold are selected to obtain a set of connected pixels. The set of connected pixels is combined as an effective edge pixel segment. A coordinate system reconstruction path based on an auxiliary reference pixel coordinate set is obtained. At the same time, the pixel coordinates of the backup reference points in the coordinate system reconstruction path are obtained. The pixel coordinates of the backup reference points are selected according to the order of the coordinate system reconstruction path and correspond to the edge of the cabinet frame, the outline of the slot, or the outer outline of the cabinet. Obtain the intrinsic and extrinsic parameter matrices of the industrial camera, calculate the product of the intrinsic and extrinsic parameter matrices to obtain the spatial coordinate transformation matrix, and for the positioning holes belonging to the normal state, calculate the slope of the line connecting the pixel coordinates of the corresponding cabinet frame edge and the pixel coordinates of the hole groove contour as the initial planar attitude angle. Call the spatial coordinate transformation matrix to map the center pixel coordinates of the positioning hole to the initial center physical coordinates and the initial planar attitude angle to the initial physical attitude angle. Combine the initial center physical coordinates and the initial physical attitude angle as the conventional cabinet coordinate system. For the positioning holes belonging to the state to be corrected, the reference center pixel coordinates of the positioning holes are fitted according to the effective edge pixel segments using an ellipse fitting algorithm. The slope of the line connecting the edge pixel coordinates of the computer cabinet frame and the outer contour pixel coordinates of the cabinet is used as the reference plane attitude angle. The spatial coordinate transformation matrix is called to map the reference center pixel coordinates to the reference center physical coordinates and the reference plane attitude angle to the reference physical attitude angle. The reference center physical coordinates and the reference physical attitude angle are combined to form the cabinet coordinate system after position correction. For the positioning holes belonging to the abnormal state, the spatial coordinate transformation matrix is called to map the pixel coordinates of the backup reference point to the backup physical coordinates, and the backup physical coordinates are combined as the reconstructed cabinet coordinate system.
5. The industrial vision-based quality inspection method for industrial control cabinets according to claim 4, characterized in that, The rack pose evaluation label corresponding to the determined rack coordinate system includes: Obtain the current pose parameters of the conventional rack coordinate system and the position-corrected rack coordinate system or the reconstructed rack coordinate system in the preset global reference coordinate system; The difference between the current pose parameters and the preset standard pose parameters of the cabinet coordinate system is calculated as the pose deviation difference. The ratio between the preset maximum allowable deviation value and the pose deviation difference is calculated as the pose reliability probability. The confidence level of the rack coordinate system is determined based on the pose confidence probability. The rack coordinate system corresponding to the current positioning hole state is combined with the rack coordinate system confidence level to obtain the rack pose evaluation label corresponding to each rack coordinate system.
6. The industrial vision-based quality inspection method for industrial control cabinets according to claim 5, characterized in that, The reference cabinet coordinate system and the corresponding cabinet pose evaluation label are used to detect the quality of the industrial control cabinet, and the generated quality inspection results of the industrial control cabinet include: When the confidence level of the cabinet coordinate system in the cabinet pose evaluation label is greater than the preset first confidence judgment threshold, the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system will be used as the qualification judgment basis to generate the current qualified quality inspection result of the industrial control cabinet, indicating that the current industrial control cabinet under the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system meets the assembly accuracy standard. When the cabinet coordinate system confidence level in the cabinet pose evaluation label is between the first confidence judgment threshold and the preset second confidence judgment threshold, the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system will be used as the basis for re-inspection judgment, and the quality inspection result of the current industrial control cabinet to be re-inspected will be generated, indicating that the current industrial control cabinet under the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system has a risk of assembly deviation; When the reliability level of the cabinet coordinate system in the cabinet pose evaluation label is less than the second reliability judgment threshold, the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system will be used as the basis for anomaly judgment, and a quality inspection result of the current industrial control cabinet will be generated indicating that the current industrial control cabinet under the conventional cabinet coordinate system, the position-corrected cabinet coordinate system, or the reconstructed cabinet coordinate system has not met the assembly accuracy standard.
7. The industrial vision-based quality inspection method for industrial control cabinets according to claim 4, characterized in that, The process of mapping the center pixel coordinates of the positioning hole to the initial center physical coordinates is as follows: calculate the product of the spatial coordinate transformation matrix and the center pixel coordinates of the positioning hole, and use the product as the initial center physical coordinates representing the translation reference in the three-dimensional physical space; the process of mapping the initial planar attitude angle to the initial physical attitude angle is as follows: extract the rotation component of the spatial coordinate transformation matrix, calculate the transformation value of the rotation component and the initial planar attitude angle, and use the transformation value as the initial physical attitude angle representing the deflection attitude in the three-dimensional physical space.
8. The industrial vision-based quality inspection method for industrial control cabinets according to claim 4, characterized in that, The process of fitting the reference center pixel coordinates of the positioning hole based on the effective edge pixel segment using the ellipse fitting algorithm is as follows: obtaining the horizontal and vertical pixel coordinates of each pixel in the effective edge pixel segment; constructing a quadratic algebraic equation containing the horizontal and vertical pixel coordinates; calculating the minimum value of the sum of squared algebraic distances at each pixel point, extracting the coefficients of each equation at the minimum value of the sum of squared algebraic distances to generate ellipse algebraic parameters; extracting the horizontal and vertical coordinate components representing the center position from the ellipse algebraic parameters, and combining the horizontal and vertical coordinate components as the reference center pixel coordinates.
9. The industrial vision-based quality inspection method for industrial control cabinets according to claim 5, characterized in that, The process of determining the rack coordinate system reliability level based on the pose reliability probability is as follows: when the pose reliability probability is greater than the upper probability threshold, a high reliability level representing the accuracy of the rack pose is generated as the rack coordinate system reliability level; when the pose reliability probability is less than or equal to the upper probability threshold but greater than the lower probability threshold, a medium reliability level representing the controllable error in the rack pose is generated as the rack coordinate system reliability level; when the pose reliability probability is less than or equal to the lower probability threshold, a low reliability level representing the rack pose exceeding the tolerance is generated as the rack coordinate system reliability level.
10. A quality inspection system for industrial control cabinets based on industrial vision, characterized in that, The system includes: The image acquisition module acquires images of the current industrial control cabinet on the automated production line, identifies the positioning holes of the industrial control cabinet and the images of the reference components adjacent to the positioning holes in the image of the industrial control cabinet, and calculates the local distortion of the positioning holes in the current industrial control cabinet image. The status determination module obtains the set of auxiliary reference pixel coordinates in the reference component image, and determines the status of the positioning hole in the current industrial control cabinet image by combining the local distortion of the positioning hole. The coordinate system generation module determines the cabinet coordinate system corresponding to the positioning hole in its respective state; The pose label determination module determines the rack pose evaluation label corresponding to the rack coordinate system. The inspection result generation module evaluates the quality of the industrial control cabinet by referring to the cabinet coordinate system and the corresponding cabinet pose, and generates the quality inspection results of the industrial control cabinet.