A screw height detection method, a terminal device, and a computer-readable storage medium

By combining data fusion methods of brightness map and depth map, histogram equalization and sub-pixel level edge detection are used to perform two-dimensional precise positioning of screw caps on the brightness map, and an annular reference area is generated on the depth map. This solves the problems of blurred edges and reference deviation in the depth map, and achieves high-precision screw height detection.

CN122199646APending Publication Date: 2026-06-12RI SHAN COMPUTER ACCESSORY (JIASHAN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
RI SHAN COMPUTER ACCESSORY (JIASHAN) CO LTD
Filing Date
2026-03-03
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing screw height detection methods suffer from poor positioning accuracy due to blurred depth map edges and reference deviations caused by surface deformation of injection molded parts, failing to meet the demands of modern industrial automation and high-precision inspection.

Method used

By combining data fusion methods of brightness map and depth map, the screw cap is accurately located in two dimensions on the brightness map through histogram equalization and sub-pixel level edge detection. A ring-shaped dynamic reference area is generated to obtain height data on the depth map. The height difference between the top surface of the screw cap and the reference area is calculated to determine the screw height.

🎯Benefits of technology

It improves the accuracy and anti-interference ability of screw height detection, can adapt to different lighting conditions and changes in screw surface characteristics, eliminates systematic errors, and achieves more reliable relative height measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122199646A_ABST
    Figure CN122199646A_ABST
Patent Text Reader

Abstract

The present application relates to a kind of screw height detection method, terminal equipment and computer readable storage medium, to solve the problem of existing technology in depth map edge positioning is not accurate and the influence of injection molding surface deformation reference accuracy.The method comprises: obtaining the brightness map and depth map of the product to be measured;The screw cap region is preliminarily positioned on the brightness map;Subpixel edge detection and circle fitting are carried out based on the brightness map, the accurate two-dimensional position of the screw cap is obtained, and the first height data of the screw cap top surface is extracted from the corresponding position of the depth map;A ring-shaped dynamic reference area is generated around the screw cap position on the depth map, and the second height data thereof is extracted;Whether the screw height is qualified is judged by calculating the difference between the first and second height data.The present application combines the advantages of accurate positioning of brightness map and direct measurement of depth map, avoids peripheral process deformation through dynamic reference area, effectively improves the detection accuracy and adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automated optical inspection technology, and in particular to a screw height detection method, terminal equipment, and computer-readable storage medium. Background Technology

[0002] In industrial production and quality control, screw installation height is a critical quality indicator. Screws installed too high can lead to uneven product surfaces, poor assembly, and even affect product functionality; screws installed too low can result in weak connections or damage to the product structure. Traditional methods for detecting screw height typically rely on manual visual inspection or contact measuring tools. These methods are inefficient, inaccurate, and easily affected by subjective human factors, failing to meet the demands of modern industrial automation and high-precision testing.

[0003] In recent years, with the development of machine vision technology, non-contact visual inspection methods have been introduced into screw height detection. Some methods indirectly determine the height by analyzing the screw's projected size or shadow changes in two-dimensional images. However, this method is easily affected by lighting conditions, screw surface reflection, and subtle differences in screw shape, resulting in insufficient measurement accuracy and the inability to directly obtain the screw's true three-dimensional height information. Other methods attempt to obtain depth information using 3D scanning equipment, but these often require complex calibration processes and high equipment costs.

[0004] In addition, some solutions attempt to use 3D laser profilometers for automated inspection. However, in practical applications, due to the small material and height differences between the screw cap and the surrounding injection molded parts, the screw edge in the depth map (3D) often appears blurred, resulting in insufficient positioning accuracy. Furthermore, the minute surface deformation and shrinkage of the injection molded parts during cooling can lead to inconsistent reference surface heights, further increasing inspection errors.

[0005] Chinese patent CN116109620A discloses an image detection method, apparatus, and device for battery sealing nails. The method includes: acquiring a three-dimensional image of the battery sealing nail, cropping it into a first image region and a second image region, and acquiring a first reference height; based on the first reference height, acquiring a third image region within the first image region, and the first center coordinates of the third image region; based on the first center coordinates and the diameter of the battery sealing nail, acquiring a fourth image region; based on the fourth and third image regions, acquiring a fifth image region, and a second reference height; based on the second reference height and the third image region, acquiring a sixth image region, and the second center coordinates and a third reference height of the sixth image region; and based on the first and second center coordinates, and the first and third reference heights, acquiring the positional deviation and height deviation of the battery sealing nail, respectively. This application improves the detection efficiency of the welding quality of sealing nails on battery casings.

[0006] Although the above-mentioned three-dimensional imaging technology has enabled the automated detection of battery sealing nails and improved detection efficiency compared with traditional methods, in practical applications, due to the limitations of the optical principle of 3D scanning equipment, in the edge area of ​​the object, especially when the material or reflectivity of the measured object (such as the sealing nail) and the background (such as the battery casing) are significantly different, the edge of the depth map often becomes blurred, data is missing or noise increases. This can easily lead to deviations when extracting the contour of the sealing nail and fitting the center coordinates, thus affecting the accuracy of position detection.

[0007] Furthermore, a reference height is calculated by selecting an annular area around the sealing pin. However, in actual production environments, such as injection-molded battery casings, the surface may experience minor deformations or depressions due to factors such as cooling shrinkage, internal stress, or process overflow. If the reference area happens to be located in these uneven areas, the obtained second reference height itself will be inaccurate, and the height deviation calculated based on this reference will naturally have a large error, leading to a decrease in the reliability of the test results.

[0008] Therefore, there is an urgent need for a screw height detection method, terminal equipment, and computer-readable storage medium that can overcome the influence of depth map edge blurring and effectively avoid interference from reference surface deformation.

[0009] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention

[0010] This invention proposes a screw height detection method, terminal device, and computer-readable storage medium, aiming to solve the problems of poor positioning accuracy caused by blurred edges of depth maps and reference deviation caused by surface deformation of injection molded parts in existing screw height detection methods.

[0011] To achieve the above objectives, the present invention proposes a screw height detection method, comprising the following steps; S110. Acquire imaging data of the product under test, wherein the imaging data includes a brightness map and a depth map; S120. On the brightness map, the area containing the screw cap is initially located to obtain the initial detection area; S130. Within the initial detection area, feature extraction and fitting are performed based on the brightness map to obtain the two-dimensional precise position information of the screw cap. Based on the two-dimensional precise position information, the first height data of the top surface of the screw cap is obtained from the corresponding position of the depth map. S140. On the depth map, a ring-shaped dynamic reference region is generated around the two-dimensional precise position of the screw cap, and the second height data of the dynamic reference region is obtained. S150. Calculate the difference between the first height data and the second height data, and determine whether the height of the screw is qualified based on the difference.

[0012] Preferably, step S120, the step of preliminary positioning on the brightness map, includes: The brightness map is subjected to histogram equalization to enhance contrast; Based on preset screw specifications, a region of interest is defined on the processed brightness map as the initial detection region.

[0013] Preferably, in step S120, obtaining the precise two-dimensional position information of the screw cap includes: Within the initial detection area, subpixel-level edge detection is performed to obtain the edge point set of the screw cap; Perform a circle fitting on the set of edge points to obtain the fitted center coordinates and fitted radius of the outer circle of the screw cap; Based on the fitted circle center coordinates and the fitted radius, a fine detection area is determined to represent the top surface of the screw cap.

[0014] Preferably, the fine detection area is specifically: Using the center of the fitted circle as the center and a value smaller than the fitted radius as the radius, a circular region is constructed as the fine detection region; Alternatively, a ring-shaped region with an inner diameter smaller than the fitting radius and an outer diameter equal to or smaller than the fitting radius can be constructed as the fine detection region, centered on the fitting circle.

[0015] Preferably, in step S130, obtaining the first height data from the depth map specifically involves: extracting the depth values ​​of all pixels in the depth map that completely correspond to the fine detection area, and calculating their arithmetic mean as the first height data.

[0016] Preferably, in step S140, the dynamic reference area is an annular reference band with an inner diameter larger than the radius of the screw cap, so as to avoid the deformation or overflow area around the screw caused by the process.

[0017] Preferably, the step of obtaining the second height data of the dynamic reference area includes: Extract the depth values ​​of all pixels within the dynamic reference region; The extracted depth values ​​are processed by median filtering to remove outlier noise. Calculate the arithmetic mean of the remaining depth values ​​after filtering, and use it as the second height data.

[0018] As a preferred embodiment, a terminal device is characterized by comprising a processor, a memory, and an image sensor; The memory stores computer programs; The image sensor is used to acquire imaging data of the product under test; The processor is used to execute the computer program to implement the screw height detection method as described in any one of claims 1 to 7.

[0019] A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements the screw height detection method as described in any one of claims 1 to 7.

[0020] The beneficial effects of the technical solution of this invention are as follows: This method combines the precise positioning capabilities of brightness maps with the direct height measurement capabilities of depth maps. It performs accurate two-dimensional identification and positioning of screws on the brightness map, and then obtains the true three-dimensional height information on the depth map, avoiding the limitations of traditional two-dimensional detection methods. This multi-source data fusion approach significantly improves detection accuracy and anti-interference capabilities.

[0021] By generating a "ring-shaped dynamic reference area" on the depth map and setting its inner diameter to be larger than the radius of the screw cap, the deformation, burrs, or overflow areas around the screw caused by the process can be effectively avoided, thereby obtaining purer and more accurate reference height data and ensuring the accuracy of the screw's relative height measurement.

[0022] By enhancing the contrast of the luminance map through histogram equalization, and utilizing techniques such as sub-pixel edge detection and circle fitting, the positioning of the screw caps becomes more precise, adapting to variations in lighting conditions and screw surface characteristics. Simultaneously, the establishment of a dynamic reference area improves adaptability to different screw sizes and installation environments.

[0023] The screw height is determined by calculating the difference between the top surface height of the screw cap (first height data) and the height of the dynamic reference area (second height data), eliminating systematic errors caused by overall workpiece position offset or uneven measurement platform, and achieving more reliable relative height measurement. Attached Figure Description

[0024] Figure 1 This is a flowchart illustrating the screw height detection method of the present invention. Figure 2 This is a brightness diagram of the plastic housing component of the pan head screw in the screw height detection method of the present invention; Figure 3 This is a depth diagram of the pan head screw plastic housing component in the screw height detection method of the present invention; Figure 4 This is an initial detection area diagram of the pan head screw plastic housing component in the screw height detection method of the present invention; Figure 5 This is a schematic block diagram of the internal structure of the terminal device of the present invention.

[0025] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0026] The solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0027] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.

