Mobile phone frame hole processing detection method based on visual detection

By constructing sub-pixel gradient direction field and amplitude field, combining curvature description parameters and adaptive retrieval, and matching theoretical direction vectors, the problem of artifact interference in hole position detection of metal frames is solved, and high-precision hole position detection is achieved.

CN122243938APending Publication Date: 2026-06-19SHENZHEN HUAYUE SHITONG SOFTWARE TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN HUAYUE SHITONG SOFTWARE TECH CO LTD
Filing Date
2026-03-19
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

In existing technologies for detecting holes in mobile phone frames, the overlapping of cutting textures on the surface of metal workpieces with the geometric edge gradients of holes leads to artifact recognition, causing deviations in the geometric fitting process. Furthermore, relying on hardware light source isolation results in high costs and limited speed.

Method used

By constructing sub-pixel gradient direction field and amplitude field, using curvature description parameters and adaptive retrieval strategy, matching theoretical direction vectors, establishing geometric consistency weights, and constructing weighted residual functionals, sub-pixel localization and noise suppression are achieved.

Benefits of technology

It achieves accuracy and robustness in borehole location detection under complex working conditions, avoids artifact interference, and improves the certainty of detection and engineering tolerance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122243938A_ABST
    Figure CN122243938A_ABST
Patent Text Reader

Abstract

This invention relates to the field of industrial visual inspection technology and discloses a method for detecting machined holes in a mobile phone frame based on visual inspection. The method includes: acquiring an image of the subject to be inspected and extracting a set of sub-pixel edge point clouds; calculating the observed gradient direction vector and curvature description parameters of the edge points; matching theoretical direction vectors from a structured database; establishing geometric consistency weights by calculating the dot product of the direction vectors; constructing a weighted spatial distribution; constructing a weighted residual functional and solving for the minimum value; and outputting the detection result. This invention establishes a manifold alignment mechanism between the physical field and the theoretical field, thereby constraining the visual features by the design semantics, effectively attenuating tool mark artifacts, and ensuring that the detection parameters have deterministic convergence to the ideal model under complex interference.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial visual inspection technology, and more specifically, to a method for detecting hole positions in mobile phone frame processing based on visual inspection. Background Technology

[0002] In the current 3C manufacturing industry, the detection of holes in the metal frame of mobile phones after CNC machining is a key step in ensuring the assembly accuracy of the whole machine. The industry generally uses feature extraction technology to analyze the brightness changes of discrete pixel matrix, identify the hole contours and determine the geometric center. However, the surface of metal workpieces generates dense milling cutter textures during the cutting process, accompanied by cutting fluid film and high-gloss reflection at the chamfer. These physical characteristics cause drastic jumps in the pixel gradient field. Existing solutions usually set a threshold based on the gradient amplitude to extract the edge. However, under actual working conditions, the anisotropic high-gloss gradient generated by the machining texture often overlaps with the gradient of the geometric edge of the hole in terms of numerical distribution. This physical gradient aliasing causes the algorithm to identify a large number of artifacts as real edges in the non-maximum suppression stage, resulting in serious deviations in the subsequent geometric fitting process.

[0003] To address the aforementioned interference, the industry typically increases investment in hardware light sources to isolate stray light from specific directions. However, this increases system costs and limits online detection speed. Relying solely on physical isolation methods using hardware light sources has limitations, and existing software-based control and image feature processing methods also have shortcomings. For example, Chinese invention patent application CN111489389A discloses a spot center detection method, which mainly relies on the Canny edge detection operator to obtain pixel-level spot edges and combines interpolation and Gaussian fitting operations to solve for the center coordinates. Analyzing the underlying mechanism, conventional software control methods highly rely on the local grayscale gradient magnitude of the image. The implicit assumption is that the gradient energy of the target's true physical boundary must be higher than the idealized premise of background interference. In real-world, complex machining scenarios, the interplay of cutting fluid and dense toolpaths generates anisotropic high-frequency abrupt changes, resulting in significant overlap between amplitude and the actual geometric edges. Due to the lack of global topological prior constraints from the computer-aided design (CAD) in the comparison scheme, the bottom-up, purely data-driven mechanism cannot isolate high-amplitude artifacts from physical properties. This easily leads to misjudging tool mark noise as real contours and including them in subsequent calculations, causing uncontrollable systematic shifts in the final fitted parameters. Furthermore, conventional solutions lack topological constraints in the design dimension during the fitting process, and the rigid mapping relationship between the visual coordinate system and the design coordinate system is prone to systematic misalignment under the influence of machining stress release or clamping micro-offsets, causing the detection feature extraction mechanism to degrade in non-ideal optical environments.

[0004] Therefore, how to utilize computer-aided design of topological prior data to accurately isolate anisotropic texture noise in images with overlapping gradient distributions, and achieve feature alignment and sub-pixel localization with deformation immunity, is the technical problem to be solved by this invention. Summary of the Invention

