Hardware fitting size detection method and system, program product and medium

The method improves the detection efficiency and accuracy of irregularly shaped hardware accessories by using multi-angle image data and three-dimensional model registration, ensuring accurate shape alignment and deformation, addressing the inefficiencies of traditional coordinate measuring machines.

CN119152015APending Publication Date: 2024-12-17DONGGUAN TONGHONG HARDWARE PLASTIC PROD CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411284138.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

Traditional three-dimensional coordinate measuring machines are inefficient and unsuitable for detecting the dimensional accuracy of hardware accessories with irregular shapes, such as power tool or pneumatic tool accessories, due to their complex shapes.

Method used

A method involving multi-angle image data acquisition, two-dimensional contour extraction, and three-dimensional network model registration and adjustment, using control points to align and deform the model to match the actual shape, with curvature and curvature change rate calculations to identify key features and ensure accurate deformation.

Benefits of technology

This method enhances detection efficiency and accuracy by capturing shape information from multiple perspectives, identifying local deformations, and adapting to complex shapes, while maintaining geometric characteristics and avoiding erroneous deformations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119152015A_ABST
    Figure CN119152015A_ABST
Patent Text Reader

Abstract

The invention provides a hardware fitting size detection method and system, a program product and a medium, and the method comprises the steps: obtaining multi-angle image data, capturing the shape of a hardware fitting, selecting and processing the image data, extracting a two-dimensional contour, and carrying out the matching and registration of a three-dimensional network model and the two-dimensional contour, guarantees that the two models are located at the same visual angle, and improves the detection precision. A three-dimensional model and a two-dimensional image accurately correspond to each other in spatial position, a foundation is laid for subsequent shape adjustment, control points on the three-dimensional network model are selected to move, fine adjustment of the shape of the model is achieved, and due to the fact that the model and the two-dimensional contour are located at the same angle, the adjustment can directly reflect shape features of actual hardware fittings. Through processing all image data of different angles, shape information of the hardware fitting can be captured from a plurality of visual angles, and the finally obtained adjusted three-dimensional network model integrates information of a plurality of angles. According to the method, the detection efficiency and precision are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image detection technology, and in particular to a method, system, program product and medium for detecting the size of hardware accessories. Background Art

[0002] With the rapid development of industrial production, hardware accessories, such as power tool or pneumatic tool accessories, are facing increasing demands for production efficiency and quality control. On modern production lines, a large number of hardware accessories of various shapes are produced every hour. The dimensional accuracy of these accessories directly affects their performance and product quality.

[0003] At present, the dimensional detection of hardware accessories mainly relies on the three-dimensional measuring machine (CMM). The working process of this method is as follows: first, the measurement path is programmed through the computer control system; then, the operator places and fixes the accessory to be measured on the measuring platform; then, the system drives the contact probe to move along the X, Y, and Z directions, contacting the surface of the accessory in turn, and the three-dimensional coordinate data is recorded during the contact process; finally, the collected data is processed and analyzed through special software to calculate the various dimensional parameters of the accessory.

[0004] However, hardware accessories such as power tools or pneumatic tool accessories have irregular shapes, which requires the probe to be moved in a complicated manner. Therefore, the measurement process of the three-dimensional coordinate measuring machine is relatively slow and the measurement efficiency is too low. At this time, it can be considered that the three-dimensional coordinate measuring machine is not suitable for the inspection of hardware accessories with irregular shapes. Summary of the invention

[0005] The present application provides a method, system, program product and medium for detecting the size of hardware accessories, which are used to improve the detection efficiency and accuracy and overcome the problem that the related technology is not suitable for the detection of hardware accessories with irregular shapes.

[0006] In a first aspect, the present application provides a method for detecting the size of hardware accessories, comprising: Obtain an image data set of the hardware accessories to be inspected, the image data set comprising a preset number of image data, the image data have the same shooting distance and different shooting angles, and the preset number is positively correlated with the detection accuracy; Selecting one image data from the unprocessed image data as the processed image data; Performing image processing on the processed image data to extract the two-dimensional contour of the hardware accessories to be detected in the processed image data; Performing angle matching and registration of the 3D network model with the 2D contour, the 3D network model is a pre-set model of standard hardware accessories, which is composed of several facets; Select control points on the 3D network model and move the control points to adjust the shape of the 3D network model so that it is aligned with the 2D outline; After all the image data are processed as processed image data, an adjusted three-dimensional network model is obtained; The difference between the three-dimensional network model and the three-dimensional network model is calculated and adjusted to obtain the detection data of the hardware accessories to be detected.

[0007] By adopting the above technical solution, the shape of hardware accessories is captured by acquiring multi-angle image data, and the three-dimensional network model is matched and registered with the two-dimensional contour by selecting and processing image data and extracting the two-dimensional contour, ensuring that the two are at the same perspective, so that the three-dimensional model and the two-dimensional image correspond accurately in spatial position, laying the foundation for subsequent shape adjustment, and selecting the control points on the three-dimensional network model for movement, so as to achieve fine adjustment of the model shape. Since the model is already at the same angle as the two-dimensional contour, this adjustment can directly reflect the shape characteristics of the actual hardware accessories. By processing the image data of all different angles, the shape information of the hardware accessories can be captured from multiple perspectives, and the final adjusted three-dimensional network model integrates the information from multiple angles. This method can not only detect the overall size deviation, but also identify the local shape deformation. It not only overcomes the problem of low efficiency of traditional three-dimensional coordinate measuring machines in processing irregular shapes, but also can adapt to hardware accessories of various complex shapes, improving the detection efficiency and accuracy.

