Method and jig for detecting flatness of metal piece

Through laser stripe emission and image processing technology, combined with deep learning, efficient and accurate detection of the flatness of metal parts is achieved, solving the problems of low efficiency and insufficient precision in traditional methods and providing reliable numerical evaluation.

CN120740503APending Publication Date: 2025-10-03SHENZHEN BAOTONG HARDWARE & PLASTIC PRODUCTS CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510835045.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-20
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

Traditional metal part flatness detection methods have problems such as contact measurement that easily causes surface damage, low detection efficiency, and limited accuracy and consistency.

Method used

It adopts laser stripe emission, industrial camera acquisition and image processing technology, combined with deep learning, to achieve non-contact high-precision detection by generating laser stripes, receiving reflected light, image conversion and flatness quantification.

Benefits of technology

It improves detection efficiency and accuracy, avoids surface damage, provides scientific numerical flatness indicators, and supports intelligent quality control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120740503A_ABST
    Figure CN120740503A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of flatness detection of metal parts, and discloses a method and a jig for detecting the flatness of a metal part, and the method comprises the steps: generating laser stripes by using a laser stripe emitter for the surface of a steel sheet being detected, and irradiating the surface of the steel sheet at a fixed incident angle; receiving the reflected laser fringes by using an industrial camera; according to the received laser stripes, a flatness judgment strategy is executed, and whether the surface of the steel sheet is flat or not is judged; if it is judged that the surface of the steel sheet is uneven, a color image of laser stripes shot by the industrial camera is obtained, and the color image is converted into a grayscale image; obtaining a denoised grayscale image, executing an edge gradient calculation strategy, calculating the gradient feature of each pixel, and obtaining a binary image of the laser stripes; and executing a flatness quantification strategy according to the binary image of the laser stripe, and quantifying a flatness index into regression data. And the efficiency and the precision of detecting the flatness of the metal piece are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of flatness detection of metal parts, and in particular to a method and a jig for detecting the flatness of metal parts. Background Art

[0002] The flatness of metal parts is a crucial parameter for evaluating their quality, particularly in the manufacturing of electronic devices, where it directly impacts product assembly precision and functional stability. For example, the front steel sheet of a mobile phone, a crucial component of precision electronics, has extremely high flatness requirements. Uneven surfaces can lead to poor assembly, insufficient sealing, and potentially affect the proper functioning of other components.

[0003] Traditional flatness inspection methods rely primarily on mechanical contact measurement, such as using contact gauges or micrometers. While simple, these methods have significant limitations, including the potential for surface damage, low inspection efficiency, and limited data accuracy and consistency.

[0004] The present invention provides a method and a fixture for detecting the flatness of metal parts, which combine laser stripe emission, industrial camera acquisition, image processing and deep learning technology to address the shortcomings of the existing technology and improve detection efficiency and accuracy. Summary of the Invention

[0005] The present invention provides a method and system for detecting the flatness of a metal part, which facilitates solving the problems mentioned in the above background technology.

[0006] In a first aspect, the present application provides a method for detecting the flatness of a metal part, which adopts the following technical solution: A method for detecting the flatness of a metal part, comprising: Place the mobile phone front shell steel sheet parallel to the horizontal plane, and perform flatness inspection on the upper and lower surfaces of the mobile phone front shell steel sheet respectively, specifically: By placing the phone's front steel cover parallel to a horizontal surface, a stable and consistent testing environment is ensured. This method reduces errors caused by tilt or positional offset by using a physical reference surface. Separately inspecting the upper and lower surfaces allows for a comprehensive assessment of the workpiece's flatness, avoiding the deviations that can occur with single-sided inspection. Separate inspection of the upper and lower surfaces further improves inspection accuracy by preventing light reflections or interference. This process ensures a scientifically sound starting point for inspection, laying the foundation for subsequent precise measurement.