[0028] It should also be noted that when a component is described as "fixed to" or "set on" another component, it can be directly on the other component or there may be an intervening component present. When a component is described as "connected to" another component, it can be directly connected to the other component or there may be an intervening component present.

[0029] Furthermore, descriptions using terms such as "first" and "second" in this invention are for descriptive purposes only (e.g., to distinguish identical or similar elements) and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" and "second" may explicitly or implicitly include at least one of those features. Additionally, technical solutions from different embodiments can be combined with each other, but only if they are feasible for those skilled in the art. If a combination of technical solutions is contradictory or impossible to implement, such a combination should be considered nonexistent and not within the scope of protection claimed by this invention.

[0030] See Figure 1 This invention provides a method for detecting screw height, comprising the following steps: S110. Obtain imaging data of the product under test, wherein the imaging data includes a brightness map and a depth map.

[0031] In one embodiment, an imaging device equipped with binocular stereo vision, structured light scanning, or Time-of-Flight (ToF) technology, such as a depth camera or a 3D scanner, can be used to scan or photograph the product under test with screws, thereby simultaneously obtaining a two-dimensional intensity map and a three-dimensional depth map of the product.

[0032] The brightness map records visual information such as surface texture and color of the object under test, typically a grayscale or color image. The depth map records the distance information between each point on the surface of the object and the imaging device; the grayscale value or numerical value of each pixel represents the depth value of that point, thus constructing three-dimensional spatial information. Assuming that screws 110 are installed on the product under test 100, the screw cap 120 is the key detection target of this invention. This step ensures the multi-dimensional data foundation required for subsequent analysis.