[0008] In combination with some embodiments of the first aspect, in some embodiments, before the step of selecting control points on the three-dimensional network model and moving the control points to adjust the shape of the three-dimensional network model to align it with the two-dimensional contour, the method further includes: Pick points on the two-dimensional contour at preset intervals and calculate the curvature of each picked point; Selecting a point whose curvature is greater than a preset high curvature extreme value and a point whose curvature is lower than a preset low curvature extreme value as a first reference point; Calculate the curvature change rate of each point taken according to the curvature; Selecting a point whose curvature change rate is higher than a preset curvature mutation threshold as a second reference point; Segmenting a two-dimensional contour into a plurality of edge segments; Determine the number of points for each edge segment according to the length of the edge segment; Randomly select the third reference point on each edge segment according to the number of points; According to the positions of the first reference point, the second reference point and the third reference point on the two-dimensional contour, a control point on the three-dimensional network model is determined.

[0009] By adopting the above technical solution, by calculating the curvature and curvature change rate of points on the two-dimensional contour, areas with significant shape changes are identified, which usually represent the key features of hardware accessories. By setting the preset curvature threshold and curvature change rate threshold, the first and second reference points are selected to ensure the accurate positioning of important features such as sharp corners and corners. By randomly selecting the third reference point, the coverage of the control point selection is increased. Based on these reference points, the control points on the three-dimensional network model are determined. With the dual guarantee of coverage and feature recognition, the feature capture problem of hardware accessories with complex or non-standard shapes is solved, and the accuracy of subsequent deformation and matching is improved.

[0010] In conjunction with some embodiments of the first aspect, in some embodiments, the step of selecting control points on the three-dimensional network model, moving the control points, and adjusting the shape of the three-dimensional network model to align it with the two-dimensional contour specifically includes: Calculate the position deviation between each control point and its corresponding first reference point, second reference point or third reference point; According to the position deviation, each control point is moved so that it coincides with its corresponding first reference point, second reference point or third reference point on the projection plane; Based on the moved control points, a preset deformation algorithm is used to adjust the shape of the three-dimensional network model.

[0011] By adopting the above technical solution, the initial adjustment of the model is achieved by calculating the position deviation between the control point and the corresponding reference point, and by moving the control point to make it coincide with the reference point on the projection plane. Finally, the global shape adjustment is performed using the preset deformation algorithm to ensure the consistency of the shape of the model and the actual hardware accessories, and to ensure the matching degree of the adjusted model and the actual hardware accessories in key features.

[0012] In conjunction with some embodiments of the first aspect, in some embodiments, the preset deformation algorithm is: For the current control point, calculate the distances from all vertices on the three-dimensional network model to the current control point, where the current control point is any control point; Vertices whose distance is less than the preset influence radius are determined as influence points; For each influencing point, an influencing factor is determined according to its distance to the current control point, where the closer the distance, the greater the influencing factor; Based on the influence factor and the movement vector of the current control point, the displacement vector of each influence point is calculated.

[0013] By adopting the above technical solution, the influence range of the deformation is determined by calculating the distance from all vertices on the model to the current control point. By setting a preset influence radius, the affected vertices are screened out to ensure the locality of the deformation. By determining the influence factor based on the distance, a smooth transition of the deformation effect is achieved. The displacement of each influence point is calculated based on the influence factor and the control point movement vector, ensuring the continuity and naturalness of the deformation, which not only improves the accuracy of model adjustment, but also maintains the original geometric characteristics of hardware accessories and improves the accuracy of size detection.

[0014] In conjunction with some embodiments of the first aspect, in some embodiments, the step of determining a vertex whose distance is less than a preset influence radius as an influence point specifically includes: Remove vertices that have no connected paths with the current control point from vertices whose distance is less than a preset influence radius, where the connected paths are continuous adjacent facets between the vertex and the current control point in the three-dimensional network model; The remaining vertices are determined as influence points.

[0015] By adopting the above technical solution and introducing the concept of connected paths, it is ensured that only vertices connected in the topological structure are included in the deformation range, avoiding erroneous deformation of non-continuous structures and ensuring the rationality and accuracy of the deformation results.

[0016] In combination with some embodiments of the first aspect, in some embodiments, after the step of selecting control points on the three-dimensional network model and moving the control points to adjust the shape of the three-dimensional network model to align it with the two-dimensional contour, the method further includes: Determine the adjustment range of the three-dimensional network model; Determine whether the adjustment range is greater than a preset adjustment threshold; If the adjustment range is greater than a preset adjustment threshold, one image data is selected from the unprocessed image data as the processed image data; If the adjustment range is not greater than the preset adjustment threshold, determining whether the adjustment ranges of the preset number of processed image data are all not greater than the preset adjustment threshold; If the adjustment range of the preset number of processed image data is not greater than the preset adjustment threshold, the currently adjusted three-dimensional network model is determined as the adjusted three-dimensional network model; If the adjustment ranges of the preset number of processed image data are not all less than the preset adjustment threshold, one image data is selected as the processed image data.