[0005] This invention provides a vision-based method for detecting hole positions in mobile phone frame processing, comprising the following steps: Step S101: Obtain the image to be tested containing the geometric elements to be tested in the subject under inspection. Calculate the brightness gradient components of the pixels in the image to be tested to establish the direction field and amplitude field of the sub-pixel gradient. Perform sub-pixel localization sampling based on the local extreme points of the amplitude field to construct an edge feature point cloud set containing spatial coordinates and gradient vectors. Step S102: For each sub-pixel edge point in the edge feature point cloud set, extract the observed gradient direction vector and analyze the geometric manifold curvature distribution in the neighborhood of the sub-pixel edge point to determine the curvature description parameters that characterize the micromorphology of the local manifold at the edge. Step S103: Using the curvature description parameter as an index, the corresponding theoretical direction vector is matched from the preset structured database through an adaptive retrieval strategy; wherein, the preset theoretical edge trajectory, toolpath tangent vector and normal distribution features in the theoretical model of the subject under inspection are discretized and encoded for storage to construct the structured database; Step S104: Calculate the dot product of the observed gradient direction vector and the theoretical direction vector, establish the geometric consistency weight between the sub-pixel edge points and the theoretical design trajectory, and construct the weight spatial distribution of the edge feature point cloud set based on the geometric consistency weight, so as to implement weight suppression on the noise points in the edge feature point cloud set. Step S105: Construct a weighted residual functional for sub-pixel edge points using geometric consistency weights. Iteratively solve the center coordinates, fitted circle radius, and roundness deviation of the weighted residual functional to reach the minimum value, and output the detection results of the processing holes in the mobile phone frame.

[0006] Preferably, the adaptive retrieval strategy includes: calculating the local tensor matrix of edge features in the edge feature point cloud set, establishing geometric topological constraints based on the eigenvalue distribution of the local tensor matrix, implementing key-value pair addressing based on hash mapping in the structured database using curvature description parameters, and matching the theoretical direction vector with the highest correlation to the microscopic geometric features of the sub-pixel edge points.

[0007] Preferably, the structured database is constructed through the following process: parsing the theoretical model of the subject under inspection to obtain the theoretical edge trajectory, sampling the theoretical edge trajectory with a preset step size to obtain the theoretical feature point sequence; extracting the toolpath features corresponding to the theoretical edge trajectory, converting the tangential vector of the toolpath features into a theoretical curvature distribution; and establishing a mapping between the theoretical feature point sequence, the theoretical curvature distribution, and the theoretical direction vector.

[0008] Preferably, in step S104, the geometric consistency weight w satisfies the following mathematical relationship: Where w is the geometric consistency weight, and α is the preset weight smoothing coefficient. To observe the gradient direction vector, This is the theoretical direction vector obtained through the addressing index.

[0009] Preferably, the process of determining the curvature description parameters includes: determining a local feature search window with the current sub-pixel edge point as the geometric center in the edge feature point cloud set; calculating the structure tensor matrix within the local feature search window, and performing eigenvalue decomposition on the structure tensor matrix to extract the principal components of the edge direction; and calculating the micro curvature value of the sub-pixel edge point based on the principal components.

[0010] Preferably, in step S105, the construction logic of the weighted residual functional includes: determining the center coordinates and radius of the circle as parameters to be solved; calculating the Euclidean distance from each sub-pixel edge point to the fitted circle defined by the parameters to be solved; and using the product of the Euclidean distance and the geometric consistency weight as the residual term to construct the weighted minimum quadratic objective function of the edge feature point cloud set.

[0011] Preferably, in step S101, the method for extracting sub-pixel edge points is as follows: calculate the gray-level gradient magnitude and gradient direction of each pixel in the image to be tested, identify the local maxima of the gradient magnitude as coarse edge points; establish an orthogonal second-order gradient operator for the coarse edge points, and determine the zero-crossing points of the gradient in the orientation field through sub-pixel polynomial interpolation.

[0012] Preferably, the process of solving the geometric parameters in step S105 adopts the Levenberg-Marquardt algorithm; during the iterative calculation process, the geometric consistency weight is corrected in real time using the weight space distribution constructed in step S104 until the L2 norm of the change in the center coordinates of two adjacent iterations is less than 0.001mm, at which point the calculation is stopped and the detection result is locked.

[0013] Preferably, for multiple geometric elements to be tested on the subject under test, the method further includes: establishing spatial relative pose topological constraints between multiple geometric elements to be tested based on the theoretical model of the subject under test; and after obtaining the detection results of each geometric element to be tested, using the spatial relative pose topological constraints to perform consistency verification on the global detection parameters.

[0014] Preferably, after outputting the test results, the test results are compared with the theoretical geometric tolerance range defined in the theoretical model of the tested subject, the geometric deviation vector relative to the theoretical model is calculated, and the geometric compensation parameters for correcting the offset of downstream processing and assembly are output based on the geometric deviation vector.

[0015] The embodiments of the present invention have at least the following beneficial effects: 1. In the detection of hole positions in mobile phone frame processing, by constructing a local structure tensor field in the pixel neighborhood, the image information is upgraded from a single grayscale amplitude dimension to a gradient direction distribution dimension. The anisotropy index that can characterize the statistical properties of feature vectors is extracted and calculated, thereby generating a gated mask. This mechanism utilizes the physical difference that metal cutting textures are unidirectionally parallel while hole edges are omnidirectionally varied. In the Hadamard product operation, the propagation path of high amplitude artifact gradients is directly blocked, so that the net gradient field retains only the effective information that conforms to the geometric topological characteristics. This solves the problem that strong anisotropic texture interference and real edge gradients cannot be effectively separated in the amplitude domain in industrial settings.

