Method and system for detecting inner wall size of product

CN117647194BActive Publication Date: 2026-10-27SHENZHENSHI YUZHAN PRECISION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311562551.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-21
Publication Date
2026-10-27
Estimated Expiration
2043-11-21

AI Technical Summary

Technical Problem

而在产品的生产过程中,往往会因为材料、加工方式等原因,出现产品整体内壁结构的变形、产品内壁尺寸误差等问题

Benefits of technology

[0008]应当理解的是,本申请实施例的第二方面与本申请实施例的第一方面的技术方案一致,各方面及对应的可行实施方式所取得的有益效果相似,不再赘述。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117647194B_ABST
    Figure CN117647194B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a product inner wall size detection method and system, which samples and scans the product inner wall through a 3D scanning detection camera, so that the product inner wall size index is quickly measured under the condition of ensuring detection accuracy, and the detection efficiency is improved. The product inner wall size detection method comprises the following steps: moving a product to be detected to a preset detection station, wherein the projection of the product to be detected on the plane where the preset detection station is located coincides with the preset detection station; collecting a 3D image of the preset detection station, and determining the inner wall cross section profile of the product to be detected according to the 3D image; extracting a pair of measurement points and corresponding measurement point coordinates from the inner wall cross section profile, and calculating the inner wall size of the product to be detected according to the measurement point coordinates and the conversion relationship between the coordinate distance and the physical distance which is calibrated in advance.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This application relates to the field of machine vision technology, and in particular to a method and system for detecting the inner wall dimensions of a product. [Background Technology]

[0002] In the production of products with high dimensional precision requirements (including mobile phones, computers, etc.), whether the internal wall dimensions of the product meet the specifications often determines whether the product can be successfully assembled. However, during the production process, problems such as deformation of the overall internal wall structure and dimensional errors of the product's internal walls often occur due to factors such as materials and processing methods.

[0003] To address the aforementioned issues, the internal dimensions of products are often measured manually. This process can lead to errors due to low precision of the testing methods and tools, operator fatigue, or negligence. Furthermore, the speed of manual inspection is limited by the operator's skill level, resulting in overall low efficiency in measuring the internal dimensions of products. [Summary of the Invention]

[0004] This application provides a method and system for detecting the inner wall dimensions of a product. By using a 3D scanning camera to sample and scan the inner wall of the product, the inner wall dimensions of the product can be quickly measured while ensuring detection accuracy, thereby improving detection efficiency.

[0005] In a first aspect, embodiments of this application disclose a method for detecting the inner wall dimensions of a product. The method includes: moving the product to be tested to a preset testing station, wherein the projection of the product to be tested onto the plane of the preset testing station coincides with the preset testing station; acquiring a 3D image of the preset testing station and determining the inner wall cross-sectional profile of the product to be tested based on the 3D image; extracting paired measurement points and corresponding measurement point coordinates from the inner wall cross-sectional profile, and calculating the inner wall dimensions of the product to be tested based on the measurement point coordinates and a pre-calibrated conversion relationship between coordinate distance and physical distance.

[0006] In this embodiment, the product to be tested is first moved to a preset testing station, wherein the edge of the preset testing station is completely aligned with the outer edge of the product to be tested, so that the positioning of the product to be tested is relatively accurate. Then, a 3D camera is used to sample and scan the inner wall of the product, thereby achieving a faster measurement speed of the product's inner wall size indicators compared with traditional manual inspection methods while ensuring the accuracy of the product's inner wall size detection, thus improving inspection efficiency.

[0007] Secondly, this application discloses a product inner wall dimension detection system. The system includes: a visual scanning worktable and a control terminal, wherein the control terminal is electrically connected to the visual scanning worktable; the control terminal is used to receive a user's product dimension measurement command and send a first movement command to the visual scanning worktable; the visual scanning worktable is used to move the product to be tested to a preset detection station according to the first movement command, wherein the projection of the product to be tested on the plane of the preset detection station coincides with the preset detection station; the control terminal is also used to send a first acquisition command to the visual scanning worktable; the visual scanning worktable is also used to acquire a 3D image of the preset detection station according to the first acquisition command and send the 3D image to the control terminal; the control terminal is also used to determine the inner wall cross-sectional profile of the product to be tested according to the 3D image; the control terminal is also used to extract paired measurement points and corresponding measurement point coordinates from the inner wall cross-sectional profile, and calculate the inner wall dimension of the product to be tested according to the measurement point coordinates and a pre-calibrated conversion relationship between coordinate distance and physical distance.

[0008] It should be understood that the second aspect of the embodiments of this application is consistent with the technical solution of the first aspect of the embodiments of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be described again. [Attached Image Description]

[0009] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 (a)-1(b) are schematic diagrams of a product inner wall dimension detection system provided in an embodiment of this application;

[0011] Figure 2 A schematic flowchart illustrating a method for detecting the inner wall dimensions of a product, provided in an embodiment of this application;

[0012] Figure 3 A flowchart illustrating a method for locating a product under test, provided in an embodiment of this application;

[0013] Figure 4 A flowchart illustrating a method for calculating the outer edge contour provided in an embodiment of this application;

[0014] Figure 5 This is a schematic diagram illustrating the distribution of a sampling sub-region as provided in an embodiment of this application;

[0015] Figure 6 A schematic flowchart illustrating a grayscale transformation method for a second-plane image provided in an embodiment of this application;

[0016] Figure 7 A schematic diagram illustrating a method for fitting the edge and corner contours of a product under test, provided in an embodiment of this application;

[0017] Figure 8 A flowchart illustrating a method for determining a sampling sub-region provided in an embodiment of this application;

[0018] Figure 9 This is a schematic diagram showing the position of a target in a calibration plate according to an embodiment of this application;

[0019] Figure 10 A flowchart illustrating a method for confirming the conversion relationship between physical distance and coordinate distance, provided in an embodiment of this application;

[0020] Figure 11 A flowchart illustrating a method for acquiring the profile of an inner wall cross section provided in an embodiment of this application;

[0021] Figure 12 A schematic diagram illustrating the positional relationship between a sampling sub-region and the inner wall edge of the product to be tested, provided in an embodiment of this application;

[0022] Figure 13 A flowchart illustrating a method for determining measurement points provided in an embodiment of this application;

[0023] Figure 14 This is a schematic diagram illustrating a method for selecting measurement points according to an embodiment of this application;

[0024] Figure 15 A flowchart illustrating a method for measuring inner wall dimensions provided in an embodiment of this application;

[0025] Figure 16 This is a schematic diagram of a product inner wall dimension detection system provided in an embodiment of this application.

Detailed Implementation Methods

[0026] To better understand the technical solutions in this specification, the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0027] It should be understood that the described embodiments are merely some, not all, of the embodiments in this specification. All other embodiments obtained by those skilled in the art based on the embodiments in this specification without inventive effort are within the scope of protection of this specification.

[0028] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this specification. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0029] In the production of products with high dimensional precision requirements (including mobile phones, computers, etc.), whether the internal wall dimensions of the product meet the specifications often determines whether the product can be successfully assembled. However, during the production process, problems such as deformation of the overall internal wall structure and dimensional errors of the product's internal walls often occur due to factors such as materials and processing methods.

[0030] The inventors of this application have discovered that, to address the aforementioned problems, the internal wall dimensions of products are often measured manually. This process can lead to measurement errors due to low precision of the testing methods and tools, visual fatigue of the inspectors, or negligence. Furthermore, the speed of manual inspection is limited by the skill level of the personnel, resulting in low overall efficiency in detecting the internal wall dimensions of products.

[0031] In view of this, this application provides a method for detecting the inner wall dimensions of a product. A 3D scanning detection camera samples and scans the inner wall of the product to obtain the inner wall dimension indicators of the product quickly while ensuring detection accuracy, thereby improving detection efficiency.

[0032] It should be understood that the "product" and "product under test" mentioned in the embodiments of this application include, but are not limited to, electronic products and mechanical products such as laptops, tablets, mobile phones, digital cameras, smartwatches, car navigation systems, and digital audio players, as well as the product shells, frames, internal circuit boards, and other component products of these electronic and mechanical products. Since these products require strict control of the inner wall dimensions of the product shells and product parts, the product inner wall dimension detection method provided in the embodiments of this application is applicable to them.

[0033] It should also be understood that the concepts related to the coordinate system, such as "coordinates," "coordinate values," and "coordinate distances," mentioned in the embodiments of this application are all based on the detection system using the product inner wall dimension detection method provided in the embodiments of this application, and the default coordinate system used within the system (generally the camera coordinate system corresponding to the camera device in the detection system). As for how to use the camera coordinate system as the default coordinate system, and how to establish a mapping relationship between the camera coordinate system and the coordinate systems corresponding to other components (such as the platform coordinate system corresponding to the component that moves the product under test), there are several relatively simple configuration methods, so they will not be elaborated upon further.