[0017] By adopting the above technical solution, by calculating the adjustment amplitude and comparing it with the preset threshold, when the adjustment amplitude is large, new image data will be automatically selected for processing, and a decision will be made not to end the adjustment process. By judging the adjustment amplitude of multiple consecutive processing results, it can be intelligently decided whether to end the adjustment process. Therefore, the processing depth can be flexibly adjusted according to the actual situation of each hardware accessory. For accessories with relatively standard shapes, the detection can be completed quickly. For accessories with obvious deviations, a more detailed analysis is performed, thereby improving the overall detection efficiency, especially in batch detection tasks.

[0018] In combination with some embodiments of the first aspect, in some embodiments, image data with the same shooting angle for different hardware accessories to be inspected are processed in parallel.

[0019] By adopting the above technical solution, the image data with the same shooting angle are processed in parallel, thereby greatly reducing the processing time.

[0020] In combination with some embodiments of the second aspect, in some embodiments, a size detection system for hardware accessories includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and one or more processors call the computer instructions to enable the size detection system for hardware accessories to execute the method of the first aspect.

[0021] In combination with some embodiments of the third aspect, in some embodiments, when the computer program product runs on a size detection system for hardware accessories, the size detection system for hardware accessories executes the method of the first aspect.

[0022] In combination with some embodiments of the fourth aspect, in some embodiments, when the instruction is executed on a size detection system for hardware accessories, the size detection system for hardware accessories executes the method of the first aspect.

[0023] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. By acquiring multi-angle image data, the shape of hardware accessories is captured. By selecting and processing image data and extracting two-dimensional contours, the three-dimensional network model is matched and registered with the two-dimensional contours to ensure that the two are at the same perspective, so that the three-dimensional model and the two-dimensional image correspond accurately in spatial position, laying the foundation for subsequent shape adjustment. The control points on the three-dimensional network model are selected for movement to achieve fine adjustment of the model shape. Since the model is already at the same angle as the two-dimensional contour, this adjustment can directly reflect the shape characteristics of the actual hardware accessories. By processing image data from all different angles, the shape information of hardware accessories can be captured from multiple perspectives, and the final adjusted three-dimensional network model integrates information from multiple angles. This method can not only detect overall dimensional deviations, but also identify local shape deformations. It not only overcomes the problem of low efficiency of traditional three-dimensional coordinate measuring machines in processing irregular shapes, but also can adapt to hardware accessories of various complex shapes, improving detection efficiency and accuracy.

[0024] 2. By calculating the curvature and curvature change rate of points on the two-dimensional contour, areas with significant shape changes are identified. These areas usually represent the key features of hardware accessories. By setting the preset curvature threshold and curvature change rate threshold, the first and second reference points are selected to ensure accurate positioning of important features such as sharp corners and corners. By randomly selecting the third reference point, the coverage of control point selection is increased. Based on these reference points, the control points on the three-dimensional network model are determined. With the dual guarantee of coverage and feature recognition, the feature capture problem of hardware accessories with complex or non-standard shapes is solved, and the accuracy of subsequent deformation and matching is improved.

[0025] 3. By introducing the concept of connected paths, it is ensured that only vertices that are connected in the topological structure are included in the deformation range, avoiding erroneous deformation of non-continuous structures and ensuring the rationality and accuracy of the deformation results. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a flow chart of a method for detecting the size of hardware accessories in an embodiment of the present application; Figure 2 is another flow chart of the method for detecting the size of hardware accessories in the embodiment of the present application; Figure 3 is another flow chart of the method for detecting the size of hardware accessories in the embodiment of the present application; Figure 4 is another flow chart of the method for detecting the size of hardware accessories in the embodiment of the present application; Figure 5 It is a schematic diagram of an exemplary hardware structure of a size detection system for hardware accessories in an embodiment of the present application. DETAILED DESCRIPTION

[0027] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.

[0028] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0029] See also Figure 1 , Figure 1 It is a flow chart of the method for detecting the size of hardware accessories in the embodiment of the present application.

[0030] S101, obtaining an image data group of the hardware accessories to be inspected, the image data group comprising a preset number of image data, the image data having the same shooting distance and different shooting angles, and the preset number is positively correlated with the detection accuracy; The hardware accessories to be tested refer to specific hardware accessories samples that need to be tested for size, which are generally hardware accessories with irregular shapes, such as power tool or pneumatic tool accessories.

[0031] In some embodiments, a preset number of images is determined, and this number is related to the desired detection accuracy. Generally, the larger the number, the higher the accuracy. Then, the hardware accessories to be inspected are placed in a fixed position, and a camera or other image acquisition device is used to photograph the hardware accessories from different angles while keeping the distance from the hardware accessories unchanged until a preset number of images are obtained. These images together constitute an image data group, providing comprehensive perspective information for the subsequent detection process.

[0032] It should be noted that the shooting angle strategy can choose a uniform angle or a feature-oriented angle. The uniform angle strategy ensures full coverage of hardware accessories, while the feature-oriented strategy focuses on capturing the key features of hardware accessories. It is determined based on actual conditions and is not limited here.

[0033] In some specific embodiments, an automatic rotating platform and a fixed camera can be used: place hardware accessories on the automatic rotating platform; set the rotation angle and number of rotations of the rotating platform to match the preset number of images; start the rotating platform and trigger the camera to shoot each time the rotation stops; save all the images taken as an image data group, which is not limited here.