[0033] S120. On the brightness map, the area containing the screw cap is initially located to obtain the initial detection area.

[0034] In one embodiment, since the screw cap has obvious visual characteristics on the brightness map, such as shape, color, or texture contrast, the specific steps include: Histogram equalization is performed on the brightness map 200 to expand the grayscale range of the image, making the boundary between the screw cap and the background in the image clearer, thereby enhancing the image contrast and facilitating subsequent feature extraction.

[0035] Based on preset screw specification parameters (such as the expected size range of screw heads, possible colors, etc.), a region of interest (ROI) is defined on the brightness map after histogram equalization as the initial detection area. The preset parameters can be calibrated and configured during equipment installation or product changeover to help the system quickly filter out areas that may contain screw heads and exclude irrelevant backgrounds.

[0036] For example, a line laser 3D profilometer with a resolution of 1280×1024 pixels is used as the imaging device. The plastic housing component equipped with M3 pan head screws is fixed to the inspection fixture, and scanning is triggered. After the device scans once along the X-axis, it simultaneously outputs two aligned images: Brightness map: An 8-bit grayscale image of 1280×1024 pixels, with pixel values ​​ranging from 0 to 255, reflecting the reflectivity of the product surface. For example... Figure 2 As shown, the screw cap, due to its metal material, appears as a bright circular area in the image, which contrasts sharply with the dark plastic background 221.