[0007] For the steel sheet surface being inspected, a laser stripe emitter is used to generate laser stripes and illuminate the steel sheet surface at a fixed incident angle; By using a laser stripe emitter to generate laser stripes, the surface flatness of steel sheets can be intuitively reflected. The high brightness and precision of the laser stripes enable them to be clearly projected onto the steel surface. By illuminating at a specific angle of incidence, they can effectively capture even subtle surface variations. Compared to traditional light sources, laser stripes, with their high directivity and stability, reduce the impact of ambient light interference, thereby ensuring high detection sensitivity.

[0008] An industrial camera is used to receive the reflected laser stripes; By using an industrial camera to receive the reflected laser stripes, surface feature information can be efficiently acquired. The high resolution and fast response time of industrial cameras enable them to capture clear and detailed images of the laser stripes. Industrial cameras also use bandpass filters to filter out ambient light interference, ensuring the purity and consistency of the collected data. This method improves inspection efficiency and accuracy compared to human observation or low-end camera equipment.

[0009] According to the received laser stripes, the flatness determination strategy is executed to determine whether the surface of the steel sheet is flat; If the surface of the steel sheet is determined to be uneven, a color image of the laser stripes captured by an industrial camera is obtained and the color image is converted into a grayscale image; Perform Gaussian filtering noise reduction strategy on grayscale images to reduce the noise of grayscale images; Obtaining a grayscale image after noise reduction, executing an edge gradient calculation strategy to calculate the gradient features of each pixel, wherein the gradient features include gradient magnitude and gradient direction; Set the image conversion threshold; Compare the gradient magnitude of each pixel to the image conversion threshold; If the gradient amplitude ≧ the image conversion threshold, the pixel value is set to 1; If the gradient amplitude ≦ the image conversion threshold, the pixel value is set to 0 to obtain a binary image of the laser stripes; Generating a binary image further simplifies image feature processing. Binarization, comparing the pixel gradient magnitude to a threshold, clearly distinguishes streak regions from background regions, allowing subsequent analysis to focus on important information. This significantly reduces data redundancy, speeding up subsequent quantification calculations and improving the robustness of streak detection.

[0010] According to the binary image of laser stripes, a flatness quantification strategy is implemented to quantify the flatness index into regression data.

[0011] Preferably, executing a flatness determination strategy based on the received laser stripes to determine whether the surface of the steel sheet is flat includes: The light formed by the laser stripes on the surface of the steel sheet is recorded as the detection light; A laser stripe emitter and an industrial camera are placed on both sides of the detection light; The horizontal distance between the laser stripe emitter and the detection light is recorded as the first distance; The vertical distance from the laser stripe emitter to the surface of the steel sheet is recorded as the second distance; Then, the horizontal distance between the industrial camera and the detection light is set to the first distance; Set the vertical distance between the industrial camera and the detection light to the second distance; When using an industrial camera to receive reflected laser stripes, measure the horizontal distance between the industrial camera and the detection light, which is recorded as the third distance; Determine whether the third distance is equal to the first distance; If the third distance is equal to the first distance, the surface of the steel sheet is flat; If the third distance is not equal to the first distance, the surface of the steel sheet is uneven.

[0012] Preferably, converting the color image into a grayscale image includes: For any pixel in a color image, execute the following formula to calculate the grayscale value of the pixel: Grayscale value = 0.299·R + 0.587·G + 0.114·B, where R, G, and B are the red, green, and blue channel values ​​of the pixel, respectively.

[0013] Converting color images to grayscale simplifies data processing and improves computational efficiency. While the three-channel information contained in color images can increase computational complexity during the inspection process, grayscale images retain the core brightness information in a single-channel format, making subsequent algorithm processing more direct and efficient. Furthermore, grayscale images more intuitively demonstrate the brightness variations of the laser stripes, facilitating accurate analysis of surface flatness.

[0014] Preferably, performing a Gaussian filtering noise reduction strategy on the grayscale image to reduce the noise of the grayscale image includes: Establish a two-dimensional coordinate system with the midpoint of the grayscale image as the origin; Perform noise reduction on each pixel in the grayscale image, and record the pixel value after noise reduction as I(x, y), where x is the horizontal coordinate of the pixel in the two-dimensional coordinate system, and y is the vertical coordinate of the pixel in the two-dimensional coordinate system; Among them, σ is the parameter that controls the filter strength, and k is the window size of the filter kernel.