[0034] In some other specific embodiments, a multi-camera array may also be used: multiple cameras are evenly distributed around the hardware accessories at predetermined angles; the position of each camera is adjusted to ensure that they are at an equal distance from the hardware accessories; all cameras are triggered to shoot at the same time; and the images taken by all cameras are collected to form an image data group, which is not limited here.

[0035] S102, selecting one image data from the unprocessed image data as the processed image data; It should be noted that the following steps S103 to S105 take a pair of image data as an example to illustrate the process of partial image feature processing and three-dimensional network model adjustment.

[0036] S103, performing image processing on the processed image data to extract the two-dimensional contour of the hardware accessories to be detected in the processed image data; In some embodiments, the processed image data is preprocessed, such as denoising, contrast enhancement, etc., to improve the image quality, and then the hardware accessories are separated from the background using image segmentation technology. Next, an edge detection algorithm is applied to identify the edge of the hardware accessories, and finally, an edge tracking or contour extraction algorithm is used to generate a continuous two-dimensional contour that accurately represents the appearance of the hardware accessories at that viewing angle.

[0037] S104, performing angle matching and registration on the three-dimensional network model and the two-dimensional contour, wherein the three-dimensional network model is a pre-set model of a standard hardware accessory, and is composed of a plurality of facets; A 3D network model refers to a digital model used to represent the 3D shape of standard hardware accessories. A facet represents the polygonal units that make up the surface of a 3D model. Angle matching refers to adjusting the spatial orientation of a 3D model so that it is consistent with the perspective of a 2D outline.

[0038] In some embodiments, a pre-set three-dimensional network model of standard hardware accessories is first loaded, and then the spatial posture of the three-dimensional model is adjusted through rotation and translation operations so that its projection roughly matches the extracted two-dimensional contour. Next, a feature point matching or contour matching algorithm is used to further refine the position and orientation of the three-dimensional model. Finally, the aligned three-dimensional model should overlap with the two-dimensional contour in terms of major features, laying the foundation for subsequent shape adjustment.

[0039] In some embodiments, a simple angle matching is that in step S101, the hardware accessories are photographed based on a fixed angle. Therefore, the angle matching can be simplified to rotating the three-dimensional network model by the fixed angle to complete the matching.

[0040] A simple registration process is to overlap the 3D model with the 2D contour at the center point to complete the registration.

[0041] In some specific embodiments, a feature descriptor-based method may be used: extract key points from two-dimensional contours and three-dimensional model surfaces; calculate local feature descriptors (such as SIFT or ORB) for each key point; use a feature matching algorithm to find corresponding point pairs; estimate the posture of the three-dimensional model based on matching point pairs; use a RANSAC algorithm to eliminate false matches; and optimize the position and orientation of the three-dimensional model, which is not limited here.

[0042] S105, selecting control points on the three-dimensional network model, and moving the control points to adjust the shape of the three-dimensional network model so that it is aligned with the two-dimensional outline; In some embodiments, a set of control points are first selected on the three-dimensional network model, which are usually distributed at the key feature positions of the model. Then, the difference between the three-dimensional model projection and the two-dimensional contour is analyzed to calculate the direction and distance that each control point needs to move. Then, the control points are moved according to the calculation results, and a deformation algorithm (such as free deformation FFD) is used to adjust the shape of the entire model.

[0043] It should be noted that the two-dimensional contour is a two-dimensional feature. It is the contour information obtained from a picture of a hardware accessory taken at a specific angle. This specific angle corresponds to a cross-section of the three-dimensional network model.

[0044] The control points refer to some points on the cross section of the three-dimensional network model corresponding to the shooting angle, or more accurately, points on the cross-sectional contour of the three-dimensional network model corresponding to the cross section.

[0045] During the angle matching process, the 3D network model is rotated to a position consistent with the shooting angle, so that a specific section of the model is in the same plane as the 2D image.

[0046] During the registration process, the rotated 3D model section is aligned with the 2D contour at the center point, which ensures that the model section and the 2D contour correspond in spatial position.

[0047] The adjustment process is to move the control points on the cross section to make it fit the 2D contour better. Since the control points are points on the 3D model, moving these points will change the shape of the entire 3D model accordingly.

[0048] In some specific embodiments, a method based on point-to-point correspondence can be used: uniformly distributed control points are selected on the surface of the three-dimensional model, the three-dimensional model is projected onto a two-dimensional plane, the nearest corresponding points of the control points on the two-dimensional contour are found, and the displacement vector between each pair of corresponding points is calculated; the displacement of all vertices of the three-dimensional model is calculated, and the calculated displacement is applied to update the model shape, which is not limited here.

[0049] S106, after all the image data are processed as processed image data, an adjusted three-dimensional network model is obtained; It should be noted that the specific meaning of this step is to repeatedly execute steps S102 to S105 until all the collected image data are processed as processed image data.

[0050] The three-dimensional network model after all iterations are completed can be regarded as the three-dimensional network model of the hardware accessories to be tested in the virtual environment.

[0051] S107, calculating and adjusting the difference between the three-dimensional network model and the three-dimensional network model to obtain the detection data of the hardware accessories to be detected.