[0037] Depth map: A 16-bit image of 1280×1024, where each pixel value represents the vertical distance (Z value) from that point to the sensor plane, in micrometers (μm). For example... Figure 3 As shown, the top surface 220 of the screw cap has a slight protrusion relative to the surrounding product surface 230.

[0038] Histogram equalization was performed on the original brightness map to enhance contrast. Before processing, the image grayscale was mainly distributed between 50-180; after processing, the grayscale range expanded to 10-245, significantly improving the distinction between the screw cap area (bright area) and the background (dark area). Based on the known fixture positioning tolerances and the nominal diameter of the screw cap, a rectangular region of interest (ROI) was pre-defined in the center of the image as the initial detection area. See [link to relevant documentation] Figure 4 .

[0039] S130. Within the initial detection area, feature extraction and fitting are performed based on the brightness map to obtain the two-dimensional precise position information of the screw cap; according to the two-dimensional precise position information, the first height data of the top surface of the screw cap is obtained from the corresponding position of the depth map.

[0040] After obtaining the initial detection area, this step utilizes the high resolution and rich texture information of the brightness map to accurately locate the screw cap in two dimensions, and combines this with the depth map to obtain the specific height of the top surface of the screw cap. Specifically, obtaining the precise two-dimensional position information of the screw cap includes: Within the initial detection area, edge detection operators such as Canny, Sobel, or Laplacian are used, and sub-pixel edge detection based on moments is used to obtain the sub-pixel precision point set of the screw cap edge.

[0041] Algorithms such as least squares, Random Sample Consensus (RANSAC), or Hough transform are used to perform circle fitting on the acquired sub-pixel edge point set. Since the screw cap is usually circular or approximately circular, the precise center coordinates (x1, y1) and fitting radius R1 of its outer circle can be obtained through circle fitting. These precise center coordinates (x1, y1) and fitting radius R1 can be represented as the core of the screw cap's precise two-dimensional position information.

[0042] Based on the precise center coordinates and the fitted radius, a fine detection area is further determined to characterize the flat area on the top of the screw cap.

