A machine vision-based component size detection system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HENGYANG XINYIWEI MECHANICAL & ELECTRICAL TECH CO LTD
- Filing Date
- 2026-01-05
- Publication Date
- 2026-06-23
Smart Images

Figure CN121724969B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of dimensional inspection technology, and in particular to a component dimensional inspection system based on machine vision. Background Technology
[0002] The field of dimensional inspection technology involves measuring and evaluating the geometric dimensions of objects, such as length, width, height, and angles, and is widely used in industrial manufacturing, quality control, and automated inspection. Core aspects of this technology include dimensional measurement methods, data acquisition methods, measurement accuracy control, and the development and application of non-contact measurement systems. Traditional dimensional inspection methods mainly rely on manual operation or contact measuring equipment, such as vernier calipers, micrometers, and coordinate measuring machines. These methods place high demands on the operating environment, operator skills, and inspection efficiency, making it difficult to meet the needs of high-precision, high-efficiency, and fully automated production processes. With the continuous improvement of industrial automation, non-contact dimensional inspection technology based on machine vision has gradually become a research and application focus. It acquires target images through image acquisition equipment and uses image recognition and analysis technology to calculate the target dimensions.
[0003] Traditional component size inspection systems refer to equipment systems used to inspect the external dimensions of various electrical or mechanical components. These systems typically include image acquisition devices, light sources, supports, display devices, and computing units. Inspection generally employs a fixed-point shooting method, where the image acquisition device acquires static images of the component under test. Edge features are extracted through a preset image processing flow, and the size value is calculated based on the pixel-to-physical size mapping relationship. These systems often use image analysis methods based on edge detection operators, such as the Sobel and Canny operators, to identify the component's outline. The actual size is then calculated using pixel spacing and camera calibration parameters. Traditional systems rely on manual settings for light source arrangement, camera angle adjustment, and image distortion correction, and lack adaptability to changes in component position, making it difficult to support high-throughput, continuous inspection of multiple component models. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of existing technologies by proposing a component size detection system based on machine vision.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: a component size detection system based on machine vision, the system comprising:
[0006] The interference area identification module acquires a single-frame grayscale image of the component under test, reads pixels and adjacent grayscale values to construct a grayscale value sequence, counts the number of changes in the grayscale value sequence, and identifies and generates high-reflectivity suspected interference areas.
[0007] The edge repair module calculates the edge response difference between the suspected high-reflectivity interference area and the adjacent area. When the difference exceeds the standard, the response is discarded. Linear interpolation is performed based on the edge response of the adjacent area to generate a compensation contour.
[0008] The structural clustering module extracts the angle between the compensation contour direction vectors to construct a sequence of geometric vector angles, identifies abrupt increases in the geometric vector angle sequence to generate cluster breakpoints, analyzes the trend of angle changes in the cluster breakpoint segments, divides them into groups, and establishes a point cloud grouping structure.
[0009] The distortion analysis module extracts the coordinate variation range of the three-axis array of the point cloud grouping structure, constructs a projection surface distortion curvature mapping table, determines the interval ratio of response points, and identifies non-equidistant deformation.
[0010] The attitude restoration module applies reverse compensation to the non-equidistant deformation axis, optimizes the convergence of the intersection point to the three-axis intersection point density based on the projection plane distortion curvature mapping table, calculates the size based on the convergence coordinates and compares the tolerance, and generates the component size detection result.
[0011] As a further aspect of the present invention, the high-reflectivity suspected interference area includes an abnormal pixel coordinate set, a gray-level gradient inversion map, and a local spot boundary mask; the compensation contour direction includes interpolation repair coordinate points, edge response weight coefficients, and contour continuity vectors; the point cloud grouping structure includes independent geometric feature segments, cluster boundary identifiers, and a topological connection matrix; the non-equidistant deformation includes axial compression-stretch ratio, local projection deformation coefficient, and perspective distortion gradient parameters; and the component size detection results include geometric size measurement values, tolerance matching status indicators, and size deviation accuracy ratings.
[0012] As a further aspect of the present invention, the interference region identification module includes:
[0013] The sequence construction submodule acquires a single-frame grayscale image of the component under test, establishes a two-dimensional coordinate index in the bitmap data matrix of the single-frame grayscale image, traverses the position of the pixel to be detected one by one, takes the current pixel as the geometric center, reads the grayscale quantization values of the five adjacent pixel units along the horizontal scan line direction and the vertical scan line direction respectively, and combines and arranges the multiple sets of grayscale quantization values according to the spatial adjacency order to generate a grayscale value sequence.
[0014] The fluctuation statistics submodule calls the gray value sequence, performs a first-order difference operation on adjacent elements within the sequence, extracts the sign bit of the difference result, counts the total number of alternating jumps between positive and negative polarities of the difference sign, obtains the number of times the gray value increases or decreases, synchronously retrieves the index position where the gray value in the sequence reaches a local maximum value, calculates the pixel coordinate distance between two adjacent local maximum value indices, and generates the peak interval width that characterizes the spatial span of the bright area of the spot.
[0015] The region marking submodule performs multi-dimensional logic judgment based on the number of grayscale increase / decrease direction changes and the peak interval width. It compares the number of grayscale increase / decrease direction changes with a preset frequency threshold and the peak interval width with a preset interference judgment threshold. When the comparison results meet the conditions, it locks the corresponding pixel coordinate range in the single frame grayscale image and establishes a high-reflectivity suspected interference area marked with abnormal reflective positions.
[0016] As a further aspect of the present invention, the frequency threshold setting process specifically involves selecting the diffuse reflection area of a standard non-reflective calibration plate or component as a reference sample, extracting the grayscale sequence of the edge transition area, calculating the statistical probability distribution of the grayscale gradient sign flipping in the sequence, and taking the upper limit of the confidence interval of the edge monotonicity change in the statistical distribution as the frequency threshold.
[0017] The specific process for setting the interference judgment threshold is as follows: based on the camera calibration parameters of the machine vision system, calculate the actual physical length represented by a single pixel, read the minimum effective structural width defined in the CAD drawing or specification of the component under test, divide it by the pixel equivalent, obtain the theoretical pixel width occupied by the structure on the image, and set the theoretical pixel width as the interference judgment threshold.
[0018] As a further aspect of the present invention, the edge repair module includes:
[0019] The response comparison submodule, for the high-reflection suspected interference area, obtains the edge response value inside the area and the edge response value of the adjacent area outside the area, respectively, performs a subtraction operation to solve the absolute value of the difference between the edge response value inside the area and the edge response value of the adjacent area, and generates an edge response deviation value that quantifies the degree of signal change.
[0020] The anomaly handling submodule calls the edge response deviation value and compares it with a preset amplitude threshold. When it is determined that the edge response deviation value exceeds the amplitude threshold, the edge signal in the high-reflection suspected interference zone is set to zero and invalidated, the start and end coordinates of the signal interruption are locked, and a set of failed edge indexes that defines the interpolation interval is generated.
[0021] The contour compensation submodule determines the start and end range of the area to be repaired based on the failure edge index set, obtains the reference edge coordinates corresponding to the edge response values of adjacent areas on both sides of the range, calculates the span vector magnitude and interpolation weight factor connecting the start and end ranges, introduces the surface finish coefficient, tangential deflection angle and local radius of curvature that characterize the surface geometry of the component, calculates the interpolation point coordinates, and connects multiple interpolation point coordinates in sequence to generate a continuous compensation contour.
[0022] As a further aspect of the present invention, the process of setting the amplitude threshold specifically involves selecting a normal texture region in a single-frame grayscale image that does not include high reflectivity features, calculating the average difference between the edge response values of adjacent pixels within the region, and using the product of the average difference and a preset signal-to-noise ratio gain coefficient as the amplitude threshold.
[0023] As a further aspect of the present invention, the structural clustering module includes:
[0024] The angle sequence construction submodule, based on the compensation contour direction, sequentially traverses all discrete coordinate points on the contour path, takes the current coordinate point as the anchor point, connects the auxiliary sampling points in its forward and backward neighborhoods respectively, constructs a contour geometric vector representing the local tangent, performs vector dot product operation and divides by the product of vector magnitudes, calls the inverse cosine function to solve the angle value between adjacent vectors, arranges the calculated angle values in a one-dimensional linear order according to the topological connection order of the contour points, and generates a geometric vector angle sequence that quantifies the local geometric curvature characteristics of the contour.
[0025] The breakpoint identification submodule calls the geometric vector angle sequence, performs a first-order difference operation on the angle values of adjacent positions in the sequence, obtains a difference sequence reflecting the rate of change of the angle between adjacent vectors, compares the absolute value of each element in the difference sequence with the preset curvature difference threshold, filters the abrupt change points where the difference amplitude exceeds the limit, locks the corresponding contour coordinate index, marks the boundary position where the geometric shape undergoes a discontinuous transition, and generates cluster breakpoints that define the geometric feature region.
[0026] The structure grouping submodule segments the contour according to the clustering breakpoints, performs gradient calculation on the included angle value in each segment, analyzes the direction of the included angle change trend, counts the number of times the trend direction flips between positive and negative polarities and the corresponding amplitude fluctuation value, and when it is detected that the trend direction has continuously flipped and the amplitude fluctuation value exceeds the amplitude fluctuation threshold, it performs secondary truncation and subgrouping within the current segment, assigns a unique group attribute identifier to each independent point cloud segment after division, and establishes a point cloud grouping structure including hierarchical geometric information.
[0027] As a further aspect of the present invention, the setting method of the curvature difference threshold is specifically as follows: calculate the absolute value of all values in the difference sequence, solve the arithmetic mean and standard deviation of the absolute value set, and use the sum of the arithmetic mean and the preset multiple standard deviation as the curvature difference threshold.
[0028] The specific method for setting the amplitude fluctuation threshold is as follows: traverse the complete sequence of geometric vector angles, calculate the global variance of all angle values in the sequence, calculate the average interval distance of non-zero elements in the difference sequence, generate a structural compactness factor, and use the ratio of the global variance to the structural compactness factor as the base, multiply it by the elasticity tolerance coefficient to generate the amplitude fluctuation threshold.
[0029] As a further aspect of the present invention, the distortion analysis module includes:
[0030] The amplitude extraction submodule, based on the point cloud grouping structure, performs projection scanning on the point cloud data along the spatial reference directions of the X-axis, Y-axis and Z-axis respectively, under the physical condition that the camera viewpoint remains fixed. It identifies the edge feature points in the group and constructs a linear point array. It calculates the absolute coordinate value and relative displacement of each feature point in the point array on the corresponding projection axis, counts the coordinate dispersion and extreme value span along the axial distribution, quantifies the geometric extension state of the edge contour in the three-dimensional orthogonal coordinate system, and generates the amplitude of the edge response linear array coordinate change.
[0031] The mapping construction submodule calls the change amplitude of the edge response linear array coordinates, maps it to the ideal linear projection plane under the standard field of view, calculates the geometric deviation vector of the actual edge response position relative to the theoretical linear position, performs second-order differential solution on the rate of change of the deviation vector along the normal direction of the projection plane, fits the spatial curvature distribution surface in the field of view, constructs a discrete data grid, and generates a projection plane distortion curvature mapping table.
[0032] The deformation determination submodule, for the component images acquired from each viewpoint, combines the curvature correction parameters in the projection surface distortion curvature mapping table, extracts the actual physical pixel distance between edge linear array response points in the image, calculates the numerical ratio of the actual physical pixel distance to the theoretical equidistant sampling value, constructs a response point interval ratio sequence, monitors the dynamic evolution of the sequence distribution along the target axis in real time, and when a non-constant gradient change trend of the ratio value is detected, determines the corresponding spatial axis and generates non-equidistant deformation.
[0033] As a further aspect of the present invention, the attitude restoration module includes:
[0034] The coordinate convergence submodule applies inverse angle compensation estimation to the axes with non-equidistant deformation, sets initial spatial mapping parameters in conjunction with the projection surface distortion curvature mapping table, calls the nonlinear least squares algorithm to construct the objective function, performs nonlinear iterative optimization on the projection intersections of multiple views, monitors the spatial distribution density of the three-axis intersections in real time, stops iteration when the rate of change of the density value meets the preset convergence condition, locks the optimal solution of the spatial position, and generates the convergence coordinate set of the three-axis intersections;
[0035] The dimension calculation submodule extracts boundary feature points that characterize the geometric contour of the component based on the convergent coordinate set of the three-axis intersection points, calculates the Euclidean distance of the feature points in the three-dimensional spatial coordinate system, performs geometric fitting operation to solve the radius and center parameters for the region including surface features, analyzes the length, width and depth features of the component, summarizes the calculated spatial geometric quantification data, and generates the geometric dimension values of the component.
[0036] The result determination submodule calls the geometric dimension values of the component, obtains the preset dimensional tolerance range data, performs numerical comparison to calculate the absolute value of the deviation between the actual size and the upper and lower limits of the standard tolerance, determines the qualified status of the component based on the absolute value of the deviation, classifies the defect level for the dimension items that exceed the tolerance range, and obtains the component dimension inspection result.
[0037] Compared with the prior art, the advantages and positive effects of the present invention are as follows:
[0038] In this invention, by acquiring the grayscale change trends of each pixel and its neighboring points in an image, high-reflectivity suspected interference areas are identified and edge response invalidation is performed. Linear interpolation compensation is performed by combining the effective edge response values of adjacent areas. After constructing a continuous contour direction, clustering and subgrouping are implemented based on the trend of the angle difference between contour geometric vectors. Structured point cloud grouping is established. The amplitude of the change of the three-axis direction response linear array is extracted to construct a distortion curvature mapping table and determine the existence of non-equidistant deformation. Inverse angle compensation is applied and the convergence process of the three-axis intersection points is completed through a nonlinear optimization algorithm. The geometric dimensions are calculated based on the three-dimensional coordinates and the detection results are output, realizing adaptive detection of different postures and surface interference component sizes. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a system flowchart of the present invention;
[0041] Figure 2 This is a schematic diagram of the system framework of the present invention;
[0042] Figure 3 This is a flowchart of the interference region identification module of the present invention;
[0043] Figure 4 This is a flowchart of the edge repair module of the present invention;
[0044] Figure 5 This is a flowchart of the structural clustering module of the present invention;
[0045] Figure 6 This is a flowchart of the distortion analysis module of the present invention;
[0046] Figure 7 This is a flowchart of the attitude restoration module of the present invention. Detailed Implementation
[0047] The technical solution of the present invention will now be described with reference to the accompanying drawings.
[0048] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.
[0049] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning.
[0050] In this embodiment of the invention, sometimes a subscript such as W1 may be written in a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.
[0051] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0052] Please see Figure 1 A component size inspection system based on machine vision, the system includes an interference area identification module, an edge repair module, a structure clustering module, a distortion analysis module and a posture restoration module;
[0053] The interference area identification module acquires a single-frame grayscale image of the component under test, reads the grayscale values of each pixel and its five adjacent pixels in the horizontal and vertical directions of the single-frame grayscale image, constructs a grayscale value sequence, counts the number of times the grayscale increase or decrease direction changes in the grayscale value sequence, and marks the corresponding area in the single-frame grayscale image and generates a high-reflectivity suspected interference area when the number of changes exceeds two and the peak interval width is lower than a preset threshold.
[0054] The edge repair module calculates the edge response difference between the edge response value in the high-reflection suspected interference area and the edge response value of the adjacent area. When the edge response difference exceeds the preset amplitude threshold, the edge response is invalidated. The linear interpolation algorithm is called to perform interpolation calculation based on the edge response value of the adjacent area to generate a continuous compensation contour.
[0055] The structural clustering module extracts the contour geometric vectors formed by adjacent contour points and their neighborhoods in the compensation contour direction, calculates the angle values between contour geometric vectors, constructs a sequence of geometric vector angles, calculates the difference sequence of adjacent angles in the geometric vector angle sequence, identifies the point of sudden increase in difference in the difference sequence and generates clustering breakpoints, analyzes the direction of angle change trend for the segments divided by the clustering breakpoints, and performs subgrouping when the direction of angle change trend changes continuously and the amplitude fluctuation exceeds the predetermined standard, and establishes the point cloud grouping structure.
[0056] The distortion analysis module extracts the variation amplitude of the edge response linear array coordinates of the point cloud group structure in the X, Y, and Z axes under the condition of fixed camera view. It constructs a projection surface distortion curvature mapping table and performs dynamic determination of the interval ratio of linear array response points for the component images acquired from each view to determine the non-equal spacing deformation in the corresponding axial direction.
[0057] The attitude restoration module applies reverse angle compensation estimation for axes with non-equidistant deformation, performs iterative optimization on the three-axis intersection points based on the projection plane distortion curvature mapping table, converges the density of the three-axis intersection points, calculates the geometric dimensions of the components based on the converged three-dimensional coordinate data of the three-axis intersection points, and generates the component size detection results by comparing with the preset tolerance range.
[0058] The high-reflectivity suspected interference area includes a set of abnormal pixel coordinates, a gray-level gradient inversion map, and a local spot boundary mask. The compensation contour direction includes interpolation repair coordinate points, edge response weight coefficients, and contour continuity vectors. The point cloud grouping structure includes independent geometric feature segments, cluster boundary identifiers, and a topological connection matrix. Non-equidistant deformation includes axial compression-stretch ratio, local projection deformation coefficient, and perspective distortion gradient parameters. The component size detection results include geometric size measurement values, tolerance matching status indicators, and size deviation accuracy ratings.
[0059] Please see Figure 2 and Figure 3 The interference area identification module includes:
[0060] The sequence construction submodule acquires a single-frame grayscale image of the component under test, establishes a two-dimensional coordinate index in the bitmap data matrix of the single-frame grayscale image, traverses the position of the pixel to be detected one by one, takes the current pixel as the geometric center, reads the grayscale quantization values of the five adjacent pixel units along the horizontal scan line direction and the vertical scan line direction respectively, and combines and arranges the multiple sets of grayscale quantization values according to the spatial adjacency order to generate a grayscale value sequence.
[0061] A gigabit Ethernet port triggers an industrial camera to capture a single-frame grayscale image of the surface of the ceramic capacitor under test, and the image data stream is converted into a two-dimensional grayscale bitmap matrix with a bit depth of 8 bits. The origin of the matrix coordinate system is set at the top left corner of the image, with the positive X-axis pointing horizontally to the right and the positive Y-axis pointing vertically downwards. The image resolution is defined as follows: Each pixel has its own dedicated memory space for storing a coordinate index table, which is achieved through a double loop instruction. From 0 to 2447, Iterate through each pixel in the matrix from 0 to 2047. Read the currently traversed pixel. grayscale value ,Keep Unchanged and let exist The interval variation is used to read the grayscale values of the 5 vertically adjacent pixels, maintaining... Unchanged and let exist Within the interval, the grayscale values of the five horizontally adjacent pixels are read. If the neighboring coordinates exceed the image boundary, they are automatically filled with 0 values. The five horizontal and five vertical grayscale values are sequentially written into a one-dimensional array according to the topological adjacency order of "horizontal first, then vertical". Data that is read repeatedly at the center point is removed, and a local grayscale feature sequence containing nine grayscale quantification values is constructed. For example, regarding coordinates Extract grayscale values from the pixels at each location sequentially. Combine and generate a grayscale value sequence to complete the serialization mapping of all pixels in the image and generate a grayscale value sequence.
[0062] The fluctuation statistics submodule calls the gray value sequence, performs a first-order difference operation on adjacent elements within the sequence, extracts the sign bit of the difference result, counts the total number of alternating jumps between positive and negative polarities of the difference sign, obtains the number of times the gray value increases or decreases, synchronously retrieves the index position where the gray value in the sequence reaches a local maximum, calculates the pixel coordinate distance between two adjacent local maximum indices, and generates the peak interval width that characterizes the spatial span of the bright area of the spot.
[0063] Call the cached grayscale value sequence in memory Define loop variable Perform first-order difference operations from 1 to 8. Obtain the difference set containing 8 difference values, iterate through the difference set, and use the sign function. Extract the sign bit of each difference value and set a counter. The initial value is 0, and adjacent difference signs are compared. and If the product of the two is Then it is determined that a polarity alternation has occurred, and the counter is set to... Increment by 1, and after traversal, output the number of times the grayscale value changes in the direction of increase or decrease, and also output the grayscale value sequence. Apply the local maximum search algorithm to identify those that satisfy... and Element index of condition Store all indexes that meet the conditions in a list. If the list If the number of elements in the list is greater than or equal to 2, then calculate the absolute value of the difference between any two adjacent index values in the list. Multiply the difference by the pixel physical equivalent (e.g., ), for index sequences In this case, the distance is calculated as Each index unit has a physical span of [number] units. Generate the peak interval width that characterizes the spatial span of the bright area of the light spot.
[0064] The region marking submodule performs multi-dimensional logical judgment based on the number of grayscale increase / decrease direction changes and the peak interval width. It compares the number of grayscale increase / decrease direction changes with a preset frequency threshold and the peak interval width with a preset interference judgment threshold. When the comparison results meet the conditions, it locks the corresponding pixel coordinate range in the single frame grayscale image and establishes a high-reflectivity suspected interference area marked with abnormal reflective positions.
[0065] The process of setting the frequency threshold is as follows: select the diffuse reflection area of a standard non-reflective calibration plate or component as a reference sample, extract the gray-level sequence of the edge transition area, calculate the statistical probability distribution of the gray-level gradient sign flipping in the sequence, and take the upper limit of the confidence interval of the edge monotonicity change in the statistical distribution as the frequency threshold.
[0066] The specific process of setting the interference judgment threshold is as follows: based on the camera calibration parameters of the machine vision system, calculate the actual physical length represented by a single pixel, read the minimum effective structural width defined in the CAD drawing or specification of the component under test, divide it by the pixel equivalent, obtain the theoretical pixel width occupied by the structure in the image, and set the theoretical pixel width as the interference judgment threshold.
[0067] Based on the number of times the grayscale increase / decrease direction changes With peak interval width Perform multi-dimensional logic judgment and read the preset frequency threshold. Interference detection threshold Execute the conditional statement, when the condition is met and When the current pixel is determined to be in a non-defect region of high-frequency texture fluctuation, i.e., a high-reflectivity suspected interference region, the corresponding pixel coordinates in the single-frame grayscale image are locked. Store it in the anomaly mask matrix The process of setting the frequency threshold is as follows: a standard non-reflective calibration plate (such as a diffuse reflection alumina ceramic plate) is selected as a reference sample. 100 sets of edge transition area images are acquired under a standard light source environment. The grayscale sequence of each set of edges is extracted, and the statistical probability distribution of grayscale gradient sign flipping in the sequence is calculated. The mean number of flips is obtained through statistical analysis. Second, standard deviation Next, the confidence level is set to ,calculate The frequency threshold is set to 5 times by rounding up. The specific process for setting the interference judgment threshold is as follows: based on the camera calibration parameters of the machine vision system, the single pixel accuracy is obtained. The minimum effective structural width of the electrode welding end defined in the CAD drawing of the component under test is read as follows: Perform division operation The theoretical pixel width is 30 pixels, taking into account the edge blurring effect. The shrinkage coefficient, calculation The theoretical pixel width was set to the interference judgment threshold of 24 pixels, and a high-reflectivity suspected interference area marked with abnormal reflective positions was established.
[0068] Please see Figure 2 and Figure 4 The edge repair module includes:
[0069] The response comparison submodule, for the high-reflection suspected interference area, obtains the edge response value inside the area and the edge response value of the adjacent area outside the area, respectively, performs a subtraction operation to solve the absolute value of the difference between the edge response value inside the area and the edge response value of the adjacent area, and generates the edge response deviation value that quantifies the degree of signal change.
[0070] With mask matrix The connected components marked in the middle are treated as objects, and the pixel edge response values at the centroid positions within the connected components are extracted. (The gradient magnitude is calculated using the Sobel operator), and the edge response values of adjacent normal background regions are extracted by expanding outward by 3 pixels along the outer contour normal direction of the connected region. Perform subtraction operation For example, for a highly reflective point, the measured edge response value within the area is 210 (8-bit grayscale gradient), while the edge response value of the adjacent background outside the area is 45. Calculate the absolute value of the difference. This value is used as the edge response deviation value for quantifying the degree of signal mutation.
[0071] The exception handling submodule calls the edge response deviation value and compares it with the preset amplitude threshold. When it is determined that the edge response deviation value exceeds the amplitude threshold, the edge signal in the high reflection suspected interference area is set to zero and invalidated, the start and end coordinates of the signal interruption are locked, and a set of failure edge indexes that defines the interpolation interval is generated.
[0072] The specific process of setting the amplitude threshold is as follows: select a normal texture area in a single frame grayscale image that does not include high reflectivity features, calculate the average difference between the edge response values of adjacent pixels in the area, and use the product of the average difference and the preset signal-to-noise ratio gain coefficient as the amplitude threshold.
[0073] Call edge response deviation value Read the preset amplitude threshold Execute the numerical comparison command, and determine the edge response deviation value. If the area is confirmed to be invalid interference, the original edge signal value corresponding to the suspected high-reflectivity interference area is forcibly reset to 0, and the starting coordinates of the signal interruption location are recorded. and termination coordinates Build index pairs And store it in the failure edge index set; the specific process of setting the amplitude threshold is as follows: select a normal texture area (such as an isotropic frosted surface) in a single frame grayscale image that does not include high reflectivity features, randomly sample 50 groups of adjacent pixels, and count the average difference of edge response values between adjacent pixels in the region. Set the signal-to-noise ratio gain coefficient (Based on industrial field illumination stability experiments), perform multiplication operations. The product of the average difference and the preset signal-to-noise ratio gain coefficient, 42, is used as the amplitude threshold to generate a failure edge index set that defines the interpolation interval.
[0074] The contour compensation submodule determines the start and end range of the area to be repaired based on the failure edge index set, obtains the reference edge coordinates corresponding to the edge response values of adjacent areas on both sides of the range, calculates the span vector magnitude and interpolation weight factor connecting the start and end ranges, and introduces surface finish coefficients, tangential deflection angles, and local curvature radii that characterize the surface geometry of the component, using the following formula:
[0075] ;
[0076] The calculation obtains the coordinates of the interpolation points, and the coordinates of multiple interpolation points are connected in sequence to generate a continuous compensation profile.
[0077] in, Represents the coordinates of the interpolation point. This represents the reference edge coordinate value corresponding to the edge response value of the adjacent region. This represents the normalized interpolation weight factor calculated based on the interpolation position. The magnitude of the span vector representing the start and end range of the connection. The value in radians represents the tangential deflection angle of the profile. Normalization coefficient representing the surface finish of components. This represents the local radius of curvature value of the interpolation region. This represents a small distance quantity used to prevent the denominator from being zero;
[0078] Obtain the reference edge coordinates corresponding to the edge response values of adjacent regions on both sides of the range. Calculate the span vector magnitude of the connection's start and end ranges. and interpolation weighting factor A surface finish coefficient is introduced to characterize the surface geometry of components. Tangential deflection angle and local radius of curvature The formula used is:
[0079] ;
[0080] The calculation obtains the coordinates of the interpolation points, and the coordinates of multiple interpolation points are connected sequentially to generate a continuous compensation profile. The meanings of the parameters in the formula are as follows: The calculated interpolation point coordinates represent the target result after repair. The coordinate values representing the left or right reference edge of the start and end range are used as anchor points for interpolation. This represents the normalized interpolation weight factor calculated based on the relative position of the current interpolation point within the start and end range, with a value range of [value missing]. ; The span vector magnitude represents the length of the distance between the two ends of the range, and represents the straight-line distance of the gap. The radian value representing the tangential deflection angle of the profile at the anchor point is used to correct the direction of the straight line interpolation; The normalization coefficient represents the surface finish of the component. The closer the value is to 1, the smoother the surface and the more sensitive it is to angular deviation. The value of the local radius of curvature obtained by fitting adjacent normal contours in the interpolation region is used to introduce a quadratic curve correction term. This represents a small distance quantity used to prevent the denominator from being zero, and its value is... The calculation logic of this formula lies in: the first term Provides the base position offset; second item For the linear trend term, the cosine component is used to correct the direction of the linear interpolation based on the tangent angle and surface finish, so that the initial interpolation follows the original tangent direction; the third term For the nonlinear curvature compensation term, a nonlinear combination (square root term) of the curvature radius and weighting factor is used to simulate the arcuate bulges or depressions of the surface, ensuring that the repaired contour conforms to the physical curvature properties of the component. Specific calculation examples are shown in Table 1. Assuming the following parameters are obtained when processing a reflective notch at the edge of an electrode:
[0081] Table 1. Example table of parameters for contour compensation formula;
[0082]
[0083] Perform multi-level calculations by substituting parameters into the formula:
[0084] Calculate the angle term: rad;
[0085] Calculate the cosine value: ;
[0086] Calculate the linear trend term: ;
[0087] Calculate the denominator for curvature: ;
[0088] Calculate the curvature numerator: ;
[0089] Calculate the nonlinear weights: ;
[0090] Calculate the curvature compensation term: 8. Calculate the final coordinates: This result indicates that in simple linear interpolation (where the midpoint should be...), Based on this, the formula introduces... The curvature and angle correction of pixels make the repair points fit the arc surface features with a radius of 100 pixels better, rather than rigid straight line connections, thus generating a continuous compensation contour.
[0091] Please see Figure 2 and Figure 5 The structural clustering module includes:
[0092] The angle sequence construction submodule, based on the compensated contour direction, sequentially traverses all discrete coordinate points on the contour path, uses the current coordinate point as the anchor point, connects the auxiliary sampling points in its forward and backward neighborhoods respectively, constructs the contour geometric vector representing the local tangent, performs vector dot product operation and divides by the product of vector magnitudes, calls the inverse cosine function to solve the angle value between adjacent vectors, arranges the calculated angle values in one dimension according to the topological connection order of the contour points, and generates a geometric vector angle sequence that quantifies the local geometric curvature characteristics of the contour.
[0093] Create a contour point index From 0 to Traverse all discrete coordinate points on the contour path in sequence, starting with the current coordinate point. As anchor points, select indexes respectively. forward neighbor points With index backward neighbor points As auxiliary sampling points, construct from point to forward vector And from point to Backward vector Calculate the dot product of two vectors. Simultaneously calculate the magnitudes of the two vectors. and Perform division operation Call the inverse cosine function Calculate the angle between adjacent vectors (in degrees). For a straight line segment, this value is close to 0 degrees; for a right-angle turn, this value is close to 90 degrees. All the calculated values... The values are stored in a one-dimensional floating-point array according to the topological connection order of the contour points, generating a sequence of geometric vector angles that quantify the local geometric curvature characteristics of the contour.
[0094] The breakpoint identification submodule calls the geometric vector angle sequence, performs a first-order difference operation on the angle values of adjacent positions in the sequence, obtains a difference sequence reflecting the rate of change of the angle between adjacent vectors, compares the absolute value of each element in the difference sequence with the preset curvature difference threshold, filters the abrupt change points where the difference amplitude exceeds the limit, locks the corresponding contour coordinate index, marks the boundary positions where the geometric shape undergoes discontinuous transitions, and generates clustered breakpoints that define the geometric feature region.
[0095] The specific method for setting the curvature difference threshold is as follows: calculate the absolute value of all values in the difference sequence, solve the arithmetic mean and standard deviation of the absolute value set, and use the sum of the arithmetic mean and the preset multiple of the standard deviation as the curvature difference threshold.
[0096] Call the geometric vector angle sequence Perform a first-order difference operation on the angle values between adjacent positions in the sequence. Obtain the difference sequence reflecting the rate of change of the angle between adjacent vectors, and compare each element in the difference sequence one by one. The absolute value of the difference between the preset curvature threshold and the value of the difference between the preset curvature threshold The size, when When determining the index The location is a geometric abrupt change point. All indices meeting the criteria are filtered, and the corresponding contour coordinate indices are locked. The boundary positions where the geometric shape undergoes discontinuous transitions are marked. Specifically, the curvature difference threshold is set by collecting the included angle sequence of standard qualified samples and calculating the absolute value set of all values in the difference sequence. Find the arithmetic mean of the set of absolute values. with standard deviation Set the preset multiplier to 6 (corresponding to the 6 sigma principle for extremely low false detection rates), and calculate... Using 1.7 degrees as the curvature difference threshold, cluster breakpoints are generated to define the geometric feature regions.
[0097] The structure grouping submodule segments the contour based on clustering breakpoints, performs gradient calculation on the included angle values within each segment, analyzes the trend direction of the included angle change, and counts the number of times the trend direction flips between positive and negative polarities and the corresponding amplitude fluctuation values. When a continuous flip of the trend direction is detected and the amplitude fluctuation value exceeds the amplitude fluctuation threshold, a secondary truncation and subgrouping are performed within the current segment. A unique group attribute identifier is assigned to each independent point cloud segment after division, and a point cloud grouping structure including hierarchical geometric information is established.
[0098] The specific method for setting the amplitude fluctuation threshold is as follows: traverse the complete sequence of geometric vector angles, calculate the global variance of all angle values in the sequence, calculate the average interval distance of non-zero elements in the difference sequence, generate a structural compactness factor, and use the ratio of the global variance to the structural compactness factor as the base, multiply it by the elasticity tolerance coefficient to generate the amplitude fluctuation threshold.
[0099] The included angle value within each segment Perform gradient calculation Analyze the direction of the angle change trend (gradient sign), and count the number of times the trend direction flips between positive and negative polarities. and the corresponding amplitude fluctuation value When detected and Exceeding the amplitude fluctuation threshold When the segment is determined to be a complex texture region, a secondary truncation and subgrouping based on local extrema are performed within the current segment. A unique group attribute identifier (e.g., Group_ID_01, Group_ID_02) is assigned to each independent point cloud fragment after the subgrouping, establishing a point cloud grouping structure that includes hierarchical geometric information. Specifically, the amplitude fluctuation threshold is set by traversing the complete sequence of geometric vector angles and calculating the global variance of all angle values in the sequence. The average interval distance of non-zero elements in the statistical difference sequence Pixels, generating structural compactness factor The ratio of global variance to structural tightness factor is used as the base. Multiply by the elastic tolerance factor (Empirical value, used to tolerate manufacturing tolerances), calculation The generation amplitude fluctuation threshold is 0.6, ensuring that the group is insensitive to small spikes but can capture significant structural changes.
[0100] Please see Figure 2 and Figure 6 The distortion analysis module includes:
[0101] The amplitude extraction submodule, based on the point cloud grouping structure, performs projection scanning on the point cloud data along the spatial reference directions of the X-axis, Y-axis and Z-axis under the physical condition of keeping the camera viewpoint fixed. It identifies the edge feature points in the group and constructs a linear point matrix. It calculates the absolute coordinate value and relative displacement of each feature point in the point matrix on the corresponding projection axis, counts the coordinate dispersion and extreme value span along the axis, quantifies the geometric extension state of the edge contour in the three-dimensional orthogonal coordinate system, and generates the amplitude of the edge response linear array coordinate change.
[0102] Under the physical condition of maintaining a fixed viewpoint in the industrial camera, a world coordinate system is established. Point cloud data for each group are projected and scanned along the spatial reference directions of the X-axis (length direction), Y-axis (width direction), and Z-axis (height direction). For X-axis projection, the Y and Z coordinates of the point cloud are preserved, and the X coordinate is recorded as a depth index. Edge feature points within each group are identified, and a linear point matrix is constructed. The absolute coordinate values of each feature point in the point matrix on the corresponding projection axis are calculated. The relative displacement with respect to the centroid within the group The coordinate dispersion (standard deviation) and extreme value span (maximum value minus minimum value) distributed along the axial direction are statistically analyzed to quantify the geometric extension state of the edge contour in a three-dimensional orthogonal coordinate system and generate the change amplitude of the edge response linear matrix coordinates.
[0103] The mapping construction submodule calls the change amplitude of the edge response linear array coordinates, maps it to the ideal linear projection plane under the standard field of view, calculates the geometric deviation vector of the actual edge response position relative to the theoretical linear position, solves the second-order differential of the rate of change of the deviation vector along the normal direction of the projection plane, fits the spatial curvature distribution surface in the field of view, constructs a discrete data grid describing the nonlinear mapping relationship between the three-dimensional spatial coordinates and the degree of distortion of the two-dimensional projection plane, and generates a projection plane distortion curvature mapping table.
[0104] The variation amplitude of the edge response linear array coordinates is mapped to an ideal linear projection plane under the standard field of view (assuming the imaging plane is distortion-free), and the actual edge response position is calculated. Relative to the theoretical linear position geometric deviation vector The rate of change of the deviation vector along the normal direction of the projection plane is solved by second-order differential. Fit the spatial curvature distribution surface within the field of view. A discrete data grid (Look-Up Table, LUT) is constructed to describe the nonlinear mapping relationship between three-dimensional spatial coordinates and the degree of distortion of the two-dimensional projection plane. The grid node density is [value missing]. Each pixel stores curvature correction coefficients, generating a projection surface distortion curvature mapping table.
[0105] Extract the actual physical pixel distance between edge linear array response points in the corrected image. Read the equally spaced sampled values from the theoretical model (e.g., standard pin spacing), calculate the ratio of the actual physical pixel distance to the theoretically equal-spacing sample value. Construct a response point interval ratio sequence and monitor the dynamic evolution of the sequence distribution along the target axis in real time. When a ratio value is detected... When a non-constant gradient change trend is observed (e.g., linearly increasing from 1.00 to 1.05), it is determined that there is tensile or compressive deformation in that direction, the corresponding spatial axis is determined, and non-equidistant deformation is generated.
[0106] Please see Figure 2 and Figure 7 The attitude restoration module includes:
[0107] The coordinate convergence submodule applies inverse angle compensation estimation for axes with non-equidistant deformation, sets initial spatial mapping parameters based on the projection plane distortion curvature mapping table, calls a nonlinear least squares algorithm to construct the objective function, performs nonlinear iterative optimization on the projection intersections of multiple views, monitors the spatial distribution density of the three-axis intersections in real time, stops iteration when the rate of change of density values meets the preset convergence conditions, locks the optimal solution in spatial position, and generates a converged coordinate set of the three-axis intersections.
[0108] The process of real-time monitoring of the spatial distribution density of the three-axis intersection point is as follows: in the three-dimensional coordinate system, with the position of the three-axis intersection point calculated in the current iteration as the center, a unit detection sphere with a preset search radius is established, the projection rays under multiple views are traversed, the total number of projection rays passing through the unit detection sphere is counted, the ratio of the total number of projection rays to the volume of the unit detection sphere is calculated, and the ratio is established as the current spatial distribution density.
[0109] The process of stopping the iteration when the rate of change of the density value meets the preset convergence condition is as follows: calculate the difference between the spatial distribution density of the current iteration cycle and the historical spatial distribution density of the previous iteration cycle to obtain the density evolution gradient; compare the density evolution gradient with the preset gradient convergence minimum value; when the density evolution gradient is lower than the gradient convergence minimum value, it is determined that the iterative optimization process has reached a steady state and the result is output.
[0110] The objective function is constructed by calling a nonlinear least squares algorithm (such as the Levenberg-Marquardt algorithm). Nonlinear iterative optimization is performed on the projection intersections from multiple perspectives, and the spatial distribution density of the three-axis intersections is monitored in real time. The iteration stops when the rate of change of the density value meets the preset convergence condition, the optimal solution in spatial location is locked, and a convergence coordinate set of the three-axis intersection points is generated. The process of real-time monitoring of the spatial distribution density of the three-axis intersection points specifically involves calculating the position of the three-axis intersection points in the three-dimensional coordinate system using the position of the three-axis intersection points calculated in the current iteration. Establish a search radius with the center of the sphere as the target. For a unit detection sphere, traverse the projected rays from multiple viewpoints and count the total number of projected rays passing through the unit detection sphere. Calculate the total number of projected rays and the volume of the unit detection sphere. The ratio, the ratio The current spatial distribution density is established; the iteration process stops when the rate of change of the density value meets the preset convergence condition. Specifically, the current iteration period is calculated. Spatial distribution density Compared to the previous iteration cycle Historical spatial distribution density The difference between the values yields the density evolution gradient. The density evolution gradient converges to a minimum with a preset gradient. Perform numerical comparison, when That is, determining that the iterative optimization process has reached a steady state and outputting the result.
[0111] The dimension calculation submodule extracts boundary feature points that characterize the geometric contour of the component based on the convergent coordinate set of the three-axis intersection point, calculates the Euclidean distance of the feature points in the three-dimensional spatial coordinate system, performs geometric fitting operation to solve the radius and center parameters for the region including surface features, analyzes the length, width and depth features of the component, summarizes the calculated spatial geometric quantification data, and generates the geometric dimension values of the component.
[0112] Extract boundary feature points that characterize the geometric contours of components, calculate the Euclidean distance between these feature points in a three-dimensional coordinate system, and perform least-squares circle fitting to solve for the radius in regions including curved features (such as the ends of cylindrical capacitors). With the center parameter The length, width, length, and depth characteristics of the components are analyzed, and the calculated spatial geometric quantification data is summarized to generate the geometric dimension values of the components.
[0113] The result determination submodule calls the component's geometric dimension values, obtains the preset dimensional tolerance range data, performs numerical comparison to calculate the absolute value of the deviation between the actual size and the upper and lower limits of the standard tolerance, determines the component's pass / fail status based on the absolute value of the deviation, classifies the defect level for dimensions that exceed the tolerance range, and obtains the component's dimensional inspection results.
[0114] The segment calls the geometric dimensions of the components (e.g., measured length). ), obtain the preset dimensional tolerance range data (e.g., standard length) ,tolerance Perform a numerical comparison to calculate the absolute value of the deviation between the actual size and the upper and lower limits of the standard tolerance. The pass / fail status of components is determined based on the absolute value of the deviation. (If the condition is deemed acceptable), defects are classified for dimensions that exceed the tolerance range (e.g., deviation). It is a minor defect. (For serious defects), the component size inspection results are obtained.
[0115] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. A and B can be singular or plural. Additionally, the character " / " in this article generally indicates an "or" relationship between the preceding and following related objects, but it can also represent an "and / or" relationship. Please refer to the context for a more accurate understanding.
[0116] In this invention, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of a single item or a plurality of items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be a single item or multiple items.
[0117] It should be understood that, in various embodiments of the present invention, the order of the above-mentioned process numbers does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0118] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0119] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0120] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0121] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0122] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0123] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0124] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of protection of the described technical solutions.
Claims
1. A component size inspection system based on machine vision, characterized in that, The system includes: The interference area identification module acquires a single-frame grayscale image of the component under test, reads pixels and adjacent grayscale values to construct a grayscale value sequence, counts the number of changes in the grayscale value sequence, and identifies and generates high-reflectivity suspected interference areas. The edge repair module calculates the edge response difference between the suspected high-reflectivity interference area and the adjacent area. When the difference exceeds the standard, the response is discarded. Linear interpolation is performed based on the edge response of the adjacent area to generate a compensation contour. The structural clustering module extracts the angle between the compensation contour direction vectors to construct a sequence of geometric vector angles, identifies abrupt increases in the geometric vector angle sequence to generate cluster breakpoints, analyzes the trend of angle changes in the cluster breakpoint segments, divides them into groups, and establishes a point cloud grouping structure. The structural clustering module includes: The angle sequence construction submodule, based on the compensation contour direction, sequentially traverses all discrete coordinate points on the contour path, takes the current coordinate point as the anchor point, connects the auxiliary sampling points in its forward and backward neighborhoods respectively, constructs a contour geometric vector representing the local tangent, performs vector dot product operation and divides by the product of vector magnitudes, calls the inverse cosine function to solve the angle value between adjacent vectors, arranges the calculated angle values in a one-dimensional linear order according to the topological connection order of the contour points, and generates a geometric vector angle sequence that quantifies the local geometric curvature characteristics of the contour. The breakpoint identification submodule calls the geometric vector angle sequence, performs a first-order difference operation on the angle values of adjacent positions in the sequence, obtains a difference sequence reflecting the rate of change of the angle between adjacent vectors, compares the absolute value of each element in the difference sequence with the preset curvature difference threshold, filters the abrupt change points where the difference amplitude exceeds the limit, locks the corresponding contour coordinate index, marks the boundary position where the geometric shape undergoes a discontinuous transition, and generates cluster breakpoints that define the geometric feature region. The structure grouping submodule divides the contour into segments based on the clustering breakpoints, performs gradient calculation on the included angle values within each segment, analyzes the trend direction of the included angle change, and counts the number of times the trend direction flips between positive and negative polarities and the corresponding amplitude fluctuation values. When a continuous flip of the trend direction is detected and the amplitude fluctuation value exceeds the amplitude fluctuation threshold, a secondary truncation and subgrouping are performed within the current segment. A unique group attribute identifier is assigned to each independent point cloud segment after division, and a point cloud grouping structure including hierarchical geometric information is established. The specific method for setting the curvature difference threshold is as follows: calculate the absolute value of all values in the difference sequence, solve the arithmetic mean and standard deviation of the absolute value set, and use the sum of the arithmetic mean and the preset multiple of the standard deviation as the curvature difference threshold. The specific method for setting the amplitude fluctuation threshold is as follows: traverse the complete geometric vector angle sequence, calculate the global variance of all angle values in the sequence, calculate the average interval distance of non-zero elements in the difference sequence, generate a structural compactness factor, and use the ratio of the global variance to the structural compactness factor as the base, multiply it by the elasticity tolerance coefficient to generate the amplitude fluctuation threshold. The distortion analysis module extracts the coordinate variation range of the three-axis array of the point cloud grouping structure, constructs a projection surface distortion curvature mapping table, determines the interval ratio of response points, and identifies non-equidistant deformation. The attitude restoration module applies reverse compensation to the non-equidistant deformation axis, optimizes the convergence of the intersection point to the three-axis intersection point density based on the projection plane distortion curvature mapping table, calculates the size based on the convergence coordinates and compares the tolerance, and generates the component size detection result.
2. The component size inspection system based on machine vision according to claim 1, characterized in that, The high-reflectivity suspected interference area includes an abnormal pixel coordinate set, a grayscale gradient inversion map, and a local spot boundary mask. The compensation contour direction includes interpolation repair coordinate points, edge response weight coefficients, and contour continuity vectors. The point cloud grouping structure includes independent geometric feature segments, cluster boundary identifiers, and a topological connection matrix. The non-equidistant deformation includes axial compression-stretch ratio, local projection deformation coefficient, and perspective distortion gradient parameters. The component size detection results include geometric size measurement values, tolerance matching status indicators, and size deviation accuracy ratings.
3. The component size inspection system based on machine vision according to claim 2, characterized in that, The interference region identification module includes: The sequence construction submodule acquires a single-frame grayscale image of the component under test, establishes a two-dimensional coordinate index in the bitmap data matrix of the single-frame grayscale image, traverses the position of the pixel to be detected one by one, takes the current pixel as the geometric center, reads the grayscale quantization values of the five adjacent pixel units along the horizontal scan line direction and the vertical scan line direction respectively, and combines and arranges the multiple sets of grayscale quantization values according to the spatial adjacency order to generate a grayscale value sequence. The fluctuation statistics submodule calls the gray value sequence, performs a first-order difference operation on adjacent elements within the sequence, extracts the sign bit of the difference result, counts the total number of alternating jumps between positive and negative polarities of the difference sign, obtains the number of times the gray value increases or decreases, synchronously retrieves the index position where the gray value in the sequence reaches a local maximum value, calculates the pixel coordinate distance between two adjacent local maximum value indices, and generates the peak interval width that characterizes the spatial span of the bright area of the spot. The region marking submodule performs multi-dimensional logic judgment based on the number of grayscale increase / decrease direction changes and the peak interval width. It compares the number of grayscale increase / decrease direction changes with a preset frequency threshold and the peak interval width with a preset interference judgment threshold. When the comparison results meet the conditions, it locks the corresponding pixel coordinate range in the single frame grayscale image and establishes a high-reflectivity suspected interference area marked with abnormal reflective positions.
4. The component size inspection system based on machine vision according to claim 3, characterized in that, The process of setting the frequency threshold is as follows: select the diffuse reflection area of a standard non-reflective calibration plate or component as a reference sample, extract the gray-level sequence of the edge transition area, calculate the statistical probability distribution of the gray-level gradient sign flipping in the sequence, and take the upper limit of the confidence interval of the edge monotonicity change in the statistical distribution as the frequency threshold. The process of setting the interference judgment threshold is as follows: Based on the camera calibration parameters of the machine vision system, calculate the actual physical length represented by a single pixel. Read the minimum effective structural width defined in the CAD drawing or specification of the component under test, divide it by the pixel equivalent, obtain the theoretical pixel width occupied by the structure in the image, and set the theoretical pixel width as the interference judgment threshold.
5. The component size inspection system based on machine vision according to claim 4, characterized in that, The edge repair module includes: The response comparison submodule, for the high-reflection suspected interference area, obtains the edge response value inside the area and the edge response value of the adjacent area outside the area, respectively, performs a subtraction operation to solve the absolute value of the difference between the edge response value inside the area and the edge response value of the adjacent area, and generates an edge response deviation value that quantifies the degree of signal change. The anomaly handling submodule calls the edge response deviation value and compares it with a preset amplitude threshold. When it is determined that the edge response deviation value exceeds the amplitude threshold, the edge signal in the high-reflection suspected interference zone is set to zero and invalidated, the start and end coordinates of the signal interruption are locked, and a set of failed edge indexes that defines the interpolation interval is generated. The contour compensation submodule determines the start and end range of the area to be repaired based on the failure edge index set, obtains the reference edge coordinates corresponding to the edge response values of adjacent areas on both sides of the range, calculates the span vector magnitude and interpolation weight factor connecting the start and end ranges, introduces the surface finish coefficient, tangential deflection angle and local radius of curvature that characterize the surface geometry of the component, calculates the interpolation point coordinates, and connects multiple interpolation point coordinates in sequence to generate a continuous compensation contour.
6. The component size inspection system based on machine vision according to claim 5, characterized in that, The process of setting the amplitude threshold is as follows: select a normal texture area in a single frame grayscale image that does not include high reflectivity features, calculate the average difference between the edge response values of adjacent pixels in the area, and use the product of the average difference and the preset signal-to-noise ratio gain coefficient as the amplitude threshold.
7. The component size inspection system based on machine vision according to claim 1, characterized in that, The distortion analysis module includes: The amplitude extraction submodule, based on the point cloud grouping structure, performs projection scanning on the point cloud data along the spatial reference directions of the X-axis, Y-axis and Z-axis respectively, under the physical condition that the camera viewpoint remains fixed. It identifies the edge feature points in the group and constructs a linear point array. It calculates the absolute coordinate value and relative displacement of each feature point in the point array on the corresponding projection axis, counts the coordinate dispersion and extreme value span along the axial distribution, quantifies the geometric extension state of the edge contour in the three-dimensional orthogonal coordinate system, and generates the amplitude of the edge response linear array coordinate change. The mapping construction submodule calls the change amplitude of the edge response linear array coordinates, maps it to the ideal linear projection plane under the standard field of view, calculates the geometric deviation vector of the actual edge response position relative to the theoretical linear position, performs second-order differential solution on the rate of change of the deviation vector along the normal direction of the projection plane, fits the spatial curvature distribution surface in the field of view, constructs a discrete data grid, and generates a projection plane distortion curvature mapping table. The deformation determination submodule, for the component images acquired from each viewpoint, combines the curvature correction parameters in the projection surface distortion curvature mapping table, extracts the actual physical pixel distance between edge linear array response points in the image, calculates the numerical ratio of the actual physical pixel distance to the theoretical equidistant sampling value, constructs a response point interval ratio sequence, monitors the dynamic evolution of the sequence distribution along the target axis in real time, and when a non-constant gradient change trend of the ratio value is detected, determines the corresponding spatial axis and generates non-equidistant deformation.
8. The component size inspection system based on machine vision according to claim 1, characterized in that, The attitude restoration module includes: The coordinate convergence submodule applies inverse angle compensation estimation to the axes with non-equidistant deformation, sets initial spatial mapping parameters in conjunction with the projection surface distortion curvature mapping table, calls the nonlinear least squares algorithm to construct the objective function, performs nonlinear iterative optimization on the projection intersections of multiple views, monitors the spatial distribution density of the three-axis intersections in real time, stops iteration when the rate of change of the density value meets the preset convergence condition, locks the optimal solution of the spatial position, and generates the convergence coordinate set of the three-axis intersections; The dimension calculation submodule extracts boundary feature points that characterize the geometric contour of the component based on the convergent coordinate set of the three-axis intersection points, calculates the Euclidean distance of the feature points in the three-dimensional spatial coordinate system, performs geometric fitting operation to solve the radius and center parameters for the region including surface features, analyzes the length, width and depth features of the component, summarizes the calculated spatial geometric quantification data, and generates the geometric dimension values of the component. The result determination submodule calls the geometric dimension values of the component, obtains the preset dimensional tolerance range data, performs numerical comparison to calculate the absolute value of the deviation between the actual size and the upper and lower limits of the standard tolerance, determines the qualified status of the component based on the absolute value of the deviation, classifies the defect level for the dimension items that exceed the tolerance range, and obtains the component dimension inspection result.