[0016] 2. An asymmetric manifold alignment mechanism is established between the visual physical field and the original design intent. By calculating the inner product between the actual gradient normal vector of the sub-pixel edge point and the retrieved theoretical normal vector, the topological isomorphism index is obtained, and a dynamic weighted energy functional is constructed based on this. This makes the confidence weight of the edge point and the degree of conformity with the design intent nonlinearly positively correlated. On this basis, the system automatically suppresses discrete noise points that do not conform to the design law of the machining trajectory during the circle fitting iteration process, realizing the transformation from blind data fitting to design semantic constraints. This ensures that the detection parameters still have the deterministic convergence to the ideal step model under complex interference conditions such as the presence of cutting fluid residue.

[0017] 3. A manifold adaptive retrieval strategy based on relational key-value pair indexes is adopted. The theoretical curvature and toolpath direction features generated in the offline stage are used as hash keys for addressing. This eliminates the dependence on rigid matching of absolute coordinates in physical space. When the workpiece under test undergoes a small physical displacement due to stress release, clamping deformation, or ambient temperature drift, the system can still accurately call the corresponding normal constraint vector based on the topological correlation of local tensor features. This avoids the risk of mismatch caused by nonlinear deformation in traditional spatial registration methods, and improves the robustness and engineering tolerance of the detection architecture in real production environments. Attached Figure Description

[0018] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings, in which several embodiments of the invention are illustrated by way of example and not limitation, wherein: Figure 1This is a schematic diagram of the visual inspection method for detecting hole positions in a mobile phone frame according to the present invention. Figure 2 This is a block diagram showing the hardware topology and multidimensional data logic interaction of the visual inspection system of the present invention. Detailed Implementation

[0019] The principles and spirit of the present invention will now be described with reference to several exemplary embodiments in conjunction with the accompanying drawings. It should be understood that these embodiments are provided merely to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present invention more thorough and complete, and to fully convey the scope of the present invention to those skilled in the art.

[0020] A method for detecting hole positions in mobile phone frame processing based on vision inspection includes the following steps: Step S101: Obtain the image to be tested containing the geometric elements to be tested in the subject under inspection. Calculate the brightness gradient components of the pixels in the image to be tested to establish the direction field and amplitude field of the sub-pixel gradient. Perform sub-pixel localization sampling based on the local extreme points of the amplitude field to construct an edge feature point cloud set containing spatial coordinates and gradient vectors. Step S102: For each sub-pixel edge point in the edge feature point cloud set, extract the observed gradient direction vector and analyze the geometric manifold curvature distribution in the neighborhood of the sub-pixel edge point to determine the curvature description parameters that characterize the micromorphology of the local manifold at the edge. Step S103: Using the curvature description parameter as an index, the corresponding theoretical direction vector is matched from the preset structured database through an adaptive retrieval strategy; wherein, the preset theoretical edge trajectory, toolpath tangent vector and normal distribution features in the theoretical model of the subject under inspection are discretized and encoded for storage to construct the structured database; Step S104: Calculate the dot product of the observed gradient direction vector and the theoretical direction vector, establish the geometric consistency weight between the sub-pixel edge points and the theoretical design trajectory, and construct the weight spatial distribution of the edge feature point cloud set based on the geometric consistency weight, so as to implement weight suppression on the noise points in the edge feature point cloud set. Step S105: Construct a weighted residual functional for sub-pixel edge points using geometric consistency weights. Iteratively solve the center coordinates, fitted circle radius, and roundness deviation of the weighted residual functional to reach the minimum value, and output the detection results of the processing holes in the mobile phone frame.

[0021] Preferably, the adaptive retrieval strategy includes: calculating the local tensor matrix of edge features in the edge feature point cloud set, establishing geometric topological constraints based on the eigenvalue distribution of the local tensor matrix, implementing key-value pair addressing based on hash mapping in the structured database using curvature description parameters, and matching the theoretical direction vector with the highest correlation to the microscopic geometric features of the sub-pixel edge points.

[0022] Preferably, the structured database is constructed through the following process: parsing the theoretical model of the subject under inspection to obtain the theoretical edge trajectory, sampling the theoretical edge trajectory with a preset step size to obtain the theoretical feature point sequence; extracting the toolpath features corresponding to the theoretical edge trajectory, converting the tangential vector of the toolpath features into a theoretical curvature distribution; and establishing a mapping between the theoretical feature point sequence, the theoretical curvature distribution, and the theoretical direction vector.

[0023] Preferably, in step S104, the geometric consistency weight w satisfies the following mathematical relationship: Where w is the geometric consistency weight, and α is the preset weight smoothing coefficient. To observe the gradient direction vector, This is the theoretical direction vector obtained through the addressing index.

[0024] Preferably, the process of determining the curvature description parameters includes: determining a local feature search window with the current sub-pixel edge point as the geometric center in the edge feature point cloud set; calculating the structure tensor matrix within the local feature search window, and performing eigenvalue decomposition on the structure tensor matrix to extract the principal components of the edge direction; and calculating the micro curvature value of the sub-pixel edge point based on the principal components.