[0034] Furthermore, in this embodiment, a non-contact detection method is used to detect the inner wall dimensions of the product. This method has high detection accuracy and, compared with the same type of contact detection method, faster detection speed and better versatility, thus it can replace manual detection to achieve fast and accurate detection of the inner wall dimensions of the product.

[0035] The technical solutions provided by the embodiments of this application will be described below with reference to the accompanying drawings:

[0036] Figure 1 (a)-1(b) are schematic diagrams of a product inner wall dimension detection system provided in an embodiment of this application. As one possible implementation, such as... Figure 1 As shown in (a), the product inner wall dimension detection system 1 includes a vision scanning worktable 11 and a control terminal 12. The vision scanning worktable 11 includes a multi-axis moving platform 13, a planar camera 14, an image processing terminal 15, and a 3D scanning detection camera 16. The multi-axis moving platform 13 has multiple degrees of freedom of movement in multiple directions and multiple angles in the spatial coordinate system, and has at least four degrees of freedom in four directions: vertical movement (movement along the y-axis), horizontal movement (movement along the x-axis), longitudinal movement (movement along the z-axis), and horizontal rotation (rotation in the plane containing the x-axis and y-axis). It can move objects placed on it arbitrarily within the range of motion of the mechanical components.

[0037] For example, the visual scanning stage 11 may also include a robotic arm 17 for fixing the planar camera 14 and the 3D scanning inspection camera 16. The robotic arm 17 can move the planar camera 14 and the 3D scanning inspection camera 16, so that the planar camera 14 and the 3D scanning inspection camera 16 can move in any direction and at any angle or adjust their camera posture within the range of motion of the robotic arm 17, thereby capturing the image of the entire multi-axis moving stage 13.

[0038] At the same time, such as Figure 1 As shown in (b), the control terminal 12 and the image processing terminal 15 pre-store the position data of a preset sampling area 21 located on the multi-axis moving platform 13, and the position data of a preset detection station 22 located in the middle of the preset sampling area 21. The size of the preset detection station 22 is equal to the horizontal projection size of the product 3 to be tested on the multi-axis moving platform 13. The specific working mode of this product inner wall dimension detection system 1 is as follows:

[0039] When the product 3 to be tested needs to be inspected, the product inner wall dimension inspection system 1 first moves the product 3 to the preset sampling area 21 via the multi-axis moving platform 13. Then, the planar camera 14 is moved into the preset sampling area 21 and enters the field of view of the planar camera 14. The planar camera 14 is then activated to scan, and the scan data is received through the image processing terminal 15 to calculate the feature vector offset (including position offset and angle offset) between the product 3 to be tested and the preset inspection station 22. Then, the multi-axis moving platform 13 is used to accurately move the product 3 to be tested into the preset inspection station 22.

[0040] Subsequently, the system moves the 3D scanning inspection camera 16 to bring the preset sampling area 21 into the field of view of the 3D scanning inspection camera 16, and acquires a 3D image of the product under test 3. The 3D image is then transmitted to the control terminal 12 to calculate the inner wall cross-sectional profile, find the measurement point, and output the inner wall dimension data of the product under test 3.

[0041] It should be understood that in this system, the planar camera 14 (hereinafter referred to as the "planar camera") responsible for acquiring planar images and the 3D scanning and detection camera 16 (hereinafter referred to as the "3D camera") responsible for acquiring 3D images are by default two cameras with different scanning functions, so as to obtain images with high precision when acquiring planar images and 3D images respectively. However, depending on the requirements of product cost, a special camera or special lens that has both planar imaging and 3D stereoscopic imaging functions can also be used.

[0042] based on Figure 1 For the structure of the product inner wall dimension detection system, please refer to [link / reference needed]. Figure 2 This application also provides a flowchart illustrating a method for detecting the inner wall dimensions of a product. The steps of this method are as follows:

[0043] Step 101: Move the product to be tested to the preset testing station, wherein the projection of the product to be tested on the plane of the preset testing station coincides with the preset testing station.

[0044] In this embodiment, the product to be tested is placed at a preset testing station. The preset testing station should strictly coincide with the projection of the outer edge contour of the product to be tested (e.g., the middle frame of a mobile phone) on the plane where the preset testing station is located, so that the 3D image collected for the product to be tested is as accurate and unbiased as possible.

[0045] In some embodiments, moving the product under test into the preset testing station at once requires high control precision. Therefore, it is possible to first move the product under test into a preset sampling area with a larger range, and then further fine-tune the position of the product under test to the preset testing station based on its position and orientation in the preset sampling area.

[0046] Figure 3This is a flowchart illustrating a method for moving a product under test to a preset testing station according to an embodiment of this application. As one possible implementation, the preset testing station is located in a preset sampling area, and step 101 can be further implemented through sub-steps 1011 to 1016.

[0047] Step 1011: Move the product to be tested to the preset sampling area.

[0048] In this embodiment, the preset sampling area is a rectangular area with an area larger than the preset detection station and smaller than the field of view of the planar camera. However, depending on the actual product design and measurement requirements, the preset sampling area can also be any other shape.

[0049] Moving the product to be tested to the preset sampling area can generally be achieved by translating, lifting, and rotating the product position using a multi-axis moving stage. The multi-axis moving stage can be replaced by any equivalent device or equipment with at least four degrees of freedom (including electric pan-tilt units and multi-degree-of-freedom robotic arms).

[0050] Step 1012: Acquire the first planar image within the preset sampling area.

[0051] After the product under test is moved to any position within the preset sampling area, the action of the planar camera to acquire the first planar image is triggered. The type of planar camera responsible for acquiring the planar image includes, but is not limited to, any planar imaging device including planar linear scan cameras, planar area scan cameras, or ordinary digital cameras.

[0052] To facilitate subsequent calculation of the outer edge contour of the product under test, the specific type of the first planar image acquired by the planar camera can be a grayscale image with only monochrome values. However, depending on the specific operating system and hardware device, the first planar image can also be any type of planar image, including binarized images, multi-channel images, vector images, etc.

[0053] Step 1013: Calculate the outer edge contour of the product to be tested based on the first planar image.

[0054] In this embodiment of the application, taking a grayscale image as an example, after the first planar image is acquired, the outer edge contour of the product to be tested can be calculated based on the difference in grayscale values ​​in the first planar image. An exemplary representation of the outer edge contour is in the form of a matrix vector, which can accurately describe the outer boundary, orientation, and other information of the product to be tested in a data-driven manner.

[0055] Figure 4This is a flowchart illustrating a method for calculating the outer edge contour provided in an embodiment of this application. As one possible implementation, the preset sampling region includes multiple sampling sub-regions evenly distributed along the boundary of the preset sampling region, and step 1012 can be further implemented via sub-step 201;

[0056] Step 201: Collect the second planar image corresponding to each sampling sub-region. The second planar image is a local image of the first planar image.

[0057] In this embodiment of the application, since planar cameras often have certain hardware limitations, they may not be able to achieve clear imaging when capturing a complete first planar image, resulting in a large error between the calculated outer edge contour of the product under test and the actual situation.

[0058] Therefore, if the outer edge contour needs to be calculated subsequently, one option is to divide the preset sampling area into multiple sampling sub-regions. These sampling sub-regions are evenly distributed along the edge of the preset sampling area in any preset shape (i.e., some edges of the sampling sub-regions are tangent to / coincide with some edges of the preset sampling area, and the edges of the sampling sub-regions generally do not exceed the range of the preset sampling area).

[0059] Since there are multiple ways to create a preset sampling area, the edge of the preset sampling area can be close to the outer edge of the product under test to a certain extent. Therefore, when setting up a sampling sub-region, the area and shape of the sampling sub-region can be adjusted appropriately so that a part of the outer edge of the product under test that is close to the edge of the preset sampling area falls into the range of the sampling sub-region and is thus included in the acquisition of the second planar image.

[0060] Therefore, after acquiring the second planar images corresponding to these sampling sub-regions, the planar camera can acquire a clearer portion of the outer edge of the product under test by narrowing the image acquisition field of view. In subsequent steps, the edge vector matrix corresponding to these outer edges is extracted, and then the outer edge contour of the product under test is obtained more accurately through curve fitting and other methods.

[0061] Figure 5 This is a schematic diagram of the distribution of sampling sub-regions provided in an embodiment of this application. As one possible implementation, the number of sampling sub-regions is set to an even number, and their distribution is based on "an axis of symmetry passing through the center point of a preset sampling region", and they are distributed in pairs without sharing edges in an axially symmetrical manner, thereby ensuring that the acquired second planar image can accurately fit the outer edge contour of the product under test.