[0043] In one preferred embodiment, to avoid the influence of chamfers or minor defects on the edge of the screw cap, a circular area is defined as the fine detection area, centered on the precise center coordinates (x1, y1) and with a preset radius R2 that is slightly smaller than the fitted radius R1.

[0044] In another preferred embodiment, an annular region with a common center at precise center coordinates (x1, y1), an inner diameter of R2, and an outer diameter equal to or slightly less than R1 can be constructed as the fine detection region. The value of R2 can be obtained through experimental calibration based on the actual design dimensions and chamfer size of the screw head. For example, for an M3 pan head screw, R2 can be set to 0.85 × R1 to avoid extracting the depth value of any chamfer, curvature, or irregular areas that may exist on the edge of the screw head, ensuring that the height of the flat top surface area of ​​the screw head is obtained.

[0045] Furthermore, after determining the fine detection area, the first height data of the top surface of the screw cap is extracted from the corresponding position in the depth map based on the pixel coordinate range of the fine detection area. Specifically, the depth values ​​(i.e., height values) of all pixels in the depth map that completely correspond to the fine detection area are extracted, and the arithmetic mean of these depth values ​​is calculated as the first height data. Taking the average helps to eliminate noise that may exist in individual pixels and improves the stability of the data.

[0046] In one preferred embodiment, obtaining the first height data specifically includes: mapping the coordinates of the fine detection area (such as a circular area) to the same position on the depth map; reading the depth values ​​of all points in the area pixel by pixel; performing statistical processing on the depth values ​​in the area, and calculating their arithmetic mean as the first height data Hs.

[0047] For example, for the aforementioned M3 pan head screw, its precise center coordinates are obtained as (700, 550) after circle fitting, and the fitting radius R1 is 55 pixels. According to the preferred embodiment, R2 is set to 0.85 × R1 ≈ 47 pixels. A circular fine detection area is defined with (700, 550) as the center and 47 pixels as the radius. Within this area, the depth values ​​of all pixels are extracted from the depth map. For example, a total of 6940 effective depth points are extracted, and their arithmetic mean is calculated to obtain the first height data Hs = 15250 μm.

[0048] S140. On the depth map, a ring-shaped dynamic reference region is generated around the two-dimensional precise position of the screw cap, and the second height data of the dynamic reference region is obtained.

[0049] In one preferred embodiment, to obtain the height difference of the screw relative to its plane, the annular dynamic reference region can be centered on the precise two-dimensional position of the screw cap (i.e., the fitted center). It is annular in shape, and its inner diameter is larger than the radius of the screw cap.

[0050] For example, using the precise center coordinates (x1, y1) obtained in step S130 as the center, an annular region is defined on the depth map as a dynamic reference region. The inner diameter Ri of the annular region must be larger than the screw cap fitting radius R1 obtained in step S130 to ensure complete avoidance of hot melt overflow, plastic deformation zones, or uneven areas around the screw that may occur during screw installation. The outer diameter Ro of the annular region is set according to the size of the available flat area on the product surface to ensure sufficient sampling points for stable calculation of the reference height.

[0051] Furthermore, in a preferred embodiment, the inner diameter Ri of the annular region can be 1.2×R1 to 1.5×R1, and the outer diameter Ro of the annular region can be 1.8×R1 to 2.5×R1.

[0052] The acquisition of the second height data of the dynamic reference region specifically includes the following steps: Extract the depth values ​​of all pixels within the annular dynamic reference area; filter the extracted depth value set to remove outliers, for example, by using median filtering or mean shift algorithm; and calculate the arithmetic mean of the remaining depth values ​​after filtering to obtain the second height data Hr.

[0053] For example, continuing with the precise center coordinates (700, 550) obtained in step S130 as the center, and according to the parameter range set in the preferred embodiment, an inner diameter Ri = 1.2 × R1 = 1.2 × 55 = 66 pixels and an outer diameter Ro = 2.0 × R1 = 2.0 × 55 = 110 pixels are selected. A ring-shaped dynamic reference region with an inner diameter of 66 pixels and an outer diameter of 110 pixels is defined on the depth map.