[0025] Preferably, in step S105, the construction logic of the weighted residual functional includes: determining the center coordinates and radius of the circle as parameters to be solved; calculating the Euclidean distance from each sub-pixel edge point to the fitted circle defined by the parameters to be solved; and using the product of the Euclidean distance and the geometric consistency weight as the residual term to construct the weighted minimum quadratic objective function of the edge feature point cloud set.

[0026] Preferably, in step S101, the method for extracting sub-pixel edge points is as follows: calculate the gray-level gradient magnitude and gradient direction of each pixel in the image to be tested, identify the local maxima of the gradient magnitude as coarse edge points; establish an orthogonal second-order gradient operator for the coarse edge points, and determine the zero-crossing points of the gradient in the orientation field through sub-pixel polynomial interpolation.

[0027] Preferably, the process of solving the geometric parameters in step S105 adopts the Levenberg-Marquardt algorithm; during the iterative calculation process, the geometric consistency weight is corrected in real time using the weight space distribution constructed in step S104 until the L2 norm of the change in the center coordinates of two adjacent iterations is less than 0.001mm, at which point the calculation is stopped and the detection result is locked.

[0028] Preferably, for multiple geometric elements to be tested on the subject under test, the method further includes: establishing spatial relative pose topological constraints between multiple geometric elements to be tested based on the theoretical model of the subject under test; and after obtaining the detection results of each geometric element to be tested, using the spatial relative pose topological constraints to perform consistency verification on the global detection parameters.

[0029] Preferably, after outputting the test results, the test results are compared with the theoretical geometric tolerance range defined in the theoretical model of the tested subject, the geometric deviation vector relative to the theoretical model is calculated, and the geometric compensation parameters for correcting the offset of downstream processing and assembly are output based on the geometric deviation vector.

[0030] Example 1: In the online visual full inspection station of CNC machine tools for metal mobile phone frames in the 3C manufacturing industry, the surface of the inspected subject after cutting and forming is coated with a cutting fluid film, accompanied by unidirectional parallel milling cutter textures. These physical forms induce anisotropic high-frequency brightness gradient abrupt changes in the pixel space. When a single brightness gradient amplitude is used as the recognition benchmark, the amplitude extrema points generated by the tool mark artifacts and chamfer highlights overlap with the true physical boundary of the geometric element to be measured. This overlap causes structural noise to be mixed into the extracted edge feature point cloud set, causing the fitting coordinate offset. For physical images containing high-density anisotropic texture noise, the system acquires the image to be measured, calculates the brightness gradient components of the pixels, establishes the direction field and amplitude field of the sub-pixel gradient, and the system samples the sub-pixel gradient based on the local extrema points of the amplitude field. The system constructs an edge feature point cloud set containing spatial coordinates and gradient vectors. It extracts the geometric manifold curvature distribution in the neighborhood of each sub-pixel edge point in the set and determines the curvature description parameter that characterizes the micro-morphology of the local manifold at the edge. The system uses this curvature description parameter as an index and inputs it into an offline structured database. It implements key-value pair addressing based on hash mapping. This structured database is stored by discretized encoding of the theoretical edge trajectory, toolpath tangent vector, and normal distribution features preset in the theoretical model of the subject under inspection. Geometric topological constraints are established based on the eigenvalue distribution of the local tensor matrix. The system matches the theoretical direction vector with the highest correlation to the micro-geometric features of the current sub-pixel edge point. This control logic transforms the spatial geometric registration problem, which is disturbed by micro-clamping deformation, into topological feature addressing of the underlying structured data.

[0031] In obtaining the observed gradient direction vector And matching the corresponding theoretical direction vector Then, the system calculates the dot product of the two to establish the geometric consistency weight w between the sub-pixel edge points and the theoretically designed trajectory. Based on this geometric consistency weight w, the system constructs a weight space distribution covering the edge feature point cloud set. The specific weight mapping satisfies the following mathematical relationship: Where w is the geometric consistency weight and α is the preset weight smoothing coefficient. To observe the gradient direction vector; The theoretical direction vector is obtained through the addressing index. This mapping mechanism makes the observed gradient direction approach the physical boundary of the actual hole position of the theoretical normal. Its geometric consistency weight w approaches 1. The artifact features generated by the cutting texture have normal vectors that deviate from the ideal design manifold due to the constraints of the machining toolpath. In this mapping model, nonlinear decay of the weight is generated. The system uses the geometric consistency weight w to construct a weighted residual functional for sub-pixel edge points. The product of the Euclidean distance from each sub-pixel edge point to the fitted circle defined by the parameters to be solved and the geometric consistency weight w is used as the residual term to isolate the topological propagation of structural noise at the energy functional level.