[0015] Gaussian filtering can effectively reduce random noise in images and improve image quality. Gaussian filtering smoothes images while preserving edge features as much as possible, minimizing interference while maintaining key information. Especially for laser streak images, Gaussian filtering, through its gentle weight distribution, can reduce the interference of high-frequency noise on edge detection, thereby improving the accuracy of subsequent gradient calculations.

[0016] Preferably, the step of obtaining the grayscale image after noise reduction and executing the edge gradient calculation strategy to calculate the gradient feature of each pixel includes: The gradient features include gradient amplitude and gradient direction, which are calculated as follows: The pixel value I(x, y) of each pixel in the denoised grayscale image is expressed as a two-dimensional matrix A; Use the Sobel operator to calculate the gradient G of the grayscale image in the x-axis direction x ; Get the gradient index G of each pixel in the x-axis direction x (x, y); Use the Sobel operator to calculate the gradient G of the grayscale image in the y-axis direction y ; Among them, * represents the convolution operation, and the gradient index G of each pixel in the y-axis direction is obtained. y (x, y); Calculate the gradient magnitude for each pixel Calculate the gradient direction for each pixel Suppress non-edge pixels, specifically: For each pixel, according to its gradient direction θ(x, y), find the two neighboring points closest to the gradient direction, which are recorded as the first neighbor and the second neighbor respectively; Compare the magnitude relationship between the gradient amplitudes of the pixel, the first neighboring point, and the second neighboring point; If the gradient amplitude of the pixel is the largest, the gradient amplitude of the pixel is retained; If the gradient magnitude of the pixel is not the maximum, the gradient magnitude of the pixel is set to 0.

[0017] Using an edge gradient calculation strategy, the precise outline of laser streaks in grayscale images can be extracted. The gradient magnitude reflects the intensity of the image brightness change, while the gradient direction indicates the direction of the change. The combination of the two provides a comprehensive description of the streak characteristics. Using the Sobel operator effectively detects edges while suppressing noise interference. Compared to simple brightness differences, gradient calculation provides more accurate streak location and shape by leveraging multidimensional information.

[0018] Preferably, the method of executing a flatness quantification strategy based on the binary image of the laser stripes to quantify the flatness index into regression data includes: Convolution operation: in, is the i-th, j-th position value of the l-th layer convolution output feature map, k is the convolution kernel size, I (l-1) is the output feature map of the l-1 layer, K (l) is the convolution kernel weight matrix of the lth layer, b( l) is the bias of the convolution kernel of the first layer, and the size of the output feature map is calculated as: Among them, p is the number of pixels filled and s is the size of the stride.

[0019] Preferably, the method of executing a flatness quantification strategy based on the binary image of the laser stripes to quantify the flatness index into regression data includes: Get the position value of the convolution output feature map of the lth layer, and use the activation function Sigmoid to introduce nonlinearity, specifically; Get the position value of the l-th layer convolution output feature map and use the pooling pool for pooling: Pooling operation size calculation: k p is the pooling window size, s p is the pooling stride; Flatten the pooled feature map into a vector and input it into the fully connected layer; z (l) =W (l) ·a (l) +b (l) , where W (l) is the weight matrix, b (l) is the bias, z (l) is the linear output of the fully connected layer; the flatness index regression s = z (l) , and obtain the prediction results of the flatness index.

[0020] Flatness quantification strategies can directly convert inspection results into numerical indicators, facilitating further analysis and comparison. Combining convolution operations with a deep learning framework extracts high-level features from fringe images, helping to capture subtle flatness variations. Using regression models to predict flatness indicators, a numerical range for surface flatness can be intuitively output, providing a scientific basis for quality control.

[0021] In a second aspect, the present application provides a jig, which adopts the following technical solution: a jig, comprising: The laser stripe emitter is composed of a line laser and a cylindrical lens, and the cylindrical lens is used to expand the laser point into stripes; The industrial camera is equipped with a bandpass filter to filter out ambient light interference; Mobile platform, used to move the steel sheet of the front shell of the mobile phone to scan the entire steel sheet surface; Light-shielding box, used to provide a detection environment.