[0062] Meanwhile, step 1013 can be further implemented through sub-steps 202 to 206.

[0063] Step 202: Perform grayscale transformation on the second planar image corresponding to each sampling sub-region to obtain the corresponding grayscale transformed second planar image.

[0064] After obtaining the second planar image containing the outer edge of the product under test, since one optional image type for the second planar image in this embodiment is a grayscale image, and the pixel color difference of a grayscale image can be appropriately deepened through grayscale transformation operations, thereby making the boundary of the image edge more obvious and the edge vector matrix extracted in subsequent steps more accurate. Therefore, the quality of the second planar image can be further optimized through grayscale transformation operations before extracting the edge vector matrix.

[0065] Specifically, when performing grayscale transformation on the second-plane image, the best presentation effect can be obtained by changing the exposure multiple times.

[0066] Figure 6 This is a schematic flowchart of a grayscale transformation method for a second planar image provided in an embodiment of this application. As one possible implementation, step 202 can be further implemented by executing sub-steps 2021 to 2023.

[0067] Step 2021: Process each second plane image using multiple preset exposure values ​​to obtain multiple corresponding transformed images.

[0068] Step 2022: Using a preset grayscale transformation operator, calculate the grayscale gradient of each transformed image to obtain multiple sets of grayscale gradient matrices. The grayscale transformation operator includes at least one of the gradient operator and the Laplacian operator.

[0069] Step 2023: Select the target gray-level gradient matrix with the largest sum of squares from multiple gray-level gradient matrices, and replace the corresponding second plane image with the transformed image corresponding to the target gray-level gradient matrix to obtain the gray-level transformed second plane image.

[0070] In this embodiment, since a second planar image of type grayscale is used as the base image for calculating the edge vector matrix, the second planar image can be modified with different exposures before calculation to obtain multiple transformed images with different exposures. Then, the image with the highest imaging quality and the clearest outer edge is selected from these transformed images to replace the original second planar image, thereby effectively improving the imaging quality of the outer edge contour by improving the exposure effect.

[0071] Specifically, changing the exposure of the second-plane image can be achieved by post-processing a single second-plane image with multiple preset exposure values ​​to output multiple transformed images.

[0072] In some embodiments, multiple second planar images with different exposures corresponding to a sampling sub-region can be obtained by changing the camera's exposure compensation value, aperture size, shutter speed, and other parameters multiple times when the second planar image is captured by the planar camera. This can replace post-processing and achieve the effect of modifying the exposure of the second planar image.

[0073] After obtaining multiple transformed images with different exposures, the gray-level transformation operators (such as the Laplacian operator and gradient operator) are first used to perform convolution calculations on each of the transformed images to obtain the gray-level gradient matrix corresponding to each transformed image. The gray-level gradient matrix characterizes the difference in gray-level value between each pixel and its surrounding pixels in the transformed image. The larger the sum of the squares of the gray-level gradient matrix, the greater the average gray-level difference in the transformed image, and the better the exposure effect of the transformed image.

[0074] Subsequently, the transform image with the largest sum of squared matrices is selected from multiple transformed images. As mentioned above, this transformed image has the best exposure among all transformed images, meaning it has the clearest edge features and can extract the most accurate outer edge contour in subsequent steps.

[0075] After finding the transformed image with the best exposure effect and replacing the corresponding second-plane image with that transformed image, image filtering algorithms can be used to further improve image clarity.

[0076] Step 203: Process each grayscale transformed second plane image using multiple different image filtering algorithms to obtain multiple corresponding edge grayscale images. The image filtering algorithms include at least Gaussian filtering, median filtering, mean filtering, Sun filtering, and Delichet filtering.

[0077] In this embodiment, the second planar image after grayscale transformation can be input into multiple preset image filtering algorithms for processing, thereby obtaining multiple edge grayscale images with higher clarity, further improving the calculation accuracy of the outer edge contour.

[0078] It should be understood that since the image output by each image filtering algorithm may have a large difference in the improvement effect on sharpness, the corresponding extracted edge vector matrices may also have slight differences; therefore, the edge grayscale images output by multiple image filtering algorithms should be retained at the same time for subsequent sub-pixel edge detection processes.

[0079] Step 204: Perform sub-pixel edge detection on the multiple edge grayscale images corresponding to each grayscale transformed second plane image to obtain multiple edge vector matrices.

[0080] After grayscale transformation and image filtering, the second plane image can be considered to have been optimized into multiple edge grayscale images with better imaging quality. When subjected to subpixel edge detection, it can accurately detect the outer edge of the product under test.

[0081] When using multiple grayscale images for subpixel edge detection, the main detection process is as follows:

[0082] First, interpolation is performed pixel-by-pixel on multiple edge grayscale images corresponding to each grayscale-transformed second-plane image, resulting in a grayscale gradient vector indicating the direction of grayscale change at each pixel's corresponding position. Then, based on the calculated grayscale gradient vectors, trajectories of abrupt grayscale changes in the image are selected according to the overall data characteristics of these gradient vectors. This is then macroscopically represented by locating a portion of the outer edge contour of the product under test using an edge vector matrix. Finally, the edge vector matrix corresponding to each edge grayscale image is output.

[0083] Since there are various methods for subpixel edge detection, and the computational mechanisms of each method are slightly different, this section will only explain the basic algorithm principles of subpixel edge detection, and will not go into the specific calculation process.

[0084] Step 205: Calculate the average value of multiple edge vector matrices to obtain the optimal edge matrix corresponding to each sampling sub-region.

[0085] After performing subpixel edge detection, multiple edge vector matrices are obtained for each second-plane image. Since the edge grayscale images corresponding to these edge vector matrices are obtained by processing different image filtering algorithms, the values ​​of these edge vector matrices are also slightly different.

[0086] Therefore, one possible implementation is to directly calculate the average value of these multiple edge vector matrices to eliminate the differences between different edge vector matrices, thereby obtaining the optimal edge matrix of the corresponding second plane image that is closer to the real outer edge.

[0087] In some embodiments, before calculating the average value, edge vector matrices with variances greater than a set variance threshold can be removed to avoid the optimal edge matrix from the actual outer edge contour of the product under test due to extreme values ​​in multiple edge vector matrices.

[0088] Step 206: Based on the positional relationship between multiple sampling sub-regions and the preset sampling region, fit all edge vectors in each optimal edge matrix to generate the outer edge contour.

[0089] In this embodiment of the application, after calculating the optimal edge matrix with each second plane image, the outer edge contour of the product can be fitted using all the optimal edge matrices, thereby outputting the outer edge contour in the form of a matrix vector. The specific fitting method to be selected is related to the shape contour of the product to be tested.

[0090] For example, for products with complex shapes, the calculated optimal edge matrices can be merged into a larger vector matrix. After dimensionality reduction using Principal Component Analysis (PCA), a preset curve fitting algorithm is input to obtain a complete closed contour curve, which represents the outer edge contour of the product under test. The preset curve fitting algorithm can include, but is not limited to, polynomial fitting algorithms, spline interpolation algorithms, Bezier curve fitting algorithms, piecewise linear fitting algorithms, or any other algorithm with similar effects.

[0091] Meanwhile, for products with relatively regular and simple shapes (such as the mid-frame of a mobile phone or the casing of a laptop), the shape of their corners is a feature that does not need to be considered when measuring the internal wall dimensions of the product, and can be ignored when calculating the outer edge contour using curve fitting algorithms. In this case, the method for calculating the outer edge contour needs to be adapted.

[0092] Figure 7 This is a schematic diagram of a method for fitting the corner contour of a product under test, provided in an embodiment of this application. Figure 7 As shown, when fitting the outer edge contour of the corner area of ​​the product under test, since the product under test has a relatively simple and regular shape, and only the corners are rounded, based on the calculation of the overall contour of the product under test, the two sampling sub-regions ① and ② that are closest to the corner area can be directly selected, and the extension lines ③ and ④ of the best edge matrix corresponding to these two sampling sub-regions can be calculated respectively to obtain the coordinates of the intersection point ⑤ of the two extension lines.

[0093] Then, the calculated intersection point coordinates ⑤ are used as the shape vertices of the outer edge contour of the product under test near the sampling sub-regions ① and ②. The intersection point coordinates ⑤ are also used in the fitting calculation process of fitting the outer edge contour of the product using all the optimal edge matrices (this process can be implemented by using the Bezier curve fitting algorithm or piecewise linear fitting algorithm mentioned above, by substituting the intersection point coordinates into the algorithm). In this way, the outer edge contour is regarded as a simple closed rectangular vector without ignoring the geometric features of the corners, thereby reducing the calculation burden of the outer edge contour without affecting the accuracy of the inner wall dimension detection of the product.