[0052] In some embodiments, the adjusted three-dimensional network model is first aligned with the original standard three-dimensional network model. Then, various geometric measurement methods are used to calculate the difference between the two models, which may include point-to-point distance, surface normal deviation, volume difference, etc. Then, these difference data are statistically analyzed to obtain information such as the degree of deformation of each part and overall size deviation. Finally, according to the preset standards, it is determined whether these differences are within an acceptable range, thereby obtaining the quality assessment results of the hardware accessories, which are not limited here.

[0053] It can be seen that by acquiring multi-angle image data, capturing the shape of hardware accessories, selecting and processing image data and extracting two-dimensional contours, matching and registering the three-dimensional network model with the two-dimensional contour, ensuring that the two are at the same perspective, making the three-dimensional model and the two-dimensional image accurately correspond in spatial position, laying the foundation for subsequent shape adjustment, selecting control points on the three-dimensional network model for movement, and realizing fine adjustment of the model shape. Since the model is already at the same angle as the two-dimensional contour, this adjustment can directly reflect the shape characteristics of the actual hardware accessories. By processing all the image data at different angles, the shape information of hardware accessories can be captured from multiple perspectives, and the final adjusted three-dimensional network model integrates information from multiple angles. This method can not only detect overall size deviations, but also identify local shape deformations. It not only overcomes the problem of low efficiency of traditional three-dimensional coordinate measuring machines in processing irregular shapes, but also can adapt to hardware accessories of various complex shapes, improving detection efficiency and accuracy.

[0054] However, in actual use, because the control points on the 3D network model are selected and moved, and the shape of the 3D network model is adjusted to align it with the 2D contour, the selection of control points is very important. If the key feature points on the hardware accessories cannot be identified and located, this may lead to the inability to accurately capture important structural features on hardware accessories with complex or non-standard shapes, thereby affecting the accuracy of subsequent deformation and matching.

[0055] See also Figure 2 , Figure 2 is another flow chart of the method for detecting the size of hardware accessories in the embodiment of the present application; Therefore, in some embodiments, before step S105, the method further includes: S201, taking points on the two-dimensional contour according to a preset interval, and calculating the curvature of each taken point; It should be noted that the preset interval is related to the selection range of feature points. The smaller the preset interval, the larger the selection range. This means that more control points will be selected on the model. The larger the preset interval, the smaller the selection range, and the number of selected control points will be reduced accordingly.

[0056] S202, selecting a point whose curvature is greater than a preset high extreme value of curvature and a point whose curvature is lower than a preset low extreme value of curvature as a first reference point; S203, calculating the curvature change rate of each taken point according to the curvature; For each point taken, the derivative of its curvature with respect to the curve parameter, i.e., the curvature change rate, is calculated. This step can capture areas where the curvature changes dramatically, which usually correspond to important change points in the contour shape.

[0057] In some specific embodiments, spline interpolation is used to fit the curvature function; the derivative of the spline function is calculated; and the derivative value is sampled at each original point as the curvature change rate, which is not limited here.

[0058] S204, selecting a point whose curvature change rate is higher than a preset curvature mutation threshold as a second reference point; These points usually mark important turning points or changes in the contour shape and are important for accurately depicting contour features.

[0059] S205, dividing the two-dimensional contour into a plurality of edge segments; In this method, an edge segment refers to a complete edge on a two-dimensional contour.

[0060] In some embodiments, for a polygonal contour, a straight line segment between every two adjacent corner points is regarded as an edge segment, and for a contour containing a curve, additional segmentation may be performed at the inflection point or feature point of the curve.

[0061] In some specific embodiments, obvious corner points and feature points are first identified; the curvature change of the contour is analyzed, and additional segmentation points are added where the curvature changes significantly (second reference points), and the contour is divided into multiple edge segments based on these segmentation points, which is not limited here.

[0062] S206, determining the number of points to be taken for each edge segment according to the length of the edge segment; The number of points refers to the number of reference points that need to be selected on each edge segment. The length of the edge segment refers to the actual length of the edge segment measured along the contour curve.

[0063] In some embodiments, the length of each edge segment is first measured, and then the number of points that should be taken for the edge segment is calculated according to a pre-set rule (such as the point density per unit length). This method ensures that there are an appropriate number of reference points in different parts of the contour, and neither too many points are taken on short edge segments nor too few points are taken on long edge segments.

[0064] S207, randomly select a third reference point on each edge segment according to the number of selected points; In some embodiments, based on the number of points determined in the previous step, a corresponding number of points are randomly selected on each edge segment as third reference points. This random point selection method can increase the diversity of contour description and help capture local features that may be ignored by the regular point selection method.

[0065] In some specific embodiments, a random number is generated using a uniform distribution in the interval [0, 1]; the random number is multiplied by the length of the edge segment to obtain the position of the reference point on the edge segment; this process is repeated until a predetermined number of points is reached; and the obtained point set is sorted, which is not limited here.

[0066] S208: Determine control points on the three-dimensional network model according to positions of the first reference point, the second reference point, and the third reference point on the two-dimensional contour.

[0067] In some embodiments, according to the position information of the first, second and third reference points determined on the two-dimensional contour, corresponding points are selected on the three-dimensional network model as control points. This mapping process needs to consider the correspondence between the two-dimensional contour and the three-dimensional model to ensure that the selected control points can effectively affect the model shape so that it is aligned with the two-dimensional contour.