[0022] The present invention has the following beneficial effects: 1. This method for detecting the flatness of metal parts can intuitively capture the flatness of the steel sheet surface through the generation and irradiation of laser stripes. Laser stripes have the characteristics of high directionality and high brightness, and can form clear optical features on the surface of the steel sheet. Compared with traditional point light sources, laser stripes can more comprehensively cover the detection area with their uniform stripe shape, significantly improving detection efficiency. Irradiation at a specific incident angle can keenly perceive subtle surface deformations through changes in reflection angle, thereby realizing sub-micron surface change detection. This method not only avoids the damage that may be caused to the surface by traditional contact measurement, but also greatly improves the sensitivity and reliability of the measurement through high-precision optical feature capture.

[0023] 2. This method for detecting the flatness of metal parts can effectively simplify the data processing process by converting color images into grayscale images while retaining key image brightness information. In flatness detection, although the RGB three channels of the color image provide rich color information, they are not necessary for laser stripe detection and increase computational complexity. Grayscale images compress the data volume to one-third of the color image in a single-channel form, thereby significantly improving computational efficiency. This method can also more directly reflect the brightness changes of the laser stripes through grayscale values, making edge detection more efficient and accurate. Compared with directly processing color images, the converted grayscale images not only increase processing speed but also reduce algorithm complexity, laying a solid foundation for subsequent Gaussian filtering and gradient calculation.

[0024] 3. This method for detecting the flatness of metal parts uses a flatness quantification strategy to convert flatness test results into intuitive numerical indicators, greatly enhancing the analytical and application value of the data. Compared to traditional qualitative flatness assessment methods, this quantification strategy extracts high-order features from laser stripes through convolution operations, capturing small but important flatness differences. After feature extraction and nonlinear activation, a regression model is used to further optimize the prediction results, making the output flatness indicator more accurate and scientific. This quantitative data can not only serve as a quality assessment standard, but can also be connected to production control systems through automated output, enabling intelligent quality control and production optimization.

[0025] 4. This method for detecting the flatness of metal parts can accurately extract the edge features of laser stripes in the grayscale image after noise reduction through the edge gradient calculation strategy, thereby realizing a detailed analysis of the surface flatness of the steel sheet. The gradient calculation is combined with the Sobel operator to obtain the gradient amplitude and gradient direction of each pixel by calculating the brightness changes in the x-axis and y-axis directions respectively. These gradient features can fully describe the shape and position of the stripes, providing a strong basis for the quantification of surface deformation. In addition, the non-edge suppression method is used to remove non-critical edge information by retaining the pixels with the largest gradient amplitude, making the edges of the laser stripes clearer. Compared with the traditional brightness difference method, the edge gradient calculation greatly improves the detection accuracy by integrating the direction and amplitude information, especially in the identification of small surface defects.

[0026] 5. This method for detecting the flatness of metal parts uses Gaussian filtering to reduce noise, effectively removing random noise from grayscale images while preserving the image's edge features. This method smoothes high-frequency noise in the image by constructing a filter kernel with uniform weight distribution, without disrupting the structural characteristics of the laser stripes. Compared to other simple filtering methods, Gaussian filtering emphasizes the naturalness of the smoothing effect and is particularly suitable for industrial inspection scenarios where ambient light interference or sensor noise may be present. The denoised grayscale image significantly improves the contrast and clarity of the stripes, laying a high-quality input foundation for subsequent edge detection. Furthermore, Gaussian filtering adapts to the needs of different inspection conditions through adjustable filter strength parameters, thereby improving the adaptability and robustness of flatness detection in complex scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 Schematic diagram of the process of the present invention.

[0028] Figure 2 It is a structural schematic diagram of the present invention. DETAILED DESCRIPTION