[0054] All depth points within the annular region were extracted from the depth map (e.g., a total of 28,600 valid depth points were extracted). To obtain a stable benchmark unaffected by local minor tilts, the least squares method was used to perform plane fitting on these three-dimensional points, resulting in an optimally fitted plane characterizing the local product surface. By calculating the height value corresponding to this fitted plane at the precise center coordinates (700, 550) of the screw cap, the second height data Hr = 15000 μm was obtained.

[0055] S150. Calculate the difference Hr between the first height data Hs and the second height data Hr, and determine whether the height of the screw is qualified based on the difference.

[0056] Specifically, the difference between the two data points is calculated using the relative height of the screw, ΔH = first height data Hs - second height data Hr. This difference represents the actual height of the top of the screw head relative to its surrounding reference plane.

[0057] Where H represents the protrusion height of the screw. A positive value of H indicates that the top surface of the screw head is higher than the product surface, meaning the screw is protruding; a negative value of H indicates that the top surface of the screw head is lower than the product surface, meaning the screw is recessed or sunken. The absolute value of H represents the actual height or depth of the screw relative to the product surface.

[0058] The difference is compared with a preset acceptable height range. If the preset lower limit is less than or equal to the preset upper limit, the screw height is deemed acceptable. The preset lower limit is set in advance based on product design drawings or assembly process requirements, and is generally the minimum and maximum allowable screw protrusion height.

[0059] If ΔH < preset lower limit or ΔH > preset upper limit, then the height of the screw is determined to be unqualified.

[0060] Furthermore, based on the judgment result, a corresponding detection signal is output. If the result is qualified, the screw is marked green on the host computer software interface, and the "qualified" status is recorded. If the result is unqualified, it is marked red, an audible and visual alarm signal is issued, and the "unqualified" status and the specific measurement value H are recorded. Through this relative height calculation method, this method naturally eliminates systematic errors caused by the overall Z-axis position deviation of the product under test on the detection platform or the imperfect levelness of the detection platform itself, thereby ensuring the accuracy and reliability of screw height detection.

[0061] In summary, this invention combines the precise positioning capability of a brightness map with the direct height measurement capability of a depth map. It performs precise two-dimensional identification and positioning of screws on the brightness map, and then obtains accurate three-dimensional height information on the depth map, avoiding the limitations of traditional two-dimensional detection methods. This multi-source data fusion approach significantly improves detection accuracy and anti-interference capability.

[0062] By generating a "ring-shaped dynamic reference area" on the depth map and setting its inner diameter to be larger than the radius of the screw cap, the deformation, burrs, or overflow areas around the screw caused by the process can be effectively avoided, thereby obtaining purer and more accurate reference height data and ensuring the accuracy of the screw's relative height measurement.

[0063] By enhancing the contrast of the luminance map through histogram equalization, and utilizing techniques such as sub-pixel edge detection and circle fitting, the positioning of the screw caps becomes more precise, adapting to variations in lighting conditions and screw surface characteristics. Simultaneously, the establishment of a dynamic reference area improves adaptability to different screw sizes and installation environments.

[0064] The screw height is determined by calculating the difference between the top surface height of the screw cap (first height data) and the height of the dynamic reference area (second height data), eliminating systematic errors caused by overall workpiece position offset or uneven measurement platform, and achieving more reliable relative height measurement.

[0065] Furthermore, this application embodiment also provides a terminal device, the internal structure of which can be as follows: Figure 5 As shown, the terminal device includes a processor, memory, communication interface, and database connected via a system bus. The processor provides computing and control capabilities. The terminal device's memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The terminal device's database stores data called by the computer programs. The terminal device's communication interface is used for data communication with external terminals. The terminal device's input device receives signals from external devices. When the computer program is executed by the processor, it implements a fuel pump idling protection method as described in the above embodiment.