[0094] In addition, since sampling sub-regions can be determined in various ways, such as manual delineation or machine image recognition to collect specific markers, one of the simplest and quickest methods is to pre-determine the positions of multiple sampling sub-regions in the detection system using a pre-set calibration plate with a target.

[0095] Figure 8 This is a flowchart illustrating a method for determining a sampling sub-region provided in an embodiment of this application. As a possible implementation, steps 106 to 110 may be further executed before step 101.

[0096] Step 106: Move the calibration plate to the preset sampling area, wherein the projection of the calibration plate on the plane of the preset sampling area coincides with the preset sampling area, and there are multiple targets evenly distributed on the edge of the calibration plate.

[0097] Step 107: In response to the user's calibration image acquisition operation, acquire the third plane image corresponding to the location of each target, and obtain multiple third plane images.

[0098] Step 108: Based on the preset target template, match the target contour corresponding to the target from each third plane image.

[0099] Step 109: Calculate the target center coordinates corresponding to the target outline.

[0100] Step 110: Sequentially use the center coordinates of each target as the center point coordinates of a sampling sub-region, create a sampling sub-region corresponding to the target, and obtain multiple sampling sub-regions.

[0101] Since the calibration board used in this embodiment is only used to indicate the center point coordinates of each sampling sub-region to the detection system, and the position of each sampling sub-region within the preset sampling area should be selected by the testing personnel according to the actual product situation, any number of targets can be pre-fixed on the calibration board according to the user's needs.

[0102] The specific types of the targets mentioned above may include, but are not limited to, through-hole targets and optical targets, and the specific shapes of the targets may include, but are not limited to, cross targets, circular targets, and square targets.

[0103] For example, Figure 9 This is a schematic diagram illustrating the placement of targets on a calibration plate according to an embodiment of this application. The calibration plate has an even number of fixed targets, all of which are evenly distributed along the edge of a preset sampling area. Every two adjacent targets on the same edge are of equal size and equidistant. Furthermore, all targets are arranged in pairs, symmetrically about the axis of symmetry passing through the center point of the preset sampling area.

[0104] This target placement method allows the determined sampling sub-regions to be evenly distributed along the edge of the preset sampling area. Consequently, the second planar image acquired for the product under test will also have a more uniform positional distribution, which can effectively improve the accuracy of the outer edge contour calculation.

[0105] Correspondingly, for each target that needs to be identified, a target template for identifying at least one target type and shape should also be added to the product inner wall dimension detection system. One possible implementation is to extract feature parameters corresponding to a specific target type and shape using machine learning methods, and generate a target template containing those feature parameters. This allows the detection system to determine the target center coordinates in the second-plane image when it identifies feature parameters belonging to that specific target type and shape.

[0106] Then, according to the operator's instructions, a planar camera can be used to acquire a third-plane image of the target's location, and the corresponding target can be identified from each third-plane image to obtain the center coordinates of multiple targets.

[0107] In some embodiments, a planar camera with higher imaging accuracy can be used to directly capture the entire preset sampling area, and multiple targets can be identified from the obtained image of the entire preset sampling area, thereby determining the center coordinates of all targets at once.

[0108] Finally, the target center coordinates are used as the center coordinates of the sampling sub-region, while the shape parameters, length and width parameters of the sampling sub-region are determined by the testing personnel, thereby defining the location of each sampling sub-region before testing the product to be tested.

[0109] In some embodiments, a mapping relationship can be established between the shape data and length and width data of the sampling sub-region and the type of the product under test. This allows the sampling sub-region to be automatically located on a multi-axis moving platform when multiple product models need to be tested simultaneously. This is achieved by selecting different product types and automatically finding the shape and length and width data of the corresponding sampling sub-region based on the selected product type. The found shape data, length and width data, and the center coordinates of multiple targets obtained through the scanning calibration plate are then applied to quickly position the corresponding sampling sub-region on the multi-axis moving platform.

[0110] Step 1014: Generate a first feature vector based on the outer edge contour. The first feature vector is used to characterize the pose state of the product under test.

[0111] Based on the outer edge contour calculated in the form of a matrix vector, the first feature vector corresponding to the outer edge contour can be further determined, which is the current precise placement state of the product under test on the multi-axis moving worktable. Specifically, the first feature vector can be any matrix vector form that records the position and orientation of the product under test, and since this first feature vector is calculated from the first planar image, it generally only includes position and orientation information in the planar dimension.

[0112] For example, for an outer edge contour extracted based on the camera coordinate system of a planar camera, the first feature vector representing the current orientation and current position of the corresponding product under test can be further extracted through the data volume of orientation features, boundary features, etc. in the outer edge contour. Thus, the first feature vector has data structure features similar to commonly used robot pose vectors (including two mathematical quantities, coordinates and angles in the camera coordinate system).

[0113] Step 1015: Calculate the feature vector offset between the first feature vector and the second feature vector corresponding to the preset detection station. The feature vector offset includes position offset and angle offset.

[0114] After obtaining the first feature vector, a second feature vector corresponding to the preset detection station in the product inner wall dimension detection system can be extracted. This second feature vector can be set synchronously in the detection system when the preset detection station is determined. Subsequently, the difference between the first feature vector and the second feature vector corresponding to the preset detection station is calculated to obtain the feature vector offset. The obtained feature vector offset (including position offset and angle offset) is used as the data reference for subsequent movement.

[0115] Step 1016: Adjust the position of the product to be tested to the preset testing station according to the position offset and angle offset.

[0116] Finally, based on the position offset and angle offset, the product under test is moved from its current position to the preset testing station.

[0117] Furthermore, based on the method mentioned above of determining the sampling sub-region by identifying the target center coordinates corresponding to each third plane image, the conversion relationship between coordinate distance and physical distance can be further established based on the coordinate parameters represented by the target center coordinates and the physical parameters corresponding to each target fixed on the calibration plate.

[0118] Figure 10 This is a flowchart illustrating a method for confirming the conversion relationship between physical distance and coordinate distance provided in an embodiment of this application. As a possible implementation, steps 111 to 112 can be further executed after step 109.

[0119] Step 111: Calculate the coordinate distance between the center points of two adjacent target outlines based on the target center coordinates.

[0120] Step 112: Determine the conversion relationship between coordinate distance and physical distance based on the coordinate distance and the physical distance between the center points of two adjacent targets.

[0121] In this embodiment, since the physical location of the target on the calibration plate is easily determined, the physical distance between the center points of two adjacent targets can also be accurately obtained using a measuring tool. On the other hand, the target center coordinates identified by the detection system using the product inner wall dimension detection method are also numerically definite and unique. Therefore, based on the target center coordinates corresponding to two adjacent targets, the coordinate distance between the center points of these two targets can be determined.

[0122] Furthermore, the physical distance between two adjacent targets can be input, and a conversion relationship between coordinate distance and physical distance can be established together with the corresponding coordinate distance, providing a data conversion basis for subsequent measurement of the inner wall dimensions of the product.

[0123] In addition, after moving the product to be tested into the preset testing station using the above method, it is necessary to further acquire a 3D image of the product to be tested in order to accurately measure the inner wall dimensions of the product.

[0124] Step 102: Acquire 3D images of the preset detection station.

[0125] In this embodiment of the application, the 3D scanning inspection camera used to acquire 3D images can be a 3D area scan camera or a 3D line scan camera. A more suitable type of 3D scanning inspection camera is a small field-of-view 3D area scan camera. When using a small field-of-view 3D area scan camera to acquire images, it can have higher resolution than a large field-of-view 3D area scan camera, and it has a faster image acquisition speed than a 3D line scan camera, thus adapting to situations where batch product inspection is required.

[0126] At the same time, it should be noted that although the outer edge contour of the product under test has been obtained by calculating the first planar image in the aforementioned steps, considering that the product under test is generally three-dimensional and has variations in thickness and shape, if the length and width data are measured directly using the outer edge contour, the obtained dimensional data often has a large error compared with the actual inner wall dimensions, and the accuracy cannot be guaranteed.

[0127] Therefore, it is necessary to acquire 3D images to obtain the shape features of the inner wall of the product under test in order to find the truly suitable measurement points and obtain sufficiently accurate inner wall dimensions based on the measurement points.

[0128] After acquiring the 3D images, further internal wall feature recognition and extraction are required.

[0129] Step 103: Determine the inner wall cross-sectional profile of the product under test based on the 3D image.

[0130] In this embodiment, the product to be measured, whose inner wall dimensions need to be measured, generally has complex shape features at its edges. Not every shape feature is helpful in determining the inner wall dimensions of the product. Therefore, the inner wall cross-sectional profile of the product can be extracted from the 3D image (equivalent to retaining only the geometric features that can be used for inner wall dimension measurement), creating conditions for the subsequent automatic measurement of the product's inner wall dimensions while ensuring accuracy.