[0029] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0030] Example 1, refer to Figure 1 , a method for detecting the flatness of a metal part, comprising: Place the mobile phone front shell steel sheet parallel to the horizontal plane, and perform flatness inspection on the upper and lower surfaces of the mobile phone front shell steel sheet respectively, specifically: By placing the steel sheet of the phone's front cover parallel to the horizontal plane, the standardization and consistency of the testing environment can be ensured. Parallel placement can reduce detection inaccuracies caused by angle offset or positional errors, ensuring that the laser stripes are evenly illuminated on the surface of the steel sheet. In addition, flatness inspection is performed on the upper and lower surfaces separately. By independently evaluating the flatness of each side, the overall shape information of the steel sheet can be more comprehensively captured. This method avoids defects that may be missed in single-sided inspection, improves the coverage and reliability of inspection, and provides more accurate flatness data support for the subsequent assembly of the steel sheet. This strategy effectively reduces the volatility and uncertainty of test results through standardized placement and comprehensive testing methods.

[0031] For the steel sheet surface being inspected, a laser stripe emitter is used to generate laser stripes and illuminate the steel sheet surface at a fixed incident angle; An industrial camera is used to receive the reflected laser stripes; In this embodiment, refer to Figure 2 .

[0032] By generating laser stripes through a laser stripe emitter and irradiating the steel sheet surface at an incident angle, the flatness information of the steel sheet surface can be efficiently captured. Compared with point light sources, laser stripes have higher directionality and coverage, and can directly reflect the geometric characteristics of the steel sheet surface. When the stripes illuminate the surface at a certain incident angle, the tiny bumps on the surface will cause deformation of the stripes due to the offset of the reflected light. By analyzing these deformations, it is possible to accurately determine whether the surface is flat. Compared with traditional contact measurement methods, laser stripe detection is non-contact, avoiding damage to the steel sheet surface. At the same time, through high brightness and high directionality, it ensures the resolution and accuracy of the detection results.

[0033] According to the received laser stripes, the flatness determination strategy is executed to determine whether the surface of the steel sheet is flat; If the surface of the steel sheet is determined to be uneven, a color image of the laser stripes captured by an industrial camera is obtained and the color image is converted into a grayscale image; Perform Gaussian filtering noise reduction strategy on grayscale images to reduce the noise of grayscale images; Obtain the grayscale image after noise reduction, execute the edge gradient calculation strategy, and calculate the gradient features of each pixel. The gradient features include gradient amplitude and gradient direction; Set the image conversion threshold; Compare the gradient magnitude of each pixel to the image conversion threshold; If the gradient amplitude ≧ the image conversion threshold, the pixel value is set to 1; If the gradient amplitude ≦ the image conversion threshold, the pixel value is set to 0 to obtain a binary image of the laser stripes; By generating a binary image of the laser streaks, complex grayscale information can be converted into a simple black-and-white feature map, significantly improving analysis efficiency. Binarization clearly segments the streak region by setting a threshold, removing interference from weak streaks and background noise. The binary image preserves the streak morphological characteristics in its most simplified form, providing accurate input data for subsequent flatness quantification. This strategy compresses data while simultaneously improving the contrast and clarity of the streak features, making subsequent processing more efficient and robust.

[0034] According to the binary image of laser stripes, a flatness quantification strategy is implemented to quantify the flatness index into regression data.

[0035] Based on the received laser stripes, the flatness determination strategy is executed to determine whether the steel sheet surface is flat, including: The light formed by the laser stripes on the surface of the steel sheet is recorded as the detection light; A laser stripe emitter and an industrial camera are placed on both sides of the detection light; The horizontal distance between the laser stripe emitter and the detection light is recorded as the first distance; The vertical distance from the laser stripe emitter to the surface of the steel sheet is recorded as the second distance; Then, the horizontal distance between the industrial camera and the detection light is set to the first distance; Set the vertical distance between the industrial camera and the detection light to the second distance; When using an industrial camera to receive reflected laser stripes, measure the horizontal distance between the industrial camera and the detection light, which is recorded as the third distance; Determine whether the third distance is equal to the first distance; If the third distance is equal to the first distance, the surface of the steel sheet is flat; If the third distance is not equal to the first distance, the surface of the steel sheet is uneven.