[0068] In some specific embodiments, the control points on the three-dimensional network model can be determined in a variety of ways: projecting the two-dimensional contour onto the three-dimensional model surface; for each reference point, finding the nearest three-dimensional model vertex; if the distance to the nearest vertex is too large, inserting a new vertex on the model; marking the found or newly inserted vertices as control points, which is not limited here.

[0069] It can be seen that by calculating the curvature and curvature change rate of points on the two-dimensional contour, areas with significant shape changes are identified, which usually represent the key features of hardware accessories. By setting the preset curvature threshold and curvature change rate threshold, the first and second reference points are selected to ensure the accurate positioning of important features such as sharp corners and corners. By randomly selecting the third reference point, the coverage of the control point selection is increased. Based on these reference points, the control points on the three-dimensional network model are determined. With the dual guarantee of coverage and feature recognition, the feature capture problem of hardware accessories with complex or non-standard shapes is solved, and the accuracy of subsequent deformation and matching is improved.

[0070] Continuing with the above example, step S105 specifically includes: S209, calculating the position deviation between each control point and its corresponding first reference point, second reference point or third reference point; In some embodiments, the position difference between the two points is then calculated, which may be a two-dimensional deviation on the projection plane.

[0071] In some specific embodiments, a mapping relationship is established from a three-dimensional space to a two-dimensional plane; the control point is converted to a two-dimensional space using the mapping; the coordinate difference between the converted point and the reference point in the x and y directions is calculated; and the coordinate difference vector is used as a position deviation, which is not limited here.

[0072] S210, moving each control point according to the position deviation so that it coincides with its corresponding first reference point, second reference point or third reference point on the projection plane; In some embodiments, each control point is moved in three-dimensional space according to the position deviation calculated in the previous step so that their positions on the projection plane coincide with the corresponding reference points.

[0073] In some specific embodiments, the equation of the projection plane is determined; the vertical distance from the control point to the projection plane is calculated; the control point is moved along the vertical direction so that its projection coincides with the reference point; and the coordinates of the control point in the three-dimensional network model are updated, which is not limited here.

[0074] S211. Based on the moved control points, a preset deformation algorithm is used to adjust the shape of the three-dimensional network model.

[0075] Among them, the preset deformation algorithm refers to a mathematical method or computer graphics technology used to adjust the shape of a three-dimensional mesh model. These algorithms usually smoothly change the shape of the entire model based on the movement of control points.

[0076] In some embodiments, a pre-selected deformation algorithm is used to calculate the new positions of all other vertices on the model using the moved control points as constraints. This process needs to ensure that the overall shape of the model changes smoothly and naturally while maintaining the local detail features of the model as much as possible.

[0077] It can be seen that by calculating the position deviation between the control point and the corresponding reference point, and moving the control point to make it coincide with the reference point on the projection plane, the model is initially adjusted. Finally, the preset deformation algorithm is used to perform global shape adjustment to ensure the consistency of the model and the actual hardware accessories, and to ensure the matching degree of the adjusted model and the actual hardware accessories in key features.

[0078] See also Figure 3 , Figure 3 is another flow chart of the method for detecting the size of hardware accessories in the embodiment of the present application; In some specific embodiments, step S211 specifically includes: S2111, calculating the distances from all vertices on the three-dimensional network model to the current control point for the current control point, where the current control point is any control point; In some embodiments, for the selected current control point, all vertices of the three-dimensional network model are traversed to calculate the spatial distance from each vertex to the control point; It should be noted that this distance refers to the projection distance of the three-dimensional network model.

[0079] In some embodiments, the current control point is projected onto a two-dimensional plane, and then the coordinate difference between the current control point and the vertex in the x and y directions is obtained, which is not limited here.

[0080] S2112, determining the vertices whose distance is less than the preset influence radius as influence points; It should be noted that the purpose is to determine which vertices will be affected by the movement of the current control point. This process actually defines a spherical influence area centered on the control point on the model, laying the foundation for subsequent local deformation.

[0081] S2113. For each influencing point, determine an influencing factor according to the distance from the influencing point to the current control point, wherein the closer the distance, the greater the influencing factor; It should be noted that the influence factor refers to a numerical value indicating the degree of influence of a control point on a specific influence point, and is usually a real number between 0 and 1.

[0082] In some embodiments, a smooth attenuation function is usually used so that vertices closer to the control point have a larger influence factor, while vertices farther away have a smaller influence factor. This approach ensures that the model can deform smoothly and naturally during subsequent deformation processes, avoiding mutations or discontinuities.

[0083] S2114. Calculate the displacement vector of each influencing point based on the influencing factor and the movement vector of the current control point.

[0084] In some embodiments, for each influence point, its influence factor is multiplied by the movement vector of the current control point to obtain the displacement vector of the influence point. This calculation process ensures that vertices closer to the control point move more, while vertices farther away move less, thereby achieving a smooth local deformation effect.

[0085] It can be seen that by calculating the distance from all vertices on the model to the current control point, the influence range of the deformation is determined. By setting a preset influence radius, the affected vertices are screened out to ensure the locality of the deformation. By determining the influence factor based on the distance, a smooth transition of the deformation effect is achieved. The displacement of each influence point is calculated based on the influence factor and the control point movement vector to ensure the continuity and naturalness of the deformation, which not only improves the accuracy of model adjustment, but also maintains the original geometric characteristics of hardware accessories and improves the accuracy of size detection.