[0032] Before initiating iterative calculations, the system selects the top 64 feature points with the highest geometric consistency weights from the edge feature point cloud set. The arithmetic mean of the spatial coordinates of these feature points is calculated as the initial value for the circle center coordinates during iteration. The hole diameter of 4.500 mm, defined in the theoretical model, is used as the initial value for the fitted circle radius during iteration. The system employs the Levenberg-Marquardt algorithm to iteratively solve the constructed weighted least squares objective function. During the calculation process, the system uses the weight spatial distribution to adjust the geometric consistency weights w in real time, suppressing discrete noise points that do not conform to the processing trajectory design rules. Calculations stop when the L2 norm of the change in the circle center coordinates between two consecutive iterations is less than 0.001 mm. The system ultimately outputs the center coordinates, fitted circle radius, and roundness deviation that minimize the weighted residual functional. After outputting the detection results, the monitoring unit extracts the preset theoretical geometric tolerance range from the theoretical model of the inspected subject, compares the fitted circle radius and roundness deviation with the theoretical geometric tolerance range, and determines when the measured data exceeds the preset limit. It then calculates the two-dimensional pixel deviation vector of the current center coordinates relative to the theoretically designed hole center. Based on the rigid kinematic coupling principle between the vision measurement system and the machine tool actuator, there exists a rigid mapping relationship between the two-dimensional image observation plane and the three-dimensional physical processing space based on fixed rotation and translation. The system calls the hand-eye transformation matrix pre-obtained from the standard calibration block in memory, and then applies the formula... This converts the two-dimensional pixel deviation vector into geometric compensation parameters in the physical execution space; where, The output geometric compensation parameters characterize the target bias physical space vector. A dimensionless hand-eye transformation matrix is ​​used to characterize the relative pose relationship between the visual measurement coordinate system and the downstream assembly coordinate system. To calculate and obtain the two-dimensional pixel deviation vector, the control unit outputs the calculated geometric compensation parameters to the downstream processing equipment CNC system through the industrial communication bus, driving the servo motor to perform corrective bias motion along the corresponding physical coordinate axis.

[0033] Example 2: In an industrial vision inspection test platform for full inspection of metal mobile phone frames on CNC machine tools, cutting fluid residue and parallel toolpath textures induce abrupt changes in high-frequency brightness gradients in the pixel matrix, causing pixel-level coordinate shifts in edge features extracted using the basic brightness gradient amplitude. To verify the physical effectiveness of the theoretical direction vector matching and weighted residual functional iterative solution scheme, a vision acquisition environment with specific performance boundaries was constructed. An industrial camera with a resolution of 50,000,000 pixels and a sampling rate of 50Hz was selected, and a large field-of-view coaxial light source was used to continuously acquire the original physical images of the metal frame surface. Simultaneously, a test dataset was constructed based on images retained from previous production batches, and specific levels of signal-to-noise ratio perturbation parameters were actively injected into this test dataset. The perturbation levels included 10dB, 5dB, and 0dB signal-to-noise ratios to simulate the complex interference of dynamic changes in cutting fluid film thickness and the interweaving of high-frequency tool marks. In the physical environment, the test platform receives the original physical image and calculates the sub-pixel edge point cloud set. To eliminate random noise caused by microscopic diffuse reflection on the surface of the metal workpiece, after extracting the edge feature point cloud, the system opens a 9x9 pixel local sampling window centered on the current sub-pixel point and performs a 10th-order orthogonal Zernike moment decomposition. The system extracts the reconstruction residual energy value by calculating the inner product of the pixel gray-level distribution and the Zernike basis function within the window. When the residual energy value is greater than the preset energy threshold of 0.008, the point is determined to be an atypical edge point caused by machining texture and is automatically removed from the edge feature point cloud set to ensure the purity of the subsequent fitting data. In this benchmark dataset without the introduction of a weight mapping model, a large number of tool mark artifacts exhibit maximum values ​​in the gradient magnitude field, resulting in a large number of structural noise data that deviate from the preset trajectory mixed in the initially screened edge feature point cloud set.

[0034] Regarding the calculation process of the geometric consistency weight w, the test system determines the specific value of the weight smoothing coefficient α. The technical consideration for setting this parameter lies in balancing the strength of the mapping model in suppressing tool mark artifacts with the tolerance for retaining reasonable machining tolerance boundaries. The system constrains the value window of this parameter based on the variance distribution characteristics of the local manifold curvature in the theoretical model of the tested subject, following specific decision rules. When the variance of the local manifold curvature increases, the weight smoothing coefficient α is set to approach the lower limit of the value range to prevent misjudgment and exclusion of boundary points with reasonable deformation. To calibrate the parameter boundary, the test process constructs an out-of-range control system containing three discrete numerical gradients. The input values ​​of the weight smoothing coefficient α are set to 0.5, 3.5, and 8.0, corresponding to below the lower limit, the conventional median, and the upper limit, respectively. Under the above operating conditions, the calculation data shows that when the lower limit extrinsic parameter of 0.5 is applied, the decay slope of the exponential mapping function tends to be gentle, resulting in insufficient artifact suppression parameters, and the roundness deviation of the calculated output remains at a high level of 0.08mm. When the upper limit extrinsic parameter of 8.0 is applied, the decay of the mapping function shows a step-like sharp drop. The system judges and removes compliant slight deformation edges as noise, causing nonlinear degradation of the fitting parameters, resulting in the roundness deviation rising to 0.15mm. However, when the median parameter of 3.5 is applied, the system constructs a working window that matches the operating conditions. The weight of the cutting texture region in the model calculation output decays to below 0.15, while retaining the physical boundary with a weight mean higher than 0.85, so that the fitting roundness deviation stably converges to within 0.01mm.