[0066] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the solution of this application, and does not constitute a limitation on the terminal device to which the solution of this application is applied.

[0067] Furthermore, this application also proposes a readable storage medium comprising a computer program, which, when executed by a processor, implements the steps of the fuel pump idling protection method described in the above embodiments. It is understood that the readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.

[0068] Those skilled in the art will understand that implementing all or part of the processes in the above-described fuel pump idling protection methods can be accomplished by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above-described fuel pump idling protection methods. Any references to memory, storage, databases, or other media used in this application and in the embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-speed SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0069] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or fuel pump idling protection method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, apparatus, article, or fuel pump idling protection method. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or fuel pump idling protection method that includes that element.

[0070] The above are only some or preferred embodiments of the present invention. Neither the text nor the drawings should limit the scope of protection of the present invention. All equivalent structural transformations made using the content of the present invention's specification and drawings under the overall concept of the present invention, or direct / indirect applications in other related technical fields, are included within the scope of protection of the present invention.

Claims

1. A method for detecting screw height, characterized in that, Includes the following steps; S110. Acquire imaging data of the product under test, wherein the imaging data includes a brightness map and a depth map; S120. On the brightness map, the area containing the screw cap is initially located to obtain the initial detection area; S130. Within the initial detection area, feature extraction and fitting are performed based on the brightness map to obtain the two-dimensional precise position information of the screw cap. Based on the two-dimensional precise position information, the first height data of the top surface of the screw cap is obtained from the corresponding position of the depth map. S140. On the depth map, a ring-shaped dynamic reference region is generated around the two-dimensional precise position of the screw cap, and the second height data of the dynamic reference region is obtained. S150. Calculate the difference between the first height data and the second height data, and determine whether the height of the screw is qualified based on the difference.

2. The screw height detection method according to claim 1, characterized in that, In step S120, the preliminary positioning step on the brightness map includes: The brightness map is subjected to histogram equalization to enhance contrast; Based on preset screw specifications, a region of interest is defined on the processed brightness map as the initial detection region.

3. The screw height detection method according to claim 2, characterized in that, In step S120, obtaining the precise two-dimensional position information of the screw cap includes: Within the initial detection area, subpixel-level edge detection is performed to obtain the edge point set of the screw cap; Perform a circle fitting on the set of edge points to obtain the fitted center coordinates and fitted radius of the outer circle of the screw cap; Based on the fitted circle center coordinates and the fitted radius, a fine detection area is determined to represent the top surface of the screw cap.

4. The screw height detection method according to claim 3, characterized in that, The specific fine detection area is: Using the center of the fitted circle as the center and a value smaller than the fitted radius as the radius, a circular region is constructed as the fine detection region; Alternatively, a ring-shaped region with an inner diameter smaller than the fitting radius and an outer diameter equal to or smaller than the fitting radius can be constructed as the fine detection region, centered on the fitting circle.

5. The screw height detection method according to claim 1, characterized in that, In step S130, obtaining the first height data from the depth map specifically involves: extracting the depth values ​​of all pixels in the depth map that completely correspond to the fine detection area, and calculating their arithmetic mean as the first height data.

6. The screw height detection method according to claim 1, characterized in that, In step S140, the dynamic reference area is an annular reference band with an inner diameter larger than the radius of the screw cap, so as to avoid the deformation or overflow area around the screw caused by the process.

7. The screw height detection method according to claim 6, characterized in that, The step of obtaining the second height data of the dynamic reference area includes: Extract the depth values ​​of all pixels within the dynamic reference region; The extracted depth values ​​are processed by median filtering to remove outlier noise. Calculate the arithmetic mean of the remaining depth values ​​after filtering, and use it as the second height data.

8. A terminal device, characterized in that, This includes the processor, memory, and image sensor; The memory stores computer programs; The image sensor is used to acquire imaging data of the product under test; The processor is used to execute the computer program to implement the screw height detection method as described in any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the screw height detection method as described in any one of claims 1 to 7.