[0036] Convert a color image to a grayscale image, including: For any pixel in a color image, execute the following formula to calculate the grayscale value of the pixel: Grayscale value = 0.299·R + 0.587·G + 0.114·B, where R, G, and B are the red, green, and blue channel values ​​of the pixel, respectively.

[0037] By converting color images into grayscale images, the data processing process can be effectively simplified while retaining key brightness information. Color images contain three channels, RGB, while grayscale images use brightness synthesis to represent image information using a single channel, significantly reducing data complexity. This simplification makes subsequent image processing operations such as filtering and edge detection more efficient while reducing computing resources. Grayscale images also avoid the interference of color information, making the brightness changes of laser stripes more prominent and providing clearer input data for subsequent steps. This strategy not only improves image processing speed, but also provides a reliable foundation for high-precision stripe detection.

[0038] Perform Gaussian filtering denoising strategy on grayscale images to reduce the noise of grayscale images, including: Establish a two-dimensional coordinate system with the midpoint of the grayscale image as the origin; Perform noise reduction on each pixel in the grayscale image, and record the pixel value after noise reduction as I(x, y), where x is the horizontal coordinate of the pixel in the two-dimensional coordinate system, and y is the vertical coordinate of the pixel in the two-dimensional coordinate system; Among them, σ is the parameter that controls the filter strength, and k is the window size of the filter kernel.

[0039] Gaussian filtering for noise reduction effectively reduces random noise in grayscale images while preserving the edge features of laser streaks. By applying a weighted average to pixels, Gaussian filtering smooths out highly random noise while maintaining clarity in the image's key features. This noise reduction method is particularly well-suited for the complex optical environments of laser streak detection, eliminating errors introduced by ambient light interference or sensor instability. Furthermore, the Gaussian filter's intensity parameter is adjustable to adapt to different scenarios, thereby improving image quality and detection accuracy.

[0040] Get the grayscale image after noise reduction, execute the edge gradient calculation strategy, and calculate the gradient features of each pixel, including: the gradient features include gradient amplitude and gradient direction, and the calculation method is as follows: The pixel value I(x, y) of each pixel in the denoised grayscale image is expressed as a two-dimensional matrix A; Use the Sobel operator to calculate the gradient G of the grayscale image in the x-axis direction x ; Use the Sobel operator to calculate the gradient G of the grayscale image in the y-axis direction y ; Among them, * represents the convolution operation, and the gradient index G of each pixel in the y-axis direction is obtained. y (x, y); Calculate the gradient magnitude for each pixel Calculate the gradient direction for each pixel Suppress non-edge pixels, specifically: For each pixel, according to its gradient direction θ(x, y), find the two neighboring points closest to the gradient direction, which are recorded as the first neighbor and the second neighbor respectively; Compare the magnitude relationship between the gradient amplitudes of the pixel, the first neighboring point, and the second neighboring point; If the gradient amplitude of the pixel is the largest, the gradient amplitude of the pixel is retained; If the gradient magnitude of the pixel is not the maximum, the gradient magnitude of the pixel is set to 0.

[0041] The edge gradient calculation strategy accurately extracts the edge features of laser stripes. The Sobel operator calculates brightness changes along the x- and y-axes, obtaining the gradient amplitude and directional information for each pixel. These gradient features directly reflect the position and shape of the stripe edge. A non-edge suppression strategy retains only pixels with the largest gradient amplitude, removing irrelevant edge information and making the stripe outline clearer. This strategy significantly improves the edge detection accuracy of laser stripes by integrating directional and amplitude information, providing key data support for quantifying the surface smoothness of steel sheets.

[0042] Based on the binary image of the laser stripes, a flatness quantification strategy is implemented to quantify the flatness index into regression data, including: Convolution operation: in, is the i-th, j-th position value of the l-th layer convolution output feature map, k is the convolution kernel size, I (l-1) is the output feature map of the l-1 layer, K (l) is the convolution kernel weight matrix of the lth layer, b( l) is the bias of the convolution kernel of the first layer, and the size of the output feature map is calculated as: Among them, p is the number of pixels filled and s is the size of the stride.