[0035] The system imports a perturbation image with a signal-to-noise ratio of 0dB as the raw input data, initiates edge feature extraction and structured database addressing calculations, outputs key intermediate observation parameters for each stage, and establishes the observation gradient direction vector of sub-pixel edge points. The corresponding theoretical direction vector is obtained through a hash mapping mechanism. The vector group was substituted into a preset mathematical formula to calculate the geometric consistency weight w for each discrete feature point. Monitoring data showed that artifact points located in dense tool marks deviated from the theoretically designed trajectory due to their observed gradient direction. The mapping model compressed their geometric consistency weight w to a low range of 0.12 to 0.15, while the weight parameter of the physical boundary point of the hole remained in the range of 0.85 to 0.95, forming a topologically isolated distribution of the underlying feature energy. To provide a quantitative evidence chain for the synergistic effect, a partially missing control group was established. This control group removed the structured database addressing and geometric consistency weight calculation steps, and only relied on the extreme points of the amplitude field to carry out the Levenberg-Marquardt algorithm fitting operation. Multidimensional gradient comparison data confirmed that as the signal-to-noise ratio perturbation of the test dataset changed from 10dB to 0dB, the fitting roundness deviation of the partially missing control group output showed a linear divergence trend from 0.03mm and eventually climbed to 0.11mm, losing the basic geometric measurement function. Yes, when the experimental group of this invention, which incorporates all technical features, faces the same signal-to-noise ratio perturbation evolution, the final output fitting roundness deviation remains within the range of 0.008mm to 0.012mm. The gradient comparison data produced by the experimental platform confirms that the technical solution of using theoretical direction vector matching combined with geometric consistency weight calculation transforms the spatial geometric registration offset caused by optical texture interference into a weight dimensionality reduction adjustment process for the underlying structured data. The multi-point test data of the weight smoothing coefficient α delineates the nonlinear response boundary and verifies the quantization logic of the exponential mapping model parameter setting. The comparative test results containing different feature combinations jointly confirm that this detection method decouples the strong numerical correlation between subpixel positioning coordinate calculation and anisotropic structural noise. Under the physical image input condition containing high-density texture noise, it ensures that the weighted residual functional iteration process converges to the design manifold and eliminates the data fitting discontinuity caused by the single brightness gradient magnitude judgment logic under complex cutting interference.

[0036] Example 3: In the online visual full inspection station for machining holes in a CNC machine tool for a metal mobile phone frame, the dense distribution of toolpath texture causes high-frequency oscillations in the gradient amplitude field. Screening of local extrema at the single integer pixel level generates spatial coordinate discretization errors in the edge point cloud. The traversal and comparison of massive amounts of continuous theoretical geometric data hinders the production line inspection cycle. The system acquires the image to be tested, containing the geometric elements to be measured, calculates the brightness gradient components of the pixels, establishes the gradient direction field and amplitude field, locates the integer pixel coordinates of local maxima in the amplitude field, and extracts the amplitudes of three adjacent pixels along the gradient direction at these coordinates. Based on the physical principle of the point spread function approximating a Gaussian distribution in optical imaging systems, the gradient amplitude distribution corresponding to the brightness transition at the physical boundary of the inspected subject in the image sensor array exhibits a Gaussian curve. The local spatial morphology within the neighborhood of the extrema point approximates a parabolic shape through a second-order Taylor expansion. A quadratic polynomial passing through the amplitudes of these three pixels is constructed, and the spatial position of the axis of symmetry of this quadratic polynomial is calculated. This spatial position is set as the spatial coordinate of the sub-pixel edge point. The system combines the corresponding observed gradient direction vector... Construct an edge feature point cloud set.

[0037] For each sub-pixel edge point in the edge feature point cloud set, the system determines the curvature description parameter representing the micromorphology of the local manifold at the edge, analyzes the spatial frequency of the machining tool marks on the physical surface, measures the physical distance between adjacent toolpath textures, sets the window size of the analysis neighborhood to 1.5 times the physical distance, establishes a local tensor matrix of the gradient vector within this window, calculates the eigenvalues ​​of the local tensor matrix, and limits the ratio of the smaller eigenvalue to the larger eigenvalue as the curvature description parameter. The system offline parses the theoretical model of the subject under inspection, obtains the tangent vector between the theoretical edge trajectory and the toolpath, establishes the theoretical curvature distribution, sets a fixed curvature quantization step size, divides the continuous theoretical curvature distribution into multiple discrete sub-intervals, assigns a unique integer hash key to each discrete sub-interval, sets the theoretical direction vector corresponding to the midpoint of the sub-interval as the hash value, and constructs a structured database.

[0038] The system divides the extracted curvature description parameters by the curvature quantization step size, rounds down to obtain the query key, and matches the corresponding theoretical direction vector through the hash mapping mechanism in the structured database. The system is based on mathematical relationships Calculate the geometric consistency weight w, where w is the geometric consistency weight and α is a preset weight smoothing coefficient. To observe the gradient direction vector, As the theoretical direction vector, the system uses the geometric consistency weight w to construct a weighted residual functional for sub-pixel edge points. The Levenberg-Marquardt algorithm is used to iteratively solve the weighted residual functional, outputting the center coordinates, the radius of the fitted circle, and the roundness deviation that make the weighted residual functional reach its minimum value. Polynomial interpolation and hash quantization operations transform integer pixel positioning into continuous spatial coordinate calculation, and convert the sequence traversal of theoretical data into key-value pair addressing, solving the problems of coordinate discretization error and high-frequency detection time consumption.

