Positioning method for processing of mobile phone glass cover plate
Patent Information
- Application Number
- CN202511900506.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-16
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2045-12-16
AI Technical Summary
[0005]为了解决定位不精确的技术问题,本申请提供了一种用于手机玻璃盖板加工的定位方法,能够对各向异性扩散滤波进行改进,使改进各向异性扩散滤波能有效保留手机玻璃盖板中的边缘信息,提高定位精度
首先计算图像中每个像素点的结构显著性,以准确识别图像中有复杂结构的边缘区域;对各向异性扩散滤波进行改进,在迭代过程中引入结构显著性增长趋势和像素值扩散趋势,对传统各向异性扩散滤波中的平滑系数进行动态调整,使图像平滑与边缘保留之间达到平衡;同时,在每次迭代过程中依据各像素点的结构显著性确定每次迭代过程中任意像素点的对比因子,进一步精准调控各像素点的平滑效果和保边效果;最后将结构显著性作为加权因子引入模板匹配过程,实现关键区域的高精度匹配定位。
Smart Images

Figure CN121707969B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and more particularly to a positioning method for processing mobile phone glass covers. Background Technology
[0002] During the mobile phone manufacturing process, a glass cover needs to be placed on the finished phone. To ensure a high-precision match between the holes, grooves, and other areas on the glass cover and their corresponding areas on the phone, the glass cover needs to be positioned to prevent misalignment. However, due to the transparency and reflectivity of glass, the acquisition of images of the glass cover is easily affected by factors such as changes in lighting and reflection artifacts, making it difficult to extract positioning features and thus affecting the manufacturing quality.
[0003] Currently, patent application CN113284232A discloses a quadtree-based optical flow tracking method. The method includes: receiving image sequences in real time, performing grayscale processing on the images, and performing adaptive histogram equalization preprocessing on the images; constructing a nonlinear scale space for the image to complete real-time feature point extraction; splitting the image's base nodes and uniformly extracting feature points from each image block based on a quadtree algorithm; tracking the feature points using a sparse optical flow method; and outputting an image translation vector. The step of constructing the nonlinear scale space for the image to complete real-time feature point extraction is as follows: constructing the nonlinear scale space of the image through anisotropic diffusion filtering, filtering the image using a fast display diffusion algorithm, calculating the eigenvalues of the Hessian matrix of the image at different scales, finding its extreme points, and setting a judgment threshold to achieve feature point recognition in the image; and sorting the response extreme values of the recognized feature points in descending order.
[0004] The above method uses anisotropic diffusion filtering to construct a nonlinear scale space for the image and uses this nonlinear scale space to extract feature points in real time. However, the above method directly uses anisotropic diffusion filtering to construct a nonlinear scale space and ignores the influence of the contrast factor K on the filtering effect in anisotropic diffusion filtering. This makes it impossible for anisotropic diffusion filtering to effectively preserve edge information in the image, resulting in inaccurate localization. Summary of the Invention
[0005] To address the technical problem of inaccurate positioning, this application provides a positioning method for mobile phone glass cover processing, which improves anisotropic diffusion filtering, enabling the improved anisotropic diffusion filtering to effectively retain edge information in the mobile phone glass cover and improve positioning accuracy.
[0006] In a first aspect, this application provides a positioning method for processing mobile phone glass covers. The positioning method includes: acquiring the structural saliency of each pixel in a grayscale image of the mobile phone glass cover; filtering the grayscale image using an improved anisotropic diffusion filter to obtain an enhanced image; and performing template matching based on the enhanced image to achieve positioning of the mobile phone glass cover. The improved anisotropic diffusion filter includes: calculating the growth trend of the structural saliency of any pixel and the diffusion trend of the pixel value in historical iterations; calculating the smoothing coefficient and contrast factor of the pixel in the current iteration, wherein the smoothing coefficient is negatively correlated with the growth trend and positively correlated with the diffusion trend, and the contrast factor is positively correlated with the structural saliency of the pixel in the current iteration; performing a filtering operation on the pixel based on the contrast factor and smoothing coefficient of the pixel in the current iteration; and obtaining the enhanced image when the number of iterations reaches the maximum number, or when the change in pixel value of each pixel in two adjacent iterations is less than a preset value.
[0007] An improved anisotropic diffusion filter can adaptively preserve important edge features during the filtering process while enhancing noise suppression, achieving a balance between image smoothing and edge preservation. This preserves edge information that is beneficial for accurate positioning, significantly improving positioning accuracy and stability.
[0008] Preferably, the steps for obtaining structural saliency are as follows: obtaining the gradient magnitude and gradient direction of each neighboring pixel within the neighborhood of any pixel; calculating the average direction of the gradient direction of each neighboring pixel; using the cosine of the angle between the gradient direction and the average direction and the gradient magnitude as the evaluation value of the neighboring pixel; using the average evaluation value of each neighboring pixel as the structural value of the pixel; and using the ratio of the structural value of the pixel to the average structural value of all pixels as the structural saliency.
[0009] It can effectively quantify the structural feature intensity of each pixel in an image, enabling the distinction between edge regions and flat regions. Structural saliency can accurately reflect the importance of a pixel in the local structure, providing a precise basis for edge preservation in the subsequent filtering stage.
[0010] Preferably, the neighborhood range is a cross-shaped area composed of adjacent pixels in the four directions of up, down, left, and right.
[0011] Preferably, this iteration medium pixel contrast factor for: ; For this iteration medium pixel Structural salience, The initial value of the comparison factor. It is a very small positive number.
[0012] By adjusting the contrast factor, the diffusion function can automatically adjust the diffusion speed according to changes in image structure. The higher the saliency, the larger the contrast factor and the smaller the diffusion function, thereby suppressing smooth diffusion in edge regions, enhancing edge preservation, and ensuring that image structure is effectively preserved during the filtering process.
[0013] Preferably, the growth trend of the structural saliency of any pixel is the average increase in the structural saliency of the pixel in each historical iteration, and the increase in structural saliency is the structural saliency of the pixel in the historical iteration minus the structural saliency of the pixel in the previous historical iteration.
[0014] Preferably, the diffusion trend of the pixel value of any pixel is the average of the decrease in the pixel value of the pixel in each historical iteration, and the decrease in pixel value is the pixel value of the pixel in the previous historical iteration minus the pixel value of the pixel in the next historical iteration.
[0015] Preferably, this iteration medium pixel Smoothing coefficient for: ; For this iteration medium pixel The increasing trend of structural salience; For this iteration medium pixel The diffusion trend of pixel values; This is the baseline value for the smoothing coefficient; for function.
[0016] By simultaneously incorporating structural growth and diffusion trends into the calculation of the smoothing coefficient, a dynamic balance between edge preservation and background smoothing is achieved. This smoothing coefficient formula automatically adjusts the diffusion intensity based on the structural evolution of different regions, thereby effectively suppressing image noise and improving overall image quality and iteration efficiency while ensuring edge sharpness.
[0017] Preferably, template matching based on the enhanced image includes: sliding a matching window on the enhanced image, the size of the matching window being the same as the size of the template image; within the matching window, calculating the absolute value of the difference between the pixel values of any pixel point in the enhanced image and the template image, using the normalized structural saliency as the matching weight for each pixel point, and weighted summing the absolute values of the differences between each pixel point according to the matching weight to obtain the matching degree of the matching window; taking the matching window with the highest matching degree as the target window, and taking the center point of the target window as the positioning result.
[0018] Using structural saliency as a weighting factor in template matching allows structurally clear regions to contribute more significantly to the matching process. Compared to traditional mean or variance-based matching methods, the structure-weighted approach focuses more on highly identifiable regions in the image, improving adaptability to complex backgrounds and lighting variations, and achieving more robust localization results.
[0019] Preferably, the template image is a partial image of a key area in the glass cover of a mobile phone.
[0020] Preferably, the key area includes holes and grooves.
[0021] The technical solution of this application has the following beneficial technical effects: First, the structural saliency of each pixel in the image is calculated to accurately identify edge regions with complex structures. Anisotropic diffusion filtering is improved by introducing the growth trend of structural saliency and the diffusion trend of pixel values during the iteration process. The smoothing coefficient in traditional anisotropic diffusion filtering is dynamically adjusted to achieve a balance between image smoothing and edge preservation. Simultaneously, in each iteration, the contrast factor of any pixel is determined based on the structural saliency of each pixel, further precisely controlling the smoothing and edge preservation effects of each pixel. Finally, structural saliency is introduced as a weighting factor into the template matching process to achieve high-precision matching and localization of key regions. Attached Figure Description
[0022] Figure 1 This is a flowchart of a positioning method for processing mobile phone glass cover plates according to an embodiment of this application. Detailed Implementation
[0023] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0024] According to the first aspect of this application, a positioning method for processing mobile phone glass covers is provided. For ease of understanding, anisotropic diffusion filtering is introduced here. Anisotropic diffusion filtering is an image noise reduction method that effectively preserves image features such as boundaries and lines while reducing image noise. The specific process is as follows: In the During each iteration, for a single pixel in the image Calculate the pixel value difference between the current pixel and its four adjacent pixels (top, bottom, left, and right), and record them as follows: , , and ;No. In the next iteration, the pixel The filtering operation is as follows: ; in, For the first In the next iteration, the pixel pixel values, , , and These are the four adjacent pixels (top, bottom, left, and right) and the pixel. The difference in pixel values; For the first In the next iteration, the pixel The filtering result is also for the first In the next iteration, the pixel Pixel values; Let be the diffusion function. , , and These are the diffusion function values for the four adjacent pixels, located at the top, bottom, left, and right. For pixels In the The smoothing coefficient in the next iteration. The filtering operation is performed on each pixel in the image iteratively until the number of iterations reaches the maximum, or the change in pixel value of each pixel in two adjacent iterations is less than the preset value, at which point the anisotropic diffusion filtering is completed.
[0025] Wherein, diffusion function for: , The difference in pixel values. For pixels The contrast factor of the diffusion function at that location; The specific calculation formula is as follows: The diffusion function controls the rate at which pixel values diffuse in the corresponding direction. Used to control pixels The speed at which pixel values diffuse upwards; the greater the diffusion speed, the higher the pixel value. The easier it is for pixel values to be smoothed, the better the noise reduction effect; conversely, the smaller the diffusion speed, the better the noise reduction effect. The less likely the pixel values are to be smoothed, the better the edge preservation effect.
[0026] Understandably, if pixels For noise points, pixels The pixel value is larger than all its neighboring pixels. , , and All values are less than 0, representing the spread function values of four adjacent pixels. , , and The value is between 0 and 1, so after each iteration of the filtering operation, the pixel value of that pixel will decrease and diffuse in four directions (up, down, left, and right), thereby eliminating noise and achieving smoothing. If the pixel... As an edge point, it has a smaller diffusion function value in the direction where the pixel value changes significantly. In this direction, the pixel value is less likely to be smoothed, thus achieving the edge-binding effect.
[0027] It should be noted that the first In the next iteration, the pixel Smoothing coefficient in filtering operation It can control the speed at which pixel values spread in each direction, and the smoothing coefficient. The larger the value, the faster the pixel value spreads in each direction.
[0028] Figure 1 This is a flowchart of a positioning method for processing mobile phone glass covers according to an embodiment of this application. Figure 1 As shown, the positioning method for processing mobile phone glass covers includes steps S101 to S103, which are described in detail below.
[0029] S101, Obtain the structural saliency of each pixel in the grayscale image of the mobile phone glass cover.
[0030] In one embodiment, a grayscale image of the mobile phone glass cover is acquired. During the glass cover positioning process, pixels with obvious structural features are more helpful for accurate positioning than pixels in flat areas. Therefore, when using an improved anisotropic diffusion filter to filter the grayscale image to obtain an enhanced image, pixels with obvious structural features and pixels in smooth flat areas should be retained to avoid the edge features caused by the transparency and reflectivity of the glass material affecting the positioning accuracy.
[0031] Specifically, the steps for obtaining structural saliency are as follows: obtain the gradient magnitude and gradient direction of each neighboring pixel within the neighborhood of any pixel; calculate the average direction of the gradient direction of each neighboring pixel; use the cosine of the angle between the gradient direction and the average direction and the gradient magnitude as the evaluation value of the neighboring pixel; use the average value of the evaluation values of each neighboring pixel as the structural value of the pixel; and use the ratio of the structural value of the pixel to the average structural value of all pixels as the structural saliency.
[0032] Among them, pixels structural values for: ;in, The number of neighboring pixels. For pixels The neighborhood range, For neighboring pixels The magnitude of the gradient, For neighboring pixels gradient direction, The average direction.
[0033] Understandably, the larger the gradient of a neighboring pixel and the larger the angle between the gradient direction and the average direction, the more complex the edge features are within the neighborhood of the pixel, and the larger the structure value of that pixel. If the ratio of the structure value of that pixel to the average structure value of all pixels is larger, the structure of that pixel is more significant, and the structural significance of that pixel is greater.
[0034] It should be noted that since anisotropic diffusion filtering is a process of diffusing the pixel value of a pixel based on the neighboring pixels in the four directions of up, down, left, and right, the neighborhood range here is the cross-shaped area formed by the neighboring pixels in the four directions of up, down, left, and right.
[0035] In this way, the structural saliency of each pixel can be accurately quantified based on the gradient magnitude and gradient direction of each neighboring pixel within the neighborhood. The greater the structural saliency, the more obvious the edge information, which is more conducive to accurate positioning.
[0036] S102, the grayscale image is filtered using an improved anisotropic diffusion filter to obtain an enhanced image.
[0037] In one embodiment, anisotropic diffusion filtering is an iterative filtering process. During the filtering process, the pixel values of pixels with greater structural significance should be retained, while the pixel values of pixels with less structural significance should be smoothed. To ensure the filtering effect and improve the filtering efficiency, anisotropic diffusion filtering is improved.
[0038] Specifically, the improved anisotropic diffusion filtering includes: calculating the growth trend of structural saliency and the diffusion trend of pixel values for any pixel in historical iterations; calculating the smoothing coefficient and contrast factor of the pixel in the current iteration, wherein the smoothing coefficient is negatively correlated with the growth trend and positively correlated with the diffusion trend, and the contrast factor is positively correlated with the structural saliency of the pixel in the current iteration; performing a filtering operation on the pixel based on the contrast factor and smoothing coefficient of the pixel in the current iteration; and obtaining an enhanced image when the number of iterations reaches the maximum number, or when the change in pixel values of each pixel in two adjacent iterations is less than a preset value.
[0039] In each iteration, a filtering operation is performed on each pixel in the grayscale image to obtain the output image for that iteration. Since the edges of some pixels in the output image are preserved while the edges of others are diffused (i.e., smoothed), the structural saliency of each pixel changes. Therefore, at the beginning of each iteration, the structural saliency of each pixel needs to be recalculated.
[0040] For this iteration, on the one hand, the contrast factor of the pixels in this iteration is determined based on the structural saliency of the pixels. The greater the structural saliency, the more edge information should be preserved, and the smaller the value of the diffusion function should be. In this case, the value of the contrast factor should be reduced. That is to say, the contrast factor is positively correlated with the structural saliency of the pixels in this iteration. Specifically, this iteration... medium pixel contrast factor for: ; For this iteration medium pixel Structural salience, The initial value of the comparison factor. It is a very small positive number. Wherein, the initial value of the contrast factor... It is 10. The value is 0.1. A very small positive number. To avoid The value of is 0, which leads to a situation where the denominator in the diffusion function is 0.
[0041] On the other hand, the growth trend of the structural saliency of any pixel and the diffusion trend of the pixel value can be calculated in the historical iterations. The larger the growth trend, the greater the structural saliency of the pixel during the iteration process. The pixel is becoming more and more important for achieving accurate positioning, and its edge information should be preserved to enhance the edge preservation effect. The larger the diffusion trend, the more the pixel is gradually smoothed during the iteration process. The pixel's role in achieving accurate positioning is becoming smaller and smaller, and its diffusion speed should be accelerated. Based on the growth trend and diffusion trend, the smoothing coefficient of the pixel in the current iteration is determined, thereby controlling the diffusion speed and edge preservation effect of each pixel.
[0042] Specifically, the growth trend of the structural saliency of any pixel is the average increase in the structural saliency of the pixel in each historical iteration, where the increase in structural saliency is the structural saliency of the pixel in each historical iteration minus the structural saliency of the pixel in the previous historical iteration; pixel The growing trend of structural salience : ; and The first The next historical iteration and the first Pixels in the next historical iteration Structural salience, This represents the number of iterations.
[0043] The diffusion trend of pixel values for any pixel is the average of the decrease in pixel values across all historical iterations, where the decrease in pixel value is the pixel value in the previous iteration minus the pixel value in the next historical iteration; pixel. Pixel value diffusion trend for: ;in, and The first The next historical iteration and the first Pixels in the next historical iteration pixel values, This represents the number of iterations. This represents the maximum pixel value.
[0044] Thus, this iteration medium pixel Smoothing coefficient for: ; For this iteration medium pixel The increasing trend of structural salience; For this iteration medium pixel The diffusion trend of pixel values; This is the baseline value for the smoothing coefficient; for The function. Wherein, the baseline value of the smoothing coefficient... The value is 0.25.
[0045] Understandably, for this iteration medium pixel In other words, if the growth trend is less than 0 and the growth trend is obvious, The value approaches 1; if the diffusion tendency is greater than 0 and the diffusion tendency is obvious, When it approaches 1, this iteration... medium pixel Smoothing coefficient Approaching the benchmark value At this time, the pixel It has a good smoothing effect.
[0046] Determine this iteration medium pixel Smoothing coefficient and this iteration medium pixel contrast factor After that, the pixel points in this iteration can be completed. Similarly, the filtering operation can be performed on all pixels to complete the current iteration.
[0047] The process involves multiple iterations, and an enhanced image is obtained when the maximum number of iterations is reached, or when the change in pixel value between two consecutive iterations is less than a preset value. The maximum number of iterations is 30, and the preset value is 1.
[0048] Thus, during the iteration process, by adjusting the contrast factor and smoothing coefficient of each pixel to control the diffusion speed of the pixel value, the smoothing effect and edge preservation effect of each pixel can be controlled. A good filtering effect can be achieved with fewer iterations, improving filtering efficiency while ensuring filtering effect.
[0049] S103 performs template matching based on the enhanced image to locate the mobile phone glass cover.
[0050] In one embodiment, after obtaining the enhanced image, the enhanced image can retain edge information that is conducive to accurate positioning. The pixels with greater structural saliency in the enhanced image are more conducive to accurate positioning. Therefore, matching weights can be assigned to each pixel according to structural saliency to achieve accurate positioning of the mobile phone glass cover.
[0051] Specifically, template matching based on the enhanced image includes: sliding a matching window on the enhanced image, the size of which is the same as the size of the template image; within the matching window, calculating the absolute value of the difference between the pixel values of any pixel in the enhanced image and the template image, using the normalized structural saliency as the matching weight for each pixel, and weighted summing the absolute values of the differences between each pixel according to the matching weight to obtain the matching degree of the matching window; taking the matching window with the highest matching degree as the target window, and taking the center point of the target window as the positioning result.
[0052] Among them, the matching window Matching degree for: ; To match the window Inner pixel Normalized structural saliency, For pixels The absolute value of the difference in pixel values between the enhanced image and the template image. equal to pixel Structural saliency and matching window The ratio of the sum of the structural saliency of each pixel within the unit.
[0053] The template image is a partial image of key areas such as holes and slots in the mobile phone glass cover, so as to accurately locate key areas such as holes and slots in the mobile phone glass cover; the partial images of key areas such as holes and slots are standard images without noise.
[0054] In this way, the key areas of the mobile phone glass cover can be accurately positioned, and the position of the mobile phone glass cover can be determined based on the position of the key areas, so that the mobile phone glass cover can be accurately covered on the processed mobile phone.
[0055] It should be noted that any modifications and improvements made by those skilled in the art without departing from the concept of this application are within the scope of protection of this application. Therefore, the scope of protection of this patent application shall be determined by the appended claims.
Claims
1. A positioning method for processing mobile phone glass covers, characterized in that, The positioning method includes: obtaining the structural saliency of each pixel in a grayscale image of a mobile phone glass cover; An improved anisotropic diffusion filter is used to filter the grayscale image to obtain an enhanced image; template matching is then performed based on the enhanced image to locate the mobile phone glass cover. The improved anisotropic diffusion filtering includes: calculating the growth trend of structural saliency and the diffusion trend of pixel values for any pixel in historical iterations; calculating the smoothing coefficient and contrast factor of the pixel in the current iteration, wherein the smoothing coefficient is negatively correlated with the growth trend and positively correlated with the diffusion trend, and the contrast factor is positively correlated with the structural saliency of the pixel in the current iteration; performing a filtering operation on the pixel based on the contrast factor and smoothing coefficient of the pixel in the current iteration; and obtaining an enhanced image when the number of iterations reaches the maximum number, or when the change in pixel values of each pixel in two adjacent iterations is less than a preset value. The steps for obtaining structural saliency are as follows: Obtain the gradient magnitude and gradient direction of each neighboring pixel within the neighborhood of any pixel. Calculate the average direction of the gradient direction of each neighboring pixel. Use the cosine of the angle between the gradient direction and the average direction, multiplied by the gradient magnitude, as the evaluation value of the neighboring pixel. Use the average evaluation value of each neighboring pixel as the structural value of the pixel. Use the ratio of the structural value of the pixel to the average structural value of all pixels as the structural saliency.
2. The positioning method for processing mobile phone glass covers according to claim 1, characterized in that, The neighborhood range is a cross-shaped area composed of adjacent pixels in the four directions of up, down, left, and right.
3. The positioning method for processing mobile phone glass covers according to claim 1, characterized in that, This iteration medium pixel contrast factor for: ; For this iteration medium pixel Structural salience, The initial value of the comparison factor. It is a very small positive number.
4. The positioning method for processing mobile phone glass covers according to claim 1, characterized in that, The growth trend of the structural saliency of any pixel is the average increase in the structural saliency of the pixel in each historical iteration, and the increase in structural saliency is the structural saliency of the pixel in the previous historical iteration minus the structural saliency of the pixel in the previous historical iteration.
5. The positioning method for processing mobile phone glass covers according to claim 1, characterized in that, The diffusion trend of pixel value of any pixel is the average of the decrease in pixel value of the pixel in each historical iteration, and the decrease in pixel value is the pixel value of the pixel in the previous historical iteration minus the pixel value of the pixel in the next historical iteration.
6. The positioning method for processing mobile phone glass covers according to claim 1, characterized in that, This iteration medium pixel Smoothing coefficient for: ; For this iteration medium pixel The increasing trend of structural salience; For this iteration medium pixel The diffusion trend of pixel values; This is the baseline value for the smoothing coefficient; for function.
7. The positioning method for processing mobile phone glass covers according to claim 1, characterized in that, Template matching based on enhanced images includes: The matching window is slid across the enhanced image, and the size of the matching window is the same as that of the template image. Within the matching window, the absolute value of the difference between the pixel values of any pixel point in the enhanced image and the template image is calculated. The normalized structural saliency is used as the matching weight of each pixel point. The absolute values of the differences of each pixel point are weighted and summed according to the matching weight to obtain the matching degree of the matching window. The window with the highest matching degree is used as the target window, and the center point of the target window is used as the positioning result.
8. A positioning method for processing mobile phone glass covers according to claim 7, characterized in that, The template image is a partial image of a key area in the glass cover of a mobile phone.
9. A positioning method for processing mobile phone glass covers according to claim 8, characterized in that, The key areas include holes and slots.
Citation Information
Patent Citations
Optical flow tracking method based on quadtree
CN113284232A
Vacuum printing plate position identification and calibration method based on machine vision
CN119624948A
Joint high dynamic range compression and noise reduction
US20100238190A1