[0043] Based on the binary image of the laser stripes, a flatness quantification strategy is implemented to quantify the flatness index into regression data, including: Get the position value of the convolution output feature map of the lth layer, and use the activation function Sigmoid to introduce nonlinearity, specifically; Get the position value of the l-th layer convolution output feature map and use the pooling pool for pooling: Pooling operation size calculation: k p is the pooling window size, s p is the pooling stride; Flatten the pooled feature map into a vector and input it into the fully connected layer; z (l) =W (l) ·a (l) +b( l) , where W (l) is the weight matrix, b( l) is the bias, z (l) is the linear output of the fully connected layer; the flatness index regression s = z (l) , and obtain the prediction results of the flatness index.

[0044] The flatness quantification strategy converts streak detection results into intuitive numerical data for easy analysis and application. This quantification strategy extracts key features from the streak image through convolution operations, further enhances feature representation using nonlinear activation functions, and outputs flatness metrics through fully connected layers. These numerical data accurately describe the degree of deformation on the steel sheet surface, avoiding the subjectivity and ambiguity inherent in traditional qualitative analysis. Furthermore, these metrics can be directly applied to production quality control systems, enabling intelligent assessment of steel sheet flatness.

[0045] Embodiment 2, a fixture, comprising: The laser stripe transmitter consists of a line laser and a cylindrical lens, which is used to expand the laser spot into a stripe. Industrial cameras are equipped with bandpass filters to filter out ambient light interference; Mobile platform, used to move the steel sheet of the front shell of the mobile phone to scan the entire steel sheet surface; Light-shielding box, used to provide a detection environment.

[0046] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus.

[0047] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.

Claims

1. A method for detecting the flatness of a metal part, characterized in that: include: Place the mobile phone front shell steel sheet parallel to the horizontal plane, and perform flatness inspection on the upper and lower surfaces of the mobile phone front shell steel sheet respectively, specifically: For the steel sheet surface being inspected, a laser stripe emitter is used to generate laser stripes and illuminate the steel sheet surface at a fixed incident angle; An industrial camera is used to receive the reflected laser stripes; According to the received laser stripes, the flatness determination strategy is executed to determine whether the surface of the steel sheet is flat; If the surface of the steel sheet is determined to be uneven, a color image of the laser stripes captured by an industrial camera is obtained and the color image is converted into a grayscale image; Perform Gaussian filtering noise reduction strategy on grayscale images to reduce the noise of grayscale images; Obtaining a grayscale image after noise reduction, executing an edge gradient calculation strategy to calculate the gradient features of each pixel, wherein the gradient features include gradient magnitude and gradient direction; Set the image conversion threshold; Compare the gradient magnitude of each pixel to the image conversion threshold; If the gradient amplitude ≧ the image conversion threshold, the pixel value is set to 1; If the gradient amplitude ≦ the image conversion threshold, the pixel value is set to 0 to obtain a binary image of the laser stripes; According to the binary image of laser stripes, a flatness quantification strategy is implemented to quantify the flatness index into regression data.

2. The method for detecting the flatness of a metal part according to claim 1, wherein: The flatness determination strategy is executed based on the received laser stripes to determine whether the surface of the steel sheet is flat, including: The light formed by the laser stripes on the surface of the steel sheet is recorded as the detection light; A laser stripe emitter and an industrial camera are placed on both sides of the detection light; The horizontal distance between the laser stripe emitter and the detection light is recorded as the first distance; The vertical distance from the laser stripe emitter to the surface of the steel sheet is recorded as the second distance; Then, the horizontal distance between the industrial camera and the detection light is set to the first distance; Set the vertical distance between the industrial camera and the detection light to the second distance; When using an industrial camera to receive reflected laser stripes, measure the horizontal distance between the industrial camera and the detection light, which is recorded as the third distance; Determine whether the third distance is equal to the first distance; If the third distance is equal to the first distance, the surface of the steel sheet is flat; If the third distance is not equal to the first distance, the surface of the steel sheet is uneven.