[0039] Example 4: In the offline calibration scenario before the mobile phone frame goes online for testing, the system imports a 3D theoretical model containing the geometric features of the holes, extracts the spatial coordinate sequence of the hole edges, calculates the geometric change rate of the coordinate sequence, determines the theoretical edge trajectory and normal distribution features, extracts the theoretical feature point sequence and toolpath tangent vector based on the sampling frequency, calculates the discrete distribution of the theoretical curvature dataset, sets the curvature quantization step size, divides the theoretical curvature dataset into multiple non-overlapping discrete sub-intervals, and assigns an integer hash key to each discrete sub-interval. Based on this, the theoretical direction vector corresponding to the midpoint of each discrete sub-interval is extracted as the hash value. The system writes a key-value pair array consisting of integer hash keys and hash values ​​into memory to complete the data filling of the structured database. In the offline calibration stage, the system photographs a standard ceramic block of 20.000mm by 20.000mm. By identifying the number of pixels occupied by the edge of the block, the system establishes that the pixel equivalent of the current optical system at a distance of 500mm is 0.012mm per pixel. Based on this physical conversion ratio, the system proportionally maps the 0.120mm physical toolpath spacing in the theoretical model of the subject under inspection to a 10-pixel image window step value, thereby achieving scale unification between the design dimension and the pixel dimension.

[0040] For the process of determining the curvature quantization step size, the control unit acquires the feed rate of the machine tool milling cutter and the spindle speed. The system calculates the ratio of the spindle speed to the feed rate, determines the physical spatial wavelength of adjacent toolpath textures, and sets the curvature quantization step size. Satisfying mathematical relations ,in, For curvature quantization step size, Where β is the physical space wavelength and β is the dimensionless mapping coefficient, the test unit extracts the actual curvature extreme difference of qualified samples, divides the extreme difference into multiple equidistant intervals, and the system counts the number distribution of edge feature points in each interval. When the variance of the number distribution is greater than the preset discrete threshold, the amplitude modulation module reduces the value of the mapping coefficient β and increases the number of discrete sub-intervals in the structured database. By iteratively adjusting the mapping coefficient β, the system outputs the final key-value pair array with a variance less than the discrete threshold, thus locking the retrieval structure of the structured database.

[0041] Example 5: In a visual inspection pre-baseline calibration scenario adapting to the wear state of machine tool cutting tools in metal mobile phone frames, the system acquires a benchmark test image and extracts the brightness gradient amplitude field. It then calculates the background amplitude variance generated by non-target elements in the edge point cloud set. The calculation module uses mathematical relationships... Determine the weighted smoothing coefficient α; where α is the weighted smoothing coefficient, and κ is a calibration constant with the same dimensions as the amplitude variance. The background amplitude variance is used; the test unit inputs the coefficient into the mapping model of the geometric consistency weight w and starts the weighted residual functional fitting iteration. If the slope of the convergence curve of the continuous iteration is lower than the set slope threshold, the parameter tuning module decrements the calibration constant κ and triggers the compensation operation until the fitting roundness deviation converges to the tolerance band and the parameter configuration matrix is ​​locked.

[0042] When the system is in an online operation condition where the brightness gradient abruptly shifts due to the dynamic evaporation of the cutting fluid film, the monitoring unit periodically acquires the brightness gradient direction field of the image under test and constructs the observed gradient direction vector within the time window. The dynamic probability density histogram is compared with the statistical feature distance between the histogram and the baseline state. When the feature distance exceeds the set confidence boundary, the control layer stops the objective function solution process and extracts the structured data of qualified subjects as compensation input, and recalculates the background amplitude variance. The aforementioned relational formula is input to calculate the updated weight smoothing coefficient α. The control unit transmits the updated weight smoothing coefficient α to the edge feature extraction module to update the baseline mapping distribution. The system outputs the reconstructed parameter array and restarts the visual full inspection continuous monitoring process. In order to cope with the pose drift caused by thermal deformation, the monitoring unit triggers a baseline inspection every 60 minutes, takes a picture of the 4.000mm diameter tungsten steel calibration post on the edge of the workbench, and calculates the offset vector of its pixel centroid relative to the initial calibration position. If the magnitude of the offset vector is greater than 0.025mm, then 0.500 times the offset vector is used as the compensation increment to update the translation vector of the hand-eye transformation matrix in real time, ensuring that the compensation accuracy of the system in continuous operation is better than 0.010mm.

[0043] The above description is only a few preferred embodiments of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present invention is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, technical solutions formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in the embodiments of the present invention.

Claims