[0131] Figure 11 This is a flowchart illustrating a method for determining the profile of an inner wall cross section according to an embodiment of this application. As one possible implementation, step 102 can be further implemented via sub-step 1021.

[0132] Step 1021: Collect multiple 3D images for each sampling sub-region, and retain one target 3D image from the multiple 3D images whose shooting time is equal to the set time.

[0133] Meanwhile, step 103 can be further implemented through sub-steps 1031 to 1032.

[0134] Step 1031: Read the target 3D image corresponding to each sampling sub-region in sequence, and determine the cross-sectional sub-contour corresponding to each target 3D image using the corresponding set plane as the cutting plane. The set plane is perpendicular to the scanning direction of the 3D scanning detection camera and passes through the center point coordinates of the sampling sub-region.

[0135] Step 1032: Use multiple cross-sectional sub-profiles as the inner wall cross-sectional profiles of the product under test.

[0136] In this embodiment, firstly, when the 3D camera acquires 3D images, mechanical vibrations caused by the displacement of the 3D camera or the displacement of the product under test can significantly affect the accuracy of image acquisition. Therefore, multiple 3D images can be acquired simultaneously, and the 3D image at the set time can be retained, thereby effectively eliminating the interference of mechanical vibrations on imaging and improving the accuracy of the obtained cross-sectional sub-contour.

[0137] For example, if a 3D camera captures 20 3D images while stationary in a specific sampling area, with a pulse interval of 100 pulses between each pair of adjacent 3D images, then to eliminate mechanical vibration interference, only the 10th or 11th 3D image is selected for extracting the cross-sectional sub-profile.

[0138] In some embodiments, based on different detection systems and 3D camera configurations, a waiting time can be set before and after each camera displacement or product displacement, and 3D image acquisition can only be performed after the waiting time has expired, thereby effectively eliminating interference caused by mechanical vibration.

[0139] Subsequently, since the 3D image corresponding to each sampling sub-region is continuous in the X-axis, Y-axis and Z-axis according to the camera coordinate system of the 3D camera (for ease of discussion, assume that the Z-axis is an axis that is perpendicular to the plane where the preset sampling area is located and passes through the center point coordinates of the sampling sub-region), a suitable set plane passing through the Z-axis can be selected as the cutting plane to extract a section of cross-sectional sub-contour that can be used to measure the inner wall size from the continuous 3D image.

[0140] Finally, since the sampling sub-regions are evenly distributed along the edge of the preset sampling area, and based on the settings of the preset sampling area and sampling sub-regions described above, it can be ensured that the outer edge of the product under test is captured by the planar camera. Therefore, based on the same settings, the sampling sub-regions can also include a portion of the inner wall edge features of the product under test within the acquisition range. Furthermore, the multiple cross-sectional sub-contours obtained by acquiring the sampling sub-regions can representatively reflect the cross-sectional features of the product under test, and thus can collectively serve as the inner wall cross-sectional contours for the subsequent measurement point extraction process.

[0141] Figure 12 This is a schematic diagram illustrating the positional relationship between a sampling sub-region and the inner wall edge of the product under test, provided in an embodiment of this application. Taking the mid-frame of a mobile phone under test as an example, due to the setup method adopted above, part of the outer edge ⑥ of the mid-frame of the mobile phone under test falls within the sampling sub-region ⑦. At the same time, because the inner wall of the mid-frame of the mobile phone under test is relatively thin, part of the inner wall edge ⑧ of the mid-frame of the mobile phone under test is close to the outer edge ⑥, and also falls within the range of the sampling sub-region ⑦.

[0142] By appropriately changing the area, shape, and distribution of the sampling sub-regions, it is possible to make the sampling sub-region image encompass most of the inner wall edges of the product under test.

[0143] Step 104: Extract pairs of measurement points and their corresponding coordinates from the inner wall cross-sectional profile.

[0144] In this embodiment, in addition to knowing the inner wall cross-sectional profile (i.e., multiple cross-sectional sub-profiles), it is also necessary to select representative measurement points on the profile before the inner wall dimensions can be measured. To select these measurement points, it is feasible to develop an algorithm that analyzes the geometric features of the inner wall cross-sectional profile.

[0145] Figure 13This is a flowchart illustrating a method for determining measurement points according to an embodiment of this application. As one possible implementation, step 104 can be further implemented through sub-steps 1041 to 1044.

[0146] Step 1041: Sequentially group every two mutually axially symmetric and non-shared-edge sampling sub-regions into a group of target sampling sub-regions.

[0147] Step 1042: Based on the preset contour feature vector, perform feature search on the two cross-sectional sub-contours corresponding to each group of target sampling sub-regions to obtain the region of interest corresponding to each cross-sectional sub-contour. The region of interest is used to characterize the region in the cross-sectional sub-contour with the highest probability of having an inner wall edge.

[0148] Step 1043: Perform linear regression calculations on the regions of interest corresponding to each cross-sectional sub-contour in turn to locate the point of maximum curvature in the region of interest.

[0149] Step 1044: Take the two maximum curvature points corresponding to each group of target sampling sub-regions as a set of measurement points, and extract the coordinates of the two measurement points corresponding to each set of measurement points.

[0150] In this embodiment of the application, an even number of sampling sub-regions are selected, and their distribution in the preset sampling area is sufficiently uniform, so that two mutually axially symmetric and non-shared-edge sampling sub-regions can be selected multiple times during grouping.

[0151] It should be noted that, under this premise, the axis of symmetry is usually a straight line that passes through the center point of the preset sampling area and has an angle of 0 degrees or 90 degrees on the XY axis of the plane where the preset sampling area is located.

[0152] After selecting multiple pairs of sampling sub-regions and grouping them sequentially, the two cross-sectional sub-contours corresponding to a set of target sampling sub-regions can be filtered based on the preset contour feature vector to extract the region of interest with similar features to the contour feature vector. This region of interest is the region with the highest probability of having an inner wall edge in the corresponding cross-sectional sub-contour.

[0153] Specifically, firstly, to ensure that the region of interest can be accurately extracted from the inner wall cross-sectional profile of the same batch of products, a standard sample with the same specifications and model as the product to be tested can be scanned before testing all the products to be tested, and the inner wall cross-sectional profile of the sample can be generated. Then, the region where the inner wall edge is located can be manually selected (or selected by machine learning algorithm) in the inner wall cross-sectional profile corresponding to the sample, and the contour features in the region can be extracted in the form of feature vectors by using the reduction domain operator (also known as "projection operator", "selection operator" or "filtering operator", which can be used to remove unnecessary or repetitive elements in an image and retain only the required elements such as the inner wall edge contour) or other methods, to obtain the contour feature vector.

[0154] Since the contour feature vector has the inner wall edge contour features of the standard sample, and the standard sample is consistent with the specifications and model of the products to be tested in the same batch, the obtained contour feature vector can be used to initially screen out the region of interest in the products to be tested in this batch.

[0155] Subsequently, when inspecting the product under test, similarity calculations can be performed on a certain cross-sectional sub-contour based on the contour feature vector. The similarity calculation algorithm can employ any similarity algorithm, including but not limited to cosine similarity, Euclidean distance, Shannon distance, Fraser distance, Hausdorff distance, and dynamic time warping. Using these algorithms, contour lines similar to the contour feature vector can be selected from the cross-sectional sub-contour, and a region is generated that selects these contour lines, which is the region of interest required in this embodiment.

[0156] Figure 14 This is a schematic diagram of a method for selecting measurement points provided in an embodiment of this application. Since the connection between the inner wall surface ⑨ and other surfaces ⑩ of the product under test typically has a higher curvature than the interior of the inner wall surface ⑨, a preferred method is to select the region of interest... Calculate the curvature of the inner contour lines and select the point of maximum curvature. As a measurement point.

[0157] In some embodiments, when selecting the region where the inner wall edge of the sample is located, a measurement point can be further specified based on the selected region. Thus, the selection pattern of this measurement point is learned through machine learning algorithms, and when inspecting the product under test, a suitable measurement point is automatically found based on the selection pattern learned from the sample.

[0158] Step 105: Calculate the inner wall dimensions of the product to be measured based on the coordinates of the measurement points and the pre-defined conversion relationship between coordinate distance and physical distance.

[0159] In this embodiment, since the target sampling sub-regions corresponding to the selected measurement points are grouped in pairs, and the two target sampling sub-regions in each group are axially symmetric and do not share sides, it can be considered that the two measurement points corresponding to each group directly indicate a parallel line segment of a long side (or short side) in the inner wall of the product, and the inner wall dimensions of the product can be known by measuring the physical distance between the two measurement points in the group.