3. The method for detecting the flatness of a metal part according to claim 1, wherein: The step of converting a color image into a grayscale image comprises: For any pixel in a color image, execute the following formula to calculate the grayscale value of the pixel: Grayscale value = 0.299·R + 0.587·G + 0.114·B, where R, G, and B are the red, green, and blue channel values ​​of the pixel, respectively.

4. The method for detecting the flatness of a metal part according to claim 2, wherein: The step of performing a Gaussian filtering noise reduction strategy on the grayscale image to reduce the noise of the grayscale image includes: Establish a two-dimensional coordinate system with the midpoint of the grayscale image as the origin; Perform noise reduction on each pixel in the grayscale image, and record the pixel value after noise reduction as I(x, y), where x is the horizontal coordinate of the pixel in the two-dimensional coordinate system, and y is the vertical coordinate of the pixel in the two-dimensional coordinate system; Among them, σ is the parameter that controls the filter strength, and k is the window size of the filter kernel.

5. The method for detecting the flatness of a metal part according to claim 4, wherein: The step of obtaining the grayscale image after noise reduction and executing the edge gradient calculation strategy to calculate the gradient feature of each pixel includes: The gradient features include gradient amplitude and gradient direction, which are calculated as follows: The pixel value I(x, y) of each pixel in the denoised grayscale image is expressed as a two-dimensional matrix A; Use the Sobel operator to calculate the gradient G of the grayscale image in the x-axis direction x ; Get the gradient index G of each pixel in the x-axis direction x (x, y); Use the Sobel operator to calculate the gradient G of the grayscale image in the y-axis direction y ; Among them, * represents the convolution operation, and the gradient index G of each pixel in the y-axis direction is obtained. y (x, y); Calculate the gradient magnitude for each pixel Calculate the gradient direction for each pixel Suppress non-edge pixels, specifically: For each pixel, according to its gradient direction θ(x, y), find the two neighboring points closest to the gradient direction, which are recorded as the first neighbor and the second neighbor respectively; Compare the magnitude relationship between the gradient amplitudes of the pixel, the first neighboring point, and the second neighboring point; If the gradient amplitude of the pixel is the largest, the gradient amplitude of the pixel is retained; If the gradient magnitude of the pixel is not the maximum, the gradient magnitude of the pixel is set to 0.

6. The method for detecting the flatness of a metal part according to claim 1, wherein: The method of executing a flatness quantification strategy based on the binary image of the laser stripes and quantifying the flatness index into regression data includes: Convolution operation: in, is the i-th, j-th position value of the l-th layer convolution output feature map, k is the convolution kernel size, I (l-1) is the output feature map of the l-1 layer, K (l) is the convolution kernel weight matrix of the lth layer, b (l) is the bias of the convolution kernel of the first layer, and the size of the output feature map is calculated as: Among them, p is the number of pixels filled and s is the size of the stride.

7. The method for detecting the flatness of a metal part according to claim 6, wherein: The method of executing a flatness quantification strategy based on the binary image of the laser stripes and quantifying the flatness index into regression data includes: Get the position value of the convolution output feature map of the lth layer, and use the activation function Sigmoid to introduce nonlinearity, specifically; Get the position value of the l-th layer convolution output feature map and use the pooling pool for pooling: Pooling operation size calculation: k p is the pooling window size, s p is the pooling stride; Flatten the pooled feature map into a vector and input it into the fully connected layer; z (l) =W (l) ·a (l) +b (l) , where W (l) is the weight matrix, b (l) is the bias, z (l) is the linear output of the fully connected layer; Regression of the flatness index s = z (l) , and obtain the prediction results of the flatness index.

8. A fixture, characterized in that: include: The laser stripe emitter is composed of a line laser and a cylindrical lens, and the cylindrical lens is used to expand the laser point into stripes; The industrial camera is equipped with a bandpass filter to filter out ambient light interference; Mobile platform, used to move the steel sheet of the front shell of the mobile phone to scan the entire steel sheet surface; Light-shielding box, used to provide a detection environment.

Citation Information

Cited By

  • VCSEL epitaxial wafer warping degree detection method

    CN121297720A

  • Passenger car surface flatness detection device and method

    CN121557834A