[0086] It should be noted that in actual use, when dealing with hardware accessories with complex geometric structures, there may be vertices in the three-dimensional network model that are close in spatial position but not connected in topological structure. The existing distance-based influence point determination method may mistakenly include these non-continuous structure vertices into the deformation range, resulting in unreasonable deformation results.

[0087] Therefore, in some embodiments, S2112 can be replaced by: removing vertices whose distance is less than a preset influence radius and have no connecting path with the current control point, where the connecting path is a continuous adjacent facet between the vertex and the current control point in the three-dimensional network model; and determining the remaining vertices as influence points.

[0088] In some embodiments, for each vertex whose distance is less than a preset influence radius, check whether there is a path connected to the current control point through continuous adjacent patches on the model surface. If there is no such path, the vertex is removed from the set of influence points even if it is very close in Euclidean distance. This process ensures that only vertices that are truly "reachable" on the model surface are considered influence points, thereby avoiding unreasonable deformations that cross the internal space of the model or unconnected parts.

[0089] It can be seen that by introducing the concept of connected paths, only vertices that are connected in the topological structure are included in the deformation range, avoiding erroneous deformation of non-continuous structures and ensuring the rationality and accuracy of the deformation results.

[0090] In actual use, the current method requires a complete three-dimensional network model adjustment process for each hardware accessory to be inspected. This one-by-one processing method may significantly reduce processing efficiency when faced with large-scale inspection tasks and affect the real-time performance of the inspection system.

[0091] See also Figure 4 , Figure 4 is another flow chart of the method for detecting the size of hardware accessories in the embodiment of the present application; In some embodiments, after step S105, the method further includes: S301, determining an adjustment range of the three-dimensional network model; The adjustment amplitude refers to the degree of shape change of the 3D network model during the deformation process.

[0092] In some embodiments, the degree of shape change of the three-dimensional network model after the current deformation operation is calculated, which may involve measurements of multiple aspects, such as the average displacement of vertex positions, the rate of change of surface area or volume, the change of local curvature, etc., which are not limited here.

[0093] In some specific embodiments, the adjustment amplitude can be determined in a variety of ways: calculating the Euclidean distances of all vertices before and after deformation; obtaining the mean and standard deviation of these distances; calculating the percentage change in the surface area and volume of the model; evaluating the curvature change in the local area; and combining the above indicators to obtain the final adjustment amplitude value through weighted averaging or other mathematical models, which are not limited here.

[0094] S302, determining whether the adjustment range is greater than a preset adjustment threshold; In some embodiments, the calculated adjustment amplitude is compared with a pre-set threshold, which represents the minimum amplitude for the model deformation to be considered "significant enough". Through this comparison, the system can determine whether the current adjustment has achieved the expected effect, thereby determining the next operation path. This step is actually a decision point that controls the flow and number of iterations of the entire adjustment process.

[0095] If the adjustment range is greater than the preset adjustment threshold, step S102 is executed; If the adjustment range is not greater than the preset adjustment threshold, then S303, determining whether all image data are to be processed as processed image data; If all the image data are processed as processed image data, then step S106 is executed; If not all the image data are processed as the processed image data, then S304, determining whether the adjustment ranges of the preset number of processed image data are not greater than the preset adjustment threshold; In some embodiments, the results of the most recent preset number of adjustments are reviewed to check whether these adjustments have failed to produce significant shape changes. This step is actually looking for a continuous, long sequence of "minor adjustments", which may mean that there is nothing wrong with the hardware to be inspected and no further corresponding 3D network model is needed. In this way, it can be determined whether the adjustment process should be ended or a new adjustment strategy needs to be tried.

[0096] If the adjustment range of the preset number of processed image data is not greater than the preset adjustment threshold, then S305, determining the currently adjusted three-dimensional network model as the adjusted three-dimensional network model; If the adjustment ranges of the preset number of processed image data are not all less than the preset adjustment threshold, step S106 is executed.

[0097] It can be seen that by calculating the adjustment amplitude and comparing it with the preset threshold, when the adjustment amplitude is large, new image data will be automatically selected for processing, and it will be decided not to end the adjustment process. By judging the adjustment amplitude of multiple consecutive processing results, it can intelligently decide whether to end the adjustment process. Therefore, the processing depth can be flexibly adjusted according to the actual situation of each hardware accessory. For accessories with relatively standard shapes, the inspection can be completed quickly. For accessories with obvious deviations, a more detailed analysis is performed, which improves the overall inspection efficiency, especially in batch inspection tasks.

[0098] In some embodiments, image data of different hardware accessories to be inspected with the same shooting angle are processed in parallel.

[0099] The system identifies and groups different hardware accessory images that were taken from the same angle. It then launches multiple processing units, or threads, simultaneously, with each unit processing an image of one accessory.

[0100] It can be seen that by processing the image data with the same shooting angle in parallel, the processing time is greatly reduced.

[0101] The following introduces an exemplary hardware accessory size detection system 500 provided in an embodiment of the present application. Figure 5 It is a schematic diagram of an exemplary hardware structure of a hardware accessory size detection system 500 provided in an embodiment of the present application.