[0160] Specifically, since the conversion relationship between coordinate distance and physical distance has been discussed earlier, we only need to know the coordinate distance between two measurement points in a group to obtain the corresponding physical distance based on the conversion relationship between coordinate distance and physical distance.

[0161] Figure 15 This is a schematic flowchart of a method for measuring the inner wall dimension provided in an embodiment of this application. As one possible implementation, step 105 can be further implemented through sub-steps 1051 to 1055.

[0162] Step 1051: Based on the coordinates of the two measurement points corresponding to each group of measurement points, calculate the coordinate distance between each group of measurement points to obtain the coordinate distance of multiple measurement points.

[0163] Step 1052: In response to the fact that a group of target sampling sub-regions are all located on the long side of the preset sampling area, classify the corresponding measurement point coordinate distances into width coordinate values.

[0164] Step 1053: In response to the fact that a group of target sampling sub-regions are all located on the short side of the preset sampling region, classify the corresponding measurement point coordinate distances into length coordinate values.

[0165] Step 1054: Based on the conversion relationship between coordinate distance and physical distance, calculate the inner wall width corresponding to each width coordinate value and the inner wall length corresponding to each length coordinate value.

[0166] Step 1055: Output the inner wall width and inner wall length.

[0167] In this embodiment, the dimensions of the product's inner wall can be determined by obtaining the coordinates of the two measurement points corresponding to each set of measurement points and calculating the corresponding distance between the measurement points. Furthermore, based on the positions of the two target sampling sub-regions corresponding to the set of measurement points within a preset sampling area, the distance between the measurement points can be classified according to length and width coordinate values.

[0168] Subsequently, by using the conversion relationship between coordinate distance and physical distance mentioned above, the length coordinate value and width coordinate value can be directly converted into the corresponding inner wall length and width data of the product, that is, the inner wall dimensions of the product to be inspected.

[0169] Depending on the specific needs of the testing personnel, the output length and width data can be associated with the corresponding two target sampling sub-regions to obtain the size data of different positions on the inner wall of the product; or the average value can be calculated directly to obtain the average size data of the inner wall of the product.

[0170] In some embodiments, a set of length coordinate values ​​and a set of width coordinate values ​​can be directly established based on the numerical values ​​of the distances between the measurement points through clustering. The set of length coordinate values ​​includes the distances between all measurement points with similar values ​​that may be length coordinate values; similarly, the set of width coordinate values ​​includes the distances between all measurement points with similar values ​​that may be width coordinate values. Then, the average values ​​of the length and width coordinate value sets are calculated, and the corresponding output values ​​are used as the length and width coordinate values, respectively.

[0171] In some embodiments, if the heights of a set of measurement points are inconsistent (i.e., the line connecting these measurement points is not parallel to the plane where the preset sampling area is located), after calculating the corresponding coordinate distance of the measurement points, the horizontal coordinate distance corresponding to the coordinate distance of the measurement points is further calculated using the trigonometric function value formed between the line connecting these measurement points and the coordinate axes of the camera coordinate system (the horizontal distance here is relative to the plane where the preset sampling area is located), thereby obtaining a more accurate inner wall dimension of the product.

[0172] Please see Figure 16 Based on the same inventive concept, this application also provides a schematic diagram of a product inner wall dimension detection system. The system includes: a visual scanning worktable 301 and a control terminal 302, wherein the control terminal 302 is electrically connected to the visual scanning worktable 301;

[0173] The control terminal 302 is used to receive the user's product size measurement command and send the first movement command to the vision scanning worktable 301;

[0174] The visual scanning worktable 301 is used to move the product under test to a preset inspection station according to the first moving instruction, wherein the projection of the product under test on the plane where the preset inspection station is located coincides with the preset inspection station.

[0175] The control terminal 302 is also used to send a first acquisition command to the visual scanning worktable 301;

[0176] The visual scanning workstation 301 is also used to acquire 3D images of preset detection stations according to the first acquisition command, and send the 3D images to the control terminal 302.

[0177] The control terminal 302 is also used to determine the inner wall cross-sectional profile of the product under test based on the 3D image;

[0178] The control terminal 302 is also used to extract paired measurement points and corresponding measurement point coordinates from the inner wall cross-sectional profile, and to calculate the inner wall dimensions of the product to be measured based on the measurement point coordinates and the pre-calibrated conversion relationship between coordinate distance and physical distance.

[0179] Optionally, the preset inspection station is located in the preset sampling area. The visual scanning stage 301 includes at least an image processing terminal, a multi-axis moving platform and an area array inspection camera. The preset sampling area is set on the multi-axis moving platform.

[0180] A multi-axis moving platform is used to move the product under test to a preset sampling area according to a first moving command;

[0181] An image processing terminal is used to send a second acquisition command to the area array detection camera after the multi-axis moving platform has completed its movement.

[0182] The area array detection camera is used to move according to the second acquisition command so that the preset sampling area is located within the shooting field of view of the area array detection camera, acquire the first planar image within the preset sampling area and send it to the image processing terminal.

[0183] An image processing terminal is used to send a first planar image to a device that calculates the outer edge contour of the product under test based on the first planar image, and generates a first feature vector based on the outer edge contour. The first feature vector is used to characterize the pose state of the product under test.

[0184] The image processing terminal is also used to calculate the feature vector offset between the first feature vector and the second feature vector corresponding to the preset detection station, and send the feature vector offset to the multi-axis moving platform. The feature vector offset includes position offset and angle offset.

[0185] The multi-axis moving platform is also used to adjust the position of the product under test to a preset testing station based on the positional and angular offsets.

[0186] Optionally, the preset sampling area includes multiple sampling sub-regions evenly distributed along the boundary of the preset sampling area. The area array detection camera is specifically used for:

[0187] The camera moves according to the second acquisition command, so that the field of view of the area array detection camera passes through each sampling sub-region in sequence;

[0188] When each sampling sub-region moves into the field of view of the area array detection camera, the corresponding second planar image is acquired and sent to the image processing terminal. The second planar image is a partial image of the first planar image.

[0189] The image processing terminal is specifically used for:

[0190] Perform grayscale transformation on the second planar image corresponding to each sampling sub-region to obtain the corresponding grayscale transformed second planar image;

[0191] The second plane image after grayscale transformation is processed by multiple different image filtering algorithms to obtain multiple corresponding edge grayscale images. The image filtering algorithms include at least Gaussian filtering algorithm, median filtering algorithm, mean filtering algorithm, Sun filtering algorithm and Delichet filtering algorithm.

[0192] Subpixel edge detection is performed on the multiple edge grayscale images corresponding to each grayscale transformed second plane image to obtain multiple edge vector matrices;

[0193] Calculate the average of multiple edge vector matrices to obtain the optimal edge matrix corresponding to each sampled sub-region;

[0194] Based on the positional relationship between multiple sampling sub-regions and the preset sampling region, all edge vectors in each optimal edge matrix are fitted to generate the outer edge contour.

[0195] Optionally, the control terminal 302 is also used to send a second movement command to the multi-axis motion platform before sending the first movement command;

[0196] The multi-axis moving platform is also used to move the calibration plate to a preset sampling area according to the second moving command, wherein the projection of the calibration plate on the plane where the preset sampling area is located coincides with the preset sampling area, and there are multiple targets evenly distributed on the edge of the calibration plate.

[0197] The control terminal 302 is also used to send a third acquisition command to the visual scanning worktable 301 in response to the user's calibration image acquisition operation;

[0198] The area array detection camera is also used to acquire the third plane image corresponding to the location of each target according to the third acquisition command, obtain multiple third plane images, and send all the obtained multiple third plane images to the control terminal 302;

[0199] The control terminal 302 is also used to match the target outline corresponding to the target from each third plane image based on a preset target template;

[0200] The control terminal 302 is also used to calculate the target center coordinates corresponding to the target outline;

[0201] The control terminal 302 is also used to sequentially use the center coordinates of each target as the center point coordinates of a sampling sub-region, create a sampling sub-region corresponding to the target, and obtain multiple sampling sub-regions.

[0202] Optionally, the visual scanning stage 301 also includes a 3D scanning inspection camera;

[0203] A 3D scanning inspection camera is used to move according to the first acquisition command, so that the field of view of the 3D scanning inspection camera passes through each sampling sub-region in sequence;

[0204] The 3D scanning inspection camera is also used to acquire multiple corresponding 3D images when each sampling sub-region moves into the shooting field of the 3D scanning inspection camera, and send the target 3D image whose shooting time is equal to the set time to the control terminal 302.

[0205] Control terminal 302 is specifically used for:

[0206] The target 3D image corresponding to each sampling sub-region is read sequentially, and the cross-sectional sub-contour corresponding to each target 3D image is determined with the corresponding set plane as the cutting plane. The set plane is perpendicular to the scanning direction of the 3D scanning detection camera and passes through the center point coordinates of the sampling sub-region.