1. A method for detecting hole positions in mobile phone frame processing based on vision inspection, characterized in that, Includes the following steps: Step S101: Obtain the image to be tested containing the geometric elements to be tested in the subject under inspection. Calculate the brightness gradient components of the pixels in the image to be tested to establish the direction field and amplitude field of the sub-pixel gradient. Perform sub-pixel localization sampling based on the local extreme points of the amplitude field to construct an edge feature point cloud set containing spatial coordinates and gradient vectors. Step S102: For each sub-pixel edge point in the edge feature point cloud set, extract the observed gradient direction vector and analyze the geometric manifold curvature distribution in the neighborhood of the sub-pixel edge point to determine the curvature description parameters that characterize the micromorphology of the local manifold at the edge. Step S103: Using the curvature description parameter as an index, the corresponding theoretical direction vector is matched from the preset structured database through an adaptive retrieval strategy; wherein, the preset theoretical edge trajectory, toolpath tangent vector and normal distribution features in the theoretical model of the subject under inspection are discretized and encoded for storage to construct the structured database; Step S104: Calculate the dot product of the observed gradient direction vector and the theoretical direction vector, establish the geometric consistency weight between the sub-pixel edge points and the theoretical design trajectory, and construct the weight spatial distribution of the edge feature point cloud set based on the geometric consistency weight, so as to implement weight suppression on the noise points in the edge feature point cloud set. Step S105: Construct a weighted residual functional for sub-pixel edge points using geometric consistency weights. Iteratively solve the center coordinates, fitted circle radius, and roundness deviation of the weighted residual functional to reach the minimum value, and output the detection results of the processing holes in the mobile phone frame.

2. The method for detecting hole positions in mobile phone frame processing based on vision inspection according to claim 1, characterized in that, The adaptive retrieval strategy includes: calculating the local tensor matrix of edge features in the edge feature point cloud set, establishing geometric topological constraints based on the eigenvalue distribution of the local tensor matrix, implementing key-value pair addressing based on hash mapping in the structured database using curvature description parameters, and matching the theoretical direction vector with the highest correlation to the microscopic geometric features of the sub-pixel edge points.

3. The method for detecting hole positions in mobile phone frame processing based on vision inspection according to claim 1, characterized in that, The structured database is constructed through the following process: parsing the theoretical model of the subject under inspection to obtain the theoretical edge trajectory; sampling the theoretical edge trajectory with a preset step size to obtain the theoretical feature point sequence; extracting the toolpath features corresponding to the theoretical edge trajectory; converting the tangential vector of the toolpath features into the theoretical curvature distribution; and establishing the mapping between the theoretical feature point sequence, the theoretical curvature distribution, and the theoretical direction vector.

4. The method for detecting hole positions in mobile phone frame processing based on vision inspection according to claim 1, characterized in that, In step S104, the geometric consistency weight w satisfies the following mathematical relationship: Where w is the geometric consistency weight, and α is the preset weight smoothing coefficient. To observe the gradient direction vector, This is the theoretical direction vector obtained through the addressing index.

5. The method for detecting hole positions in mobile phone frame processing based on vision inspection according to claim 1, characterized in that, The process of determining curvature description parameters includes: determining a local feature search window with the current sub-pixel edge point as the geometric center in the edge feature point cloud set; calculating the structure tensor matrix within the local feature search window and performing eigenvalue decomposition on the structure tensor matrix to extract the principal components of the edge direction; and calculating the micro curvature value of the sub-pixel edge point based on the principal components.

6. The method for detecting hole positions in mobile phone frame processing based on vision inspection according to claim 1, characterized in that, In step S105, the construction logic of the weighted residual functional includes: determining the center coordinates and radius of the circle as parameters to be solved; calculating the Euclidean distance from each sub-pixel edge point to the fitted circle defined by the parameters to be solved; and using the product of the Euclidean distance and the geometric consistency weight as the residual term to construct the weighted minimum quadratic objective function of the edge feature point cloud set.

7. The method for detecting hole positions in mobile phone frame processing based on vision inspection according to claim 1, characterized in that, In step S101, the method for extracting sub-pixel edge points is as follows: calculate the gray-level gradient magnitude and gradient direction of each pixel in the image to be tested, and identify the local maxima of the gradient magnitude as coarse edge points; An orthogonal second-order gradient operator is established for coarse edge points, and the zero-crossing points of the gradient in the orientation field are determined by sub-pixel polynomial interpolation.

8. The method for detecting hole positions in mobile phone frame processing based on vision inspection according to claim 1, characterized in that, The process of solving the geometric parameters in step S105 adopts the Levenberg-Marquardt algorithm. During the iterative calculation, the geometric consistency weight is corrected in real time using the weight space distribution constructed in step S104 until the L2 norm of the change in the center coordinates of two adjacent iterations is less than 0.001 mm, at which point the calculation is stopped and the detection result is locked.

9. A method for detecting hole positions in mobile phone frame processing based on vision inspection according to claim 1, characterized in that, For multiple geometric elements to be tested on the subject under inspection, the method further includes: establishing spatial relative pose topological constraints between multiple geometric elements to be tested based on the theoretical model of the subject under inspection; and after obtaining the detection results of each geometric element to be tested, using the spatial relative pose topological constraints to perform consistency verification on the global detection parameters.

10. A method for detecting hole positions in mobile phone frame processing based on vision inspection according to claim 1, characterized in that, After outputting the test results, the test results are compared with the theoretical geometric tolerance range defined in the theoretical model of the tested subject, the geometric deviation vector relative to the theoretical model is calculated, and the geometric compensation parameters for correcting the offset of downstream processing and assembly are output based on the geometric deviation vector.