[0102] In some embodiments, the size detection system 500 of the hardware accessories is a computer device or the size detection system 500 of the hardware accessories includes a computer device. The computer device includes a processor, a memory and a network interface connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with other external terminals or servers through a network connection. In some embodiments, the network interface can be a wired network interface, and in some embodiments, the network interface can also be a wireless network interface. When the computer program is executed by the processor, the method in the embodiment of the present application is implemented.

[0103] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0104] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0105] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.

[0106] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0107] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

Claims

1. A method for detecting the size of hardware accessories. It is characterized in that include: Acquire an image data group of the hardware accessories to be detected, wherein the image data group includes a preset number of image data, the image data have the same shooting distance and different shooting angles, and the preset number is positively correlated with the detection accuracy; Selecting one of the image data from the unprocessed image data as the processed image data; Performing image processing on the processed image data to extract the two-dimensional contour of the hardware accessory to be detected in the processed image data; Performing angle matching and registration on the three-dimensional network model and the two-dimensional contour, wherein the three-dimensional network model is a pre-set model of a standard hardware accessory and is composed of a plurality of facets; Selecting control points on the three-dimensional network model and moving the control points to adjust the shape of the three-dimensional network model so that it is aligned with the two-dimensional outline; After all of the image data are processed as the processed image data, an adjusted three-dimensional network model is obtained; The difference between the adjusted three-dimensional network model and the three-dimensional network model is calculated to obtain the detection data of the hardware accessories to be detected.

2. The method according to claim 1, It is characterized in that Before the step of selecting control points on the three-dimensional network model and moving the control points to adjust the shape of the three-dimensional network model to align it with the two-dimensional contour, the method further includes: Picking points on the two-dimensional contour at preset intervals, and calculating the curvature of each picked point; Selecting a point whose curvature is greater than a preset high curvature extreme value and a point whose curvature is lower than a preset low curvature extreme value as a first reference point; Calculating the curvature change rate of each point taken according to the curvature; Selecting a point whose curvature change rate is higher than a preset curvature mutation threshold as a second reference point; segmenting the two-dimensional contour into a plurality of edge segments; Determine the number of points for each edge segment according to the length of the edge segment; Randomly select a third reference point on each edge segment according to the number of selected points; The control point on the three-dimensional network model is determined according to the positions of the first reference point, the second reference point and the third reference point on the two-dimensional contour.

3. The method according to claim 2, It is characterized in that The step of selecting control points on the three-dimensional network model, moving the control points, and adjusting the shape of the three-dimensional network model to align it with the two-dimensional outline specifically includes: Calculating the position deviation between each of the control points and its corresponding first reference point, the second reference point or the third reference point; According to the position deviation, move each of the control points so that it coincides with its corresponding first reference point, the second reference point or the third reference point on the projection plane; Based on the moved control points, a preset deformation algorithm is used to adjust the shape of the three-dimensional network model.

4. The method according to claim 3, It is characterized in that The preset deformation algorithm is: For a current control point, calculate the distances from all vertices on the three-dimensional network model to the current control point, where the current control point is any of the control points; Determine the vertex whose distance is less than the preset influence radius as the influence point; For each of the influencing points, determining an influencing factor according to the distance from the influencing point to the current control point, wherein the closer the distance is, the greater the influencing factor is; Based on the influencing factor and the movement vector of the current control point, a displacement vector of each influencing point is calculated.

5. The method according to claim 4, It is characterized in that The step of determining the vertex whose distance is less than the preset influence radius as the influence point specifically includes: Remove vertices that have no connection path with the current control point from the vertices whose distance is less than a preset influence radius, wherein the connection path is a continuous adjacent facet between a vertex in the three-dimensional network model and the current control point; The remaining vertices are determined as influence points.

6. The method according to claim 1, It is characterized in that After the step of selecting control points on the three-dimensional network model, moving the control points, and adjusting the shape of the three-dimensional network model to align it with the two-dimensional contour, the method further includes: Determining an adjustment range of the three-dimensional network model; Determining whether the adjustment range is greater than a preset adjustment threshold; If the adjustment amplitude is greater than the preset adjustment threshold, selecting one of the image data from the unprocessed image data as the processed image data; If the adjustment range is not greater than the preset adjustment threshold, determining whether the adjustment ranges of the preset number of processed image data are all not greater than the preset adjustment threshold; If the adjustment ranges of the preset number of processed image data are not greater than the preset adjustment threshold, the currently adjusted three-dimensional network model is determined as the adjusted three-dimensional network model; If the adjustment ranges of the preset number of processed image data are not all less than the preset adjustment threshold, one of the image data is selected as the processed image data.

7. The method according to claim 1, It is characterized in that Image data with the same shooting angle for different hardware accessories to be inspected are processed in parallel.

8. A size detection system for hardware accessories, It is characterized in that The size detection system for hardware accessories includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the size detection system for hardware accessories to execute the method described in any one of claims 1-7.

9. A computer program product comprising instructions, It is characterized in that When the computer program product runs on a hardware accessory size detection system, the hardware accessory size detection system is enabled to execute the method according to any one of claims 1 to 7.

10. A computer-readable storage medium comprising instructions, It is characterized in that When the instruction is executed on a size detection system for hardware accessories, the size detection system for hardware accessories executes the method as claimed in any one of claims 1 to 7.