[0207] Multiple cross-sectional sub-profiles are used as the inner wall cross-sectional profiles of the product.

[0208] Optionally, the control terminal 302 is specifically used for:

[0209] Each pair of mutually axially symmetric and non-shared edge sampling sub-regions is sequentially grouped into a target sampling sub-region;

[0210] Based on the preset contour feature vector, feature search is performed on the two cross-sectional sub-contours corresponding to each group of target sampling sub-regions to obtain the region of interest corresponding to each cross-sectional sub-contour. The region of interest is used to characterize the region with the highest probability of having an inner wall edge in the cross-sectional sub-contour.

[0211] Linear regression calculations are performed sequentially on the regions of interest corresponding to each cross-sectional sub-contour to locate the point of maximum curvature within the regions of interest.

[0212] The two points with the maximum curvature corresponding to each group of target sampling sub-regions are taken as a set of measurement points, and the coordinates of the two measurement points corresponding to each set of measurement points are extracted.

[0213] Optionally, the control terminal 302 is specifically used for:

[0214] Based on the coordinates of the two measurement points corresponding to each group of measurement points, calculate the coordinate distance between each group of measurement points to obtain the coordinate distance of multiple measurement points.

[0215] In response to a set of target sampling sub-regions all being located on the long side of a preset sampling region, the corresponding measurement point coordinate distances are classified as width coordinate values;

[0216] In response to a set of target sampling sub-regions all being located on the short side of a preset sampling region, the corresponding measurement point coordinate distances are classified as length coordinate values.

[0217] Based on the conversion relationship between coordinate distance and physical distance, calculate the inner wall width corresponding to each width coordinate value, and the inner wall length corresponding to each length coordinate value;

[0218] Output the inner wall width and inner wall length.

[0219] Optionally, the image processing terminal is specifically used for:

[0220] Each second plane image is processed using multiple preset exposure values ​​to obtain multiple corresponding transformed images;

[0221] Using a preset grayscale transformation operator, the grayscale gradient of each transformed image is calculated to obtain multiple sets of grayscale gradient matrices. The grayscale transformation operator includes at least one of the gradient operator and the Laplacian operator.

[0222] Select the target gray-level gradient matrix with the largest sum of squares from multiple gray-level gradient matrices, and replace the corresponding second-plane image with the transformed image corresponding to the target gray-level gradient matrix to obtain the gray-level transformed second-plane image corresponding to each sampling sub-region.

[0223] Optionally, the control terminal 302 is also used for:

[0224] Calculate the coordinate distance between the center points of two adjacent target profiles based on the target center coordinates;

[0225] Based on the coordinate distance and the physical distance between the center points of two adjacent targets, determine the conversion relationship between coordinate distance and physical distance.

[0226] The above description is merely a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.

Claims

1. A method for detecting the inner wall dimensions of a product, characterized in that, The method includes: Move the product under test to a preset testing station, wherein the projection of the product under test onto the plane where the preset testing station is located coincides with the preset testing station; Acquire 3D images of the preset testing station and determine the inner wall cross-sectional profile of the product under test based on the 3D images; Extract pairs of measurement points and their corresponding coordinates from the inner wall cross-sectional profile, and calculate the inner wall dimensions of the product under test based on the measurement point coordinates and the pre-calibrated conversion relationship between coordinate distance and physical distance. The preset testing station is located in the preset sampling area. Moving the product to be tested to the preset testing station includes: Move the product to be tested to the preset sampling area; Acquire a first planar image within the preset sampling area, and calculate the outer edge contour of the product under test based on the first planar image; A first feature vector is generated based on the outer edge contour, and the first feature vector is used to characterize the pose state of the product under test. Calculate the feature vector offset between the first feature vector and the second feature vector corresponding to the preset detection station, wherein the feature vector offset includes position offset and angle offset; Based on the position offset and the angle offset, adjust the position of the product to be tested to the preset testing station.

2. The method according to claim 1, characterized in that, The preset sampling region includes multiple sampling sub-regions evenly distributed along the boundary of the preset sampling region. Acquiring a first planar image within the preset sampling region includes: A second planar image corresponding to each of the sampling sub-regions is acquired, and the second planar image is a partial image of the first planar image; The step of calculating the outer edge contour of the product under test based on the first planar image includes: Perform grayscale transformation on the second planar image corresponding to each of the sampling sub-regions to obtain the corresponding grayscale transformed second planar image; Each of the second plane images after grayscale transformation is processed using multiple different image filtering algorithms to obtain multiple corresponding edge grayscale images. The image filtering algorithms include at least Gaussian filtering algorithm, median filtering algorithm, mean filtering algorithm, Sun filtering algorithm, and Delichet filtering algorithm. Subpixel edge detection is performed on the multiple edge grayscale images to obtain multiple edge vector matrices; Calculate the average value of the multiple edge vector matrices to obtain the optimal edge matrix corresponding to each of the sampled sub-regions; Based on the positional relationship between each of the sampling sub-regions and the preset sampling region, all edge vectors in each of the optimal edge matrices are fitted to generate the outer edge contour.

3. The method according to claim 2, characterized in that, Before moving the product to be tested to the preset testing station, the method further includes: The calibration plate is moved to the preset sampling area, wherein the projection of the calibration plate onto the plane of the preset sampling area coincides with the preset sampling area, and multiple targets are evenly distributed on the edge of the calibration plate. In response to the user's calibration image acquisition operation, the third plane image corresponding to the location of each target is acquired respectively, resulting in multiple third plane images; Based on a preset target template, the target outline corresponding to the target is matched from each of the third plane images; Calculate the target center coordinates corresponding to the target contour; Each target center coordinate is used as the center point coordinate of a sampling sub-region in turn, and a sampling sub-region corresponding to the target is created to obtain multiple sampling sub-regions.

4. The method according to claim 3, characterized in that, Acquiring 3D images of the preset detection station includes: Multiple 3D images are acquired for each of the sampling sub-regions, and one target 3D image is retained from the multiple 3D images whose capture time is equal to the set time. Determining the inner wall cross-sectional profile of the product under test based on the 3D image includes: The target 3D image corresponding to each sampling sub-region is read sequentially, and the cross-sectional sub-contour corresponding to each target 3D image is determined with the corresponding set plane as the cutting plane. The set plane is perpendicular to the scanning direction of the 3D scanning detection camera and passes through the center point coordinates of the sampling sub-region. The multiple cross-sectional sub-profiles are used as the inner wall cross-sectional profiles of the product under test.

5. The method according to claim 4, characterized in that, Extracting pairs of measurement points and their corresponding coordinates from the inner wall cross-sectional profile includes: Each pair of mutually axially symmetric and non-shared edge sampling sub-regions is sequentially grouped into a target sampling sub-region; Based on the preset contour feature vector, feature search is performed on the two cross-sectional sub-contours corresponding to each group of target sampling sub-regions to obtain the region of interest corresponding to each cross-sectional sub-contour. The region of interest is used to characterize the region in the cross-sectional sub-contour with the highest probability of having an inner wall edge. Linear regression calculations are performed sequentially on the regions of interest corresponding to each of the cross-sectional sub-contours to locate the point of maximum curvature within the regions of interest. The two maximum curvature points corresponding to each group of target sampling sub-regions are taken as a group of measurement points, and the coordinates of the two measurement points corresponding to each group of measurement points are extracted.

6. The method according to claim 5, characterized in that, The inner wall dimensions of the product under test are calculated based on the coordinate distance between the paired measurement points and the pre-defined conversion relationship between coordinate distance and physical distance, including: Based on the coordinates of the two measurement points corresponding to each group of measurement points, calculate the coordinate distance between each group of measurement points to obtain multiple coordinate distances between measurement points; In response to the fact that a group of the target sampling sub-regions are all located on the long side of the preset sampling region, the corresponding measurement point coordinate distance is classified as a width coordinate value; In response to the fact that a group of the target sampling sub-regions are all located on the short side of the preset sampling region, the corresponding measurement point coordinate distance is classified as a length coordinate value; Based on the conversion relationship between the coordinate distance and the physical distance, calculate the inner wall width corresponding to each width coordinate value and the inner wall length corresponding to each length coordinate value; Output the inner wall width and the inner wall length.

7. The method according to claim 2, characterized in that, Performing grayscale transformation on the second planar image corresponding to each of the sampling sub-regions to obtain the corresponding grayscale transformed second planar image includes: Each of the second planar images is processed using multiple preset exposure values ​​to obtain multiple corresponding transformed images; Using a preset grayscale transformation operator, the grayscale gradient of each transformed image is calculated to obtain multiple sets of grayscale gradient matrices. The grayscale transformation operator includes at least one of the gradient operator and the Laplacian operator. From the multiple sets of gray-level gradient matrices, select the target gray-level gradient matrix with the largest sum of squares, and replace the corresponding second planar image with the transformed image corresponding to the target gray-level gradient matrix to obtain the gray-level transformed second planar image corresponding to each of the sampling sub-regions.

8. The method according to claim 3, characterized in that, After calculating the target center coordinates corresponding to the target contour, the method further includes: Calculate the coordinate distance between the center points of two adjacent target contours based on the target center coordinates; Based on the coordinate distance and the physical distance between the center points of two adjacent targets, the conversion relationship between the coordinate distance and the physical distance is determined.

9. A product inner wall dimension detection system, characterized in that, The system includes: a visual scanning workbench and a control terminal, wherein the control terminal is electrically connected to the visual scanning workbench; The control terminal is used to receive the user's product size measurement command and send a first movement command to the vision scanning worktable; The visual scanning workstation is used to move the product to be tested to a preset inspection station according to the first moving instruction, wherein the projection of the product to be tested on the plane where the preset inspection station is located coincides with the preset inspection station. The control terminal is also used to send a first acquisition command to the visual scanning workbench; The visual scanning workstation is also used to acquire 3D images of the preset detection station according to the first acquisition instruction, and send the 3D images to the control terminal; The control terminal is also used to determine the inner wall cross-sectional profile of the product under test based on the 3D image; The control terminal is also used to extract pairs of measurement points and corresponding measurement point coordinates from the inner wall cross-sectional profile, and to calculate the inner wall dimensions of the product to be measured based on the measurement point coordinates and the pre-calibrated conversion relationship between coordinate distance and physical distance. The preset detection station is located in the preset sampling area. The visual scanning workbench includes at least an image processing terminal, a multi-axis moving platform and an area array detection camera. The preset sampling area is set on the multi-axis moving platform. The multi-axis moving platform is used to move the product under test to the preset sampling area according to the first moving command; The image processing terminal is used to send a second acquisition command to the area array detection camera after the multi-axis moving platform has completed its movement. The area array detection camera is used to move according to the second acquisition command, so that the preset sampling area is located within the shooting field of view of the area array detection camera, acquire a first planar image within the preset sampling area and send it to the image processing terminal; The image processing terminal is used to send the first planar image to the calculation of the outer edge contour of the product under test based on the first planar image, and generate a first feature vector based on the outer edge contour. The first feature vector is used to characterize the pose state of the product under test. The image processing terminal is also used to calculate the feature vector offset between the first feature vector and the second feature vector corresponding to the preset detection station, and send the feature vector offset to the multi-axis moving platform. The feature vector offset includes position offset and angle offset. The multi-axis moving platform is also used to adjust the position of the product to be tested to the preset testing station according to the position offset and the angle offset.

10. The system according to claim 9, characterized in that, The preset sampling region includes multiple sampling sub-regions evenly distributed along the boundary of the preset sampling region, and the area array detection camera is specifically used for: The camera moves according to the second acquisition command, so that the field of view of the area array detection camera sequentially passes through each of the sampling sub-regions; When each of the sampling sub-regions moves into the field of view of the area array detection camera, a corresponding second planar image is acquired, and the corresponding second planar image is sent to the image processing terminal. The second planar image is a partial image of the first planar image. The image processing terminal is specifically used for: Perform grayscale transformation on the second planar image corresponding to each of the sampling sub-regions to obtain the corresponding grayscale transformed second planar image; The second planar image after grayscale transformation is processed by multiple different image filtering algorithms to obtain multiple corresponding edge grayscale images. The image filtering algorithms include at least Gaussian filtering algorithm, median filtering algorithm, mean filtering algorithm, Sun filtering algorithm and Delichet filtering algorithm. Subpixel edge detection is performed on the multiple edge grayscale images corresponding to each grayscale transformed second planar image to obtain multiple edge vector matrices; Calculate the average value of the multiple edge vector matrices to obtain the optimal edge matrix corresponding to each of the sampled sub-regions; Based on the positional relationship between the multiple sampling sub-regions and the preset sampling region, all edge vectors in each optimal edge matrix are fitted to generate the outer edge contour.

11. The system according to claim 10, characterized in that, The control terminal is also used to send a second movement command to the multi-axis motion platform before sending the first movement command; The multi-axis moving platform is further configured to move the calibration plate to the preset sampling area according to the second moving command, wherein the projection of the calibration plate on the plane where the preset sampling area is located coincides with the preset sampling area, and there are multiple targets evenly distributed on the edge of the calibration plate. The control terminal is also used to send a third acquisition command to the area array detection camera in response to the user's calibration image acquisition operation; The area array detection camera is also used to acquire a third plane image corresponding to the location of each target according to the third acquisition command, to obtain multiple third plane images, and to send all the obtained multiple third plane images to the control terminal; The control terminal is also used to match the target outline corresponding to the target from each of the third plane images based on a preset target template. The control terminal is also used to calculate the target center coordinates corresponding to the target outline; The control terminal is further configured to sequentially use the center coordinates of each target as the center point coordinates of a sampling sub-region, create the sampling sub-region corresponding to the target, and obtain multiple sampling sub-regions.

12. The system according to claim 11, characterized in that, The visual scanning workstation also includes a 3D scanning inspection camera; The 3D scanning detection camera is used to move according to the first acquisition command, so that the field of view of the 3D scanning detection camera sequentially passes through each of the sampling sub-regions; The 3D scanning detection camera is also used to acquire multiple corresponding 3D images when each of the sampling sub-regions moves into the shooting field of the 3D scanning detection camera, and send one of the target 3D images whose shooting time is equal to the set time to the control terminal. The control terminal is specifically used for: The target 3D image corresponding to each sampling sub-region is read sequentially, and the cross-sectional sub-contour corresponding to each target 3D image is determined with the corresponding set plane as the cutting plane. The set plane is perpendicular to the scanning direction of the 3D scanning detection camera and passes through the center point coordinates of the sampling sub-region. The multiple cross-sectional sub-profiles are used as the inner wall cross-sectional profiles of the product.

13. The system according to claim 12, characterized in that, The control terminal is specifically used for: Each pair of mutually axially symmetric and non-shared edge sampling sub-regions is sequentially grouped into a target sampling sub-region; Based on the preset contour feature vector, feature search is performed on the two cross-sectional sub-contours corresponding to each group of target sampling sub-regions to obtain the region of interest corresponding to each cross-sectional sub-contour. The region of interest is used to characterize the region in the cross-sectional sub-contour with the highest probability of having an inner wall edge. Linear regression calculations are performed sequentially on the regions of interest corresponding to each of the cross-sectional sub-contours to locate the point of maximum curvature within the regions of interest. The two maximum curvature points corresponding to each group of target sampling sub-regions are taken as a group of measurement points, and the coordinates of the two measurement points corresponding to each group of measurement points are extracted.

14. The system according to claim 13, characterized in that, The control terminal is specifically used for: Based on the coordinates of the two measurement points corresponding to each group of measurement points, calculate the coordinate distance between each group of measurement points to obtain multiple coordinate distances between measurement points; In response to the fact that a group of the target sampling sub-regions are all located on the long side of the preset sampling region, the corresponding measurement point coordinate distance is classified as a width coordinate value; In response to the fact that a group of the target sampling sub-regions are all located on the short side of the preset sampling region, the corresponding measurement point coordinate distance is classified as a length coordinate value; Based on the conversion relationship between the coordinate distance and the physical distance, calculate the inner wall width corresponding to each width coordinate value and the inner wall length corresponding to each length coordinate value; Output the inner wall width and the inner wall length.

15. The system according to claim 10, characterized in that, The image processing terminal is specifically used for: Each of the second planar images is processed using multiple preset exposure values ​​to obtain multiple corresponding transformed images; Using a preset grayscale transformation operator, the grayscale gradient of each transformed image is calculated to obtain multiple sets of grayscale gradient matrices. The grayscale transformation operator includes at least one of the gradient operator and the Laplacian operator. From the multiple sets of gray-level gradient matrices, select the target gray-level gradient matrix with the largest sum of squares, and replace the corresponding second planar image with the transformed image corresponding to the target gray-level gradient matrix to obtain the gray-level transformed second planar image corresponding to each of the sampling sub-regions.

16. The system according to claim 11, characterized in that, The control terminal is also used for: Calculate the coordinate distance between the center points of two adjacent target contours based on the target center coordinates; Based on the coordinate distance and the physical distance between the center points of two adjacent targets, the conversion relationship between the coordinate distance and the physical distance is determined.

Citation Information

Patent Citations

  • Device and method for detecting size of internal groove of small-size workpiece through asynchronous exposure of multipoint light source

    CN106091926A

  • High-precision laser 3D profile detection method of mobile phone structure piece

    CN106949848A