A method and system for detecting bubbles in mobile phone cover glass
By combining deep learning and image processing technology, the efficient, accurate and automated detection of glass bubbles on mobile phone covers is achieved, and the problems of subjectivity, inefficiency and poor detection accuracy in traditional methods are solved, and the production efficiency and product quality are improved.
Patent Information
- Application Number
- CN202510096341.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2045-01-22
AI Technical Summary
The traditional mobile phone cover glass bubble detection method has problems such as subjectivity, low efficiency, and poor detection accuracy. The computer vision-based method has a limited detection range and is susceptible to factors such as light and noise.
Using a combination of deep learning technology and image processing technology, the characteristics of bubbles are segmented and extracted through bilateral filtering and denoising and minimum error threshold segmentation, and a bubble classification network is built to achieve fast and accurate bubble detection and classification.
It improves the accuracy and efficiency of glass bubble detection on mobile phone cover plates, reduces the misjudgment rate, realizes automated detection, improves production efficiency, reduces production costs, and ensures product quality.
Smart Images

Figure CN119540236B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of bubble detection, and in particular to a method and system for detecting bubbles in mobile phone cover glass. Background Art
[0002] Mobile phone cover glass is a key component of the outer layer of touch devices such as smartphones. As the outermost layer of the mobile phone touch screen, it can protect the touch screen on the one hand, and can be printed with different colors and patterns on the other hand to beautify the product. Mobile phone cover glass is generally made of ultra-thin flat glass through precision processing. It has high light transmittance and excellent scratch resistance and hardness. It can effectively resist wear and impact in daily use. However, if the mobile phone cover glass contains bubble defects, it will seriously affect the quality and performance of the product.
[0003] Therefore, developing an efficient and accurate bubble detection method and system is of great significance for ensuring product quality, improving production efficiency and reducing production costs. Traditional bubble detection methods have problems such as subjectivity, low efficiency and poor detection accuracy; computer vision-based methods have problems such as limited detection range and being easily affected by factors such as light and noise. Therefore, it is necessary to develop a new mobile phone cover glass bubble detection method with comprehensive advantages, high accuracy, good stability and high degree of automation. Summary of the invention
[0004] In view of this, the present invention provides a method and system for detecting bubbles in mobile phone cover glass, aiming to improve the accuracy and efficiency of mobile phone cover glass bubble detection; the method of the present invention utilizes a combination of deep learning technology and image processing technology, which can quickly and accurately detect and classify bubble defects in mobile phone cover glass, and has the advantages of high efficiency, precision and automation, while avoiding the subjectivity and high misjudgment rate of traditional methods, and can improve production efficiency, reduce production costs and ensure product quality.
[0005] To achieve the above object, the present invention provides a method for detecting bubbles in mobile phone cover glass, comprising the following steps:
[0006] S1: Use bilateral filtering to remove noise from the collected mobile phone cover glass image to obtain a denoised mobile phone cover glass image;
[0007] S2: Based on the minimum error threshold segmentation method, the denoised mobile phone cover glass image is segmented to obtain the candidate area image of the bubble;
[0008] S3: extracting features of bubbles in the candidate region picture, wherein the features of the bubbles include the area, perimeter, roundness, and compactness of the bubbles; obtaining features of the candidate region picture based on the features of the bubbles, the candidate region picture, and the segmentation results corresponding to the candidate region picture;
[0009] S4: construct a bubble classification network and update the network parameters to obtain a trained bubble classification network;
[0010] S5: Perform steps S1-S3 on the image of the mobile phone cover glass to be detected, input the features of the obtained candidate area image into the bubble classification network trained in step S4, and obtain the bubble detection result.
[0011] As a further improvement method of the present invention:
[0012] Optionally, the step S1 includes:
[0013] Process each pixel in the collected mobile phone cover glass image and extract the pixel centered on the current processing pixel. The pixels within the window size and the corresponding weights are calculated, and the weights are calculated as follows:
[0014] ;
[0015] Among them, (i,j) represents the position of the current processing pixel in the mobile phone cover glass image; (m,n) represents the center of the current processing pixel. The position of one of the pixels in the window in the image of the phone cover glass; is a natural constant; I represents the image of the mobile phone cover glass; and are the pixel values of the mobile phone cover glass image at positions (i, j) and (m, n) respectively; and There are two parameters used to control the size of the weight;
[0016] Based on the calculated weights, the pixel value of the currently processed pixel after denoising is calculated as follows:
[0017] ;
[0018] in, is the pixel value of the denoised mobile phone cover glass image at position (i, j);
[0019] According to the above calculation method, the same processing is performed on each pixel of the mobile phone cover glass image until all pixel positions are processed to obtain the denoised mobile phone cover glass image .
[0020] Optionally, the S2 step includes:
[0021] S21: According to the probability distribution, the Modeling:
[0022] ;
[0023] Among them, u is The pixel value of the pixel in ; for Probability distribution model of ; and are the prior probabilities of background and bubble respectively, and and are the distribution of background and bubble respectively, and the expression is:
[0024] ;
[0025] in, and To control the parameters of the background distribution, and is the parameter to control the bubble distribution;
[0026] The prior probabilities of the background and bubbles are calculated according to different segmentation thresholds, and the corresponding parameters for controlling the background distribution and bubble distribution are calculated, including:
[0027] Given a segmentation threshold t, the background segmentation threshold set and bubble segmentation threshold set They are:
[0028] ;
[0029] Among them, T represents the denoised mobile phone cover glass image The maximum value of the pixel value in;
[0030] At this segmentation threshold, the prior probability of background and bubbles is and They are:
[0031] ;
[0032] Among them, N represents the denoised mobile phone cover glass image The number of pixels in Image of mobile phone cover glass after denoising The number of pixels with pixel value v in the
[0033] Based on the prior probabilities of background and bubbles, the corresponding calculation formulas for the parameters controlling background distribution and bubble distribution are:
[0034] ;
[0035] S22: According to the minimum error principle, construct the objective function:
[0036] ;
[0037] Optimal segmentation threshold When the objective function U takes the minimum value, it is obtained:
[0038] ;
[0039] S23: Calculate the segmentation result based on the optimal segmentation threshold:
[0040] ;
[0041] in, The segmentation result of the mobile phone cover glass image after denoising The pixel value at position (i, j); 0 means The pixel at (i, j) is the background, 1 means The pixel at (i, j) is a bubble;
[0042] Segmentation results based on denoised mobile phone cover glass images , according to the position where the pixel value is 1, the denoised mobile phone cover glass image is captured The part where each bubble is located is obtained to obtain the candidate area image of the bubble.
[0043] Optionally, the S3 step includes:
[0044] Based on the candidate region picture of each bubble obtained in step S2, extracting features of the bubble in the candidate region picture, wherein the features of the bubble include the area, perimeter, roundness, and compactness of the bubble;
[0045] The area of the bubble is obtained by counting the number of pixels of the bubble in the candidate area image, and the calculation method is:
[0046] ;
[0047] in, is the cumulative function, A is the segmentation result corresponding to the candidate area image, and the segmentation result of the mobile phone cover glass image after denoising is intercepted The area where the candidate area picture is located is obtained;
[0048] The perimeter of the bubble is obtained by counting the number of edge pixels, and the calculation method is:
[0049] ;
[0050] in, It is the gradient calculation function of the candidate region image; is the edge map of the candidate region image, which has the same size as the candidate region image. The pixel value of 1 represents edge pixels, and 0 represents non-edge pixels; The number of pixels in the middle edge obtains the perimeter of the bubble, that is, the perimeter of the bubble ;
[0051] Calculate the roundness of the bubble based on the bubble area and perimeter and compactness :
[0052] ;
[0053] in, is the area of the minimum circumscribed rectangle of the bubble;
[0054] Based on the features of the bubbles, the candidate region images, and the segmentation results corresponding to the candidate region images, the features of the candidate region images are obtained:
[0055] ;
[0056] in, is the candidate region picture; is the feature of the candidate region image; and Respectively and Copy to the candidate area picture Results with the same size.
[0057] Optionally, the S4 step includes:
[0058] S41: The features of the candidate area image Input the bubble classification network to obtain the bubble category expected by the network:
[0059] ;
[0060] Wherein, Cls is the probability that the bubbles in the candidate area image predicted by the network belong to different bubble categories, which is an M-dimensional vector, where M represents the number of bubble types; DNN is the bubble classification network;
[0061] S42: Calculate the loss function based on the bubble category predicted by the bubble classification network and update the network parameters:
[0062] The loss function is calculated as follows:
[0063] ;
[0064] in, Indicates that if the candidate region contains If there is a bubble category, its value is 1, otherwise it is 0; and They respectively indicate that the network predicts that the candidate region contains Bubble type and The probability of each bubble category;
[0065] S43: Perform iterative update:
[0066] The update of the bubble classification network parameters is:
[0067] ;
[0068] in, and b are the weight and bias of the bubble classification network, respectively, which are parameters obtained through continuous iterative learning; and Represents the current iteration state and the gradient of b; is the learning rate of the network, which is used to control the amplitude of each update of the network parameters;
[0069] Repeat step S43 until the specified number of iterations is reached to obtain a trained bubble classification network.
[0070] Optionally, the step S5 includes:
[0071] The image of the mobile phone cover glass to be detected is processed through steps S1-S3 to obtain the features of the candidate area image of the mobile phone cover glass to be detected ;
[0072] Will Input to the bubble classification network trained in step S4, specifically:
[0073] ;
[0074] in, The trained bubble classification network; is the probability that the bubbles in the candidate area image of the mobile phone cover glass image to be detected belong to different bubble categories predicted by the trained network, which is an M-dimensional vector;
[0075] The bubble category corresponding to the serial number of the dimension with the largest value in the vector is the bubble detection result, which is:
[0076] ;
[0077] in, Returns Get the maximum value .
[0078] The present invention also discloses a mobile phone cover glass bubble detection system, comprising:
[0079] Image acquisition and denoising module: bilateral filtering is used to remove noise from the collected mobile phone cover glass images;
[0080] Image segmentation module: Based on the minimum error threshold segmentation method, the denoised mobile phone cover glass image is segmented;
[0081] Image feature extraction module: extracts the features of bubbles in the candidate area image, and obtains the features of the candidate area image based on the features of the bubbles and the segmentation results corresponding to the candidate area image and the candidate area image;
[0082] Network construction module: constructs a bubble classification network and updates network parameters to obtain a trained bubble classification network;
[0083] Network application module: Apply the trained bubble classification network to obtain bubble detection results.
[0084] The beneficial effects of the present invention are:
[0085] The bilateral filtering in the present invention can effectively remove noise in the image, thereby reducing the probability of false detection and misjudgment. The minimum error threshold segmentation method can effectively segment the bubble area in the image. The area, perimeter, roundness and compactness features of the bubble are extracted to effectively distinguish different types of bubbles. The deep neural network has strong nonlinear modeling capabilities and adaptability, and can automatically learn features and classification rules, thereby improving the accuracy of bubble classification.
[0086] In summary, the present invention combines bilateral filtering, segmentation, feature extraction and deep learning to achieve accurate and automated bubble detection, avoiding the subjectivity and high misjudgment rate of traditional methods, and improving the accuracy and efficiency of bubble detection. At the same time, these methods can be adaptively learned and optimized, and have strong adaptability and scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0087] Figure 1 A schematic flow chart of a method for detecting bubbles in a mobile phone cover glass according to an embodiment of the present invention;
[0088] Figure 2 Schematic diagram of the LeNet structure according to an embodiment of the present invention. DETAILED DESCRIPTION
[0089] The present invention is further described below in conjunction with the accompanying drawings, but the present invention is not limited in any way. Any changes or substitutions made based on the teachings of the present invention belong to the protection scope of the present invention.
[0090] Embodiment 1: A method for detecting bubbles in mobile phone cover glass, such as Figure 1 As shown, the following steps are included:
[0091] S1: Use bilateral filtering to remove noise from the collected mobile phone cover glass image to obtain the denoised mobile phone cover glass image, including:
[0092] Process each pixel in the collected mobile phone cover glass image and extract the pixel centered on the current processing pixel. The pixels within the window size and the corresponding weights are calculated, and the weights are calculated as follows:
[0093] ;
[0094] Among them, (i,j) represents the position of the current processing pixel in the mobile phone cover glass image; (m,n) represents the center of the current processing pixel. The position of one of the pixels in the window in the image of the phone cover glass; is a natural constant; I represents the image of the mobile phone cover glass; and are the pixel values of the mobile phone cover glass image at positions (i, j) and (m, n) respectively; and These are two parameters used to control the size of the weights, both of which are 1 in this embodiment;
[0095] According to the pixel values in the window and the corresponding weights, a weighted average is calculated and used as the pixel value of the current processed pixel after denoising. The pixel value of the current pixel after denoising is calculated as follows:
[0096] ;
[0097] in, is the pixel value of the denoised mobile phone cover glass image at position (i, j);
[0098] According to the above calculation method, the same processing is performed on each pixel of the mobile phone cover glass image until all pixel positions are processed to obtain the denoised mobile phone cover glass image .
[0099] The collected mobile phone cover glass images usually have a certain degree of noise, such as image distortion, pixel color changes, etc. These noises will affect the accuracy and stability of subsequent bubble detection.
[0100] The invention uses a bilateral filtering method for image denoising, which can reduce noise and details in the image while retaining the edge information of the image. The invention bilateral filter takes into account the distance and color difference between pixels, smoothes the image by weighted averaging adjacent pixels, and avoids blurring of the image edge and loss of information.
[0101] S2: Based on the minimum error threshold segmentation method, the denoised mobile phone cover glass image is segmented to obtain the candidate area image of the bubble, including:
[0102] S21: According to the probability distribution, the Modeling:
[0103] ;
[0104] Among them, u is The pixel value of the pixel in ; for Probability distribution model of ; and are the prior probabilities of background and bubble respectively, and and are the distribution of background and bubble respectively, and the expression is:
[0105] ;
[0106] in, and To control the parameters of the background distribution, and is the parameter to control the bubble distribution;
[0107] Calculate the prior probability of background and bubbles according to different segmentation thresholds, and calculate the corresponding parameters controlling the background distribution and bubble distribution:
[0108] Given a segmentation threshold t, the background segmentation threshold set and bubble segmentation threshold set They are:
[0109] ;
[0110] Among them, T represents the denoised mobile phone cover glass image The maximum value of the pixel value in;
[0111] At this segmentation threshold, the prior probability of background and bubbles is and They are:
[0112] ;
[0113] Among them, N represents the denoised mobile phone cover glass image The number of pixels in Image of mobile phone cover glass after denoising The number of pixels with pixel value v in the
[0114] Based on the prior probabilities of background and bubbles, the corresponding calculation formulas for the parameters controlling background distribution and bubble distribution are:
[0115] ;
[0116] S22: According to the minimum error principle, construct the objective function:
[0117] ;
[0118] Optimal segmentation threshold When the objective function U takes the minimum value, it is obtained:
[0119] ;
[0120] S23: Calculate the segmentation result based on the optimal segmentation threshold:
[0121] ;
[0122] in, The segmentation result of the mobile phone cover glass image after denoising The pixel value at position (i, j); 0 means The pixel at (i, j) is the background, 1 means The pixel at (i, j) is a bubble;
[0123] Segmentation results based on denoised mobile phone cover glass images , according to the position where the pixel value is 1, the denoised mobile phone cover glass image is captured The part where each bubble is located is obtained to obtain the candidate area image of the bubble.
[0124] S3: extracting features of bubbles in the candidate region picture, wherein the features of the bubbles include the area, perimeter, roundness, and compactness of the bubbles; obtaining features of the candidate region picture based on the features of the bubbles, the candidate region picture, and the segmentation results corresponding to the candidate region picture, including:
[0125] Based on the candidate region picture of each bubble obtained in step S2, extracting features of the bubble in the candidate region picture, wherein the features of the bubble include the area, perimeter, roundness, and compactness of the bubble;
[0126] The area of the bubble is obtained by counting the number of pixels of the bubble in the candidate area image. The area of the bubble is calculated as follows:
[0127] ;
[0128] in, is the cumulative function, A is the segmentation result corresponding to the candidate area image, and the segmentation result of the mobile phone cover glass image after denoising is intercepted The area where the candidate area picture is located is obtained;
[0129] The perimeter of the bubble is obtained by counting the number of edge pixels, and the calculation method is:
[0130] ;
[0131] in, It is the gradient calculation function of the candidate area image; is the edge map of the candidate region image, which has the same size as the candidate region image. The pixel value of 1 represents edge pixels, and 0 represents non-edge pixels; The number of pixels in the middle edge obtains the perimeter of the bubble, that is, the perimeter of the bubble ;
[0132] According to the bubble area and perimeter, the roundness of the bubble is further calculated. and compactness :
[0133] ;
[0134] in, is the area of the minimum circumscribed rectangle of the bubble;
[0135] Based on the features of the bubbles, the candidate region images, and the segmentation results corresponding to the candidate region images, the features of the candidate region images are obtained:
[0136] ;
[0137] in, is the candidate region picture; is the feature of the candidate region image; and Respectively and Copy to the candidate area picture Results with the same size.
[0138] S4: Construct a bubble classification network and update the network parameters to obtain a trained bubble classification network, including:
[0139] S41: The features of the candidate area image Input the bubble classification network to obtain the bubble category expected by the network:
[0140] ;
[0141] Wherein, Cls is the probability that the bubbles in the candidate area image predicted by the network belong to different bubble categories, which is an M-dimensional vector, M represents the number of bubble types, in this embodiment, M is 4, and the bubble categories include surface impurity bubbles, surface pure bubbles, internal gas-containing fiber bubbles and internal hollow bubbles; DNN is a bubble classification network, and in this embodiment, LeNet is used as the bubble classification network, and its schematic diagram is shown as follows Figure 2 As shown;
[0142] S42: Calculate the loss function based on the bubble category predicted by the bubble classification network and update the network parameters:
[0143] The loss function is calculated as follows:
[0144] ;
[0145] in, Indicates that if the candidate region contains If there is a bubble category, its value is 1, otherwise it is 0; and They respectively indicate that the network predicts that the candidate region contains Bubble type and The probability of each bubble category;
[0146] S43: Perform iterative update:
[0147] The update of the bubble classification network parameters is:
[0148] ;
[0149] in, and b are the weight and bias of the bubble classification network, respectively, which are parameters obtained through continuous iterative learning; and Represents the current iteration state and the gradient of b; is the learning rate of the network, which is used to control the amplitude of each update of the network parameters. is 0.01;
[0150] Step S43 is repeatedly executed until the specified number of iterations is reached to obtain a trained bubble classification network. In this embodiment, the number of iterations is 10,000 times.
[0151] Inputting the features of the candidate regions obtained based on the bubble segmentation results into the bubble classification network can enable the network to better utilize the features of the bubbles for classification, thereby improving the accuracy and robustness of bubble detection and classification. By extracting the features of the bubbles, the redundant information and noise in the bubble image can be removed to better reflect the characteristics of the bubbles. Compared with directly inputting the bubble image into the bubble classification network, extracting features first and then using the classification network can reduce the amount of computation and complexity of the network. Since there may be a large amount of redundant information and noise in the bubble image, if the image is directly input into the classification network, the amount of information that the network needs to process is very large, resulting in a long network calculation time and difficulty in training. By extracting the features of the bubbles, the amount of information that the network needs to process can be reduced, making the network easier to train and optimize.
[0152] S5: Performing steps S1-S3 on the image of the mobile phone cover glass to be detected, inputting the features of the obtained candidate area image into the bubble classification network trained in step S4, and obtaining the bubble detection result, including:
[0153] The image of the mobile phone cover glass to be detected is processed through steps S1-S3 to obtain the features of the candidate area image of the mobile phone cover glass to be detected ;
[0154] Will Input to the bubble classification network trained in step S4, specifically:
[0155] ;
[0156] in, The trained bubble classification network; is the probability that the bubbles in the candidate area image of the mobile phone cover glass image to be detected belong to different bubble categories predicted by the trained network, which is an M-dimensional vector;
[0157] The bubble category corresponding to the serial number of the dimension with the largest value in the vector is the bubble detection result, which is:
[0158] ;
[0159] in, Returns Get the maximum value .
[0160] Embodiment 2: A mobile phone cover glass bubble detection system, comprising the following five modules:
[0161] Image acquisition and denoising module: bilateral filtering is used to remove noise from the collected mobile phone cover glass images;
[0162] Image segmentation module: Based on the minimum error threshold segmentation method, the denoised mobile phone cover glass image is segmented;
[0163] Image feature extraction module: extracts the features of bubbles in the candidate area image, and obtains the features of the candidate area image based on the features of the bubbles and the segmentation results corresponding to the candidate area image and the candidate area image;
[0164] Network construction module: constructs a bubble classification network and updates network parameters to obtain a trained bubble classification network;
[0165] Network application module: Apply the trained bubble classification network to obtain bubble detection results.
[0166] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0167] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0168] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for detecting bubbles in mobile phone cover glass, characterized in that: The following steps are involved: S1: Use bilateral filtering to remove noise from the collected mobile phone cover glass image to obtain the denoised mobile phone cover glass image, including: Process each pixel in the collected mobile phone cover glass image and extract the pixel centered on the current processing pixel. The pixels within the window size and the corresponding weights are calculated, and the weights are calculated as follows: ; Among them, (i,j) represents the position of the current processing pixel in the mobile phone cover glass image; (m,n) represents the center of the current processing pixel. The position of one of the pixels in the window in the image of the phone cover glass; is a natural constant; I represents the image of the mobile phone cover glass; and are the pixel values of the mobile phone cover glass image at positions (i, j) and (m, n) respectively; and There are two parameters used to control the size of the weight; Based on the calculated weights, the pixel value of the currently processed pixel after denoising is calculated as follows: ; in, is the pixel value of the denoised mobile phone cover glass image at position (i, j); According to the above calculation method, the same processing is performed on each pixel of the mobile phone cover glass image until all pixel positions are processed to obtain the denoised mobile phone cover glass image ; S2: Based on the minimum error threshold segmentation method, the denoised mobile phone cover glass image is segmented to obtain the candidate area image of the bubble; S3: extracting features of bubbles in the candidate region picture, wherein the features of the bubbles include the area, perimeter, roundness, and compactness of the bubbles; obtaining features of the candidate region picture based on the features of the bubbles, the candidate region picture, and the segmentation results corresponding to the candidate region picture; S4: construct a bubble classification network and update the network parameters to obtain a trained bubble classification network; S5: Perform steps S1-S3 on the image of the mobile phone cover glass to be detected, input the features of the obtained candidate area image into the bubble classification network trained in step S4, and obtain the bubble detection result.
2. The method for detecting bubbles in mobile phone cover glass according to claim 1, characterized in that: The S2 step includes: S21: According to the probability distribution, the Modeling: ; Among them, u is The pixel value of the pixel in ; for Probability distribution model of ; and are the prior probabilities of background and bubble respectively, and and are the distribution of background and bubble respectively, and the expression is: ; in, and To control the parameters of the background distribution, and is the parameter to control the bubble distribution; The prior probabilities of the background and bubbles are calculated according to different segmentation thresholds, and the corresponding parameters for controlling the background distribution and bubble distribution are calculated, including: Given a segmentation threshold t, the background segmentation threshold set and bubble segmentation threshold set They are: ; Among them, T represents the denoised mobile phone cover glass image The maximum value of the pixel value in; At this segmentation threshold, the prior probability of background and bubbles is and They are: ; Among them, N represents the denoised mobile phone cover glass image The number of pixels in Image of mobile phone cover glass after denoising The number of pixels with pixel value v in the Based on the prior probabilities of background and bubbles, the corresponding calculation formulas for the parameters controlling background distribution and bubble distribution are: ; S22: According to the minimum error principle, construct the objective function: ; Optimal segmentation threshold When the objective function U takes the minimum value, it is obtained: ; S23: Calculate the segmentation result based on the optimal segmentation threshold: ; in, The segmentation result of the mobile phone cover glass image after denoising The pixel value at position (i, j); 0 means The pixel at (i, j) is the background, 1 means The pixel at (i, j) is a bubble; Segmentation results based on denoised mobile phone cover glass images , according to the position where the pixel value is 1, the denoised mobile phone cover glass image is captured The part where each bubble is located is obtained to obtain the candidate area image of the bubble.
3. The method for detecting bubbles in mobile phone cover glass according to claim 2, characterized in that: The S3 step includes: Based on the candidate region picture of each bubble obtained in step S2, extracting features of the bubble in the candidate region picture, wherein the features of the bubble include the area, perimeter, roundness, and compactness of the bubble; The area of the bubble is obtained by counting the number of pixels of the bubble in the candidate area image, and the calculation method is: ; in, is the cumulative function, A is the segmentation result corresponding to the candidate area image, and the segmentation result of the mobile phone cover glass image after denoising is intercepted The area where the candidate area picture is located is obtained; The perimeter of the bubble is obtained by counting the number of edge pixels, and the calculation method is: ; in, It is the gradient calculation function of the candidate area image; is the edge map of the candidate region image, which has the same size as the candidate region image. The pixel value of 1 represents edge pixels, and 0 represents non-edge pixels; The number of pixels in the middle edge obtains the perimeter of the bubble, that is, the perimeter of the bubble ; Calculate the roundness of the bubble based on the bubble area and perimeter and compactness : ; in, is the area of the minimum circumscribed rectangle of the bubble; Based on the features of the bubbles, the candidate region images, and the segmentation results corresponding to the candidate region images, the features of the candidate region images are obtained: ; in, is the candidate region picture; is the feature of the candidate region image; and Respectively and Copy to the candidate area picture Results with the same size.
4. The method for detecting bubbles in mobile phone cover glass according to claim 3, characterized in that: The S4 step includes: S41: The features of the candidate area image Input the bubble classification network to obtain the bubble category expected by the network: ; Wherein, Cls is the probability that the bubbles in the candidate area image predicted by the network belong to different bubble categories, which is an M-dimensional vector, where M represents the number of bubble types; DNN is the bubble classification network; S42: Calculate the loss function based on the bubble category predicted by the bubble classification network and update the network parameters: The loss function is calculated as follows: ; in, Indicates that if the candidate region contains If there is a bubble category, its value is 1, otherwise it is 0; and They respectively indicate that the network predicts that the candidate region contains Bubble type and The probability of each bubble category; S43: Perform iterative update: The update of the bubble classification network parameters is: ; in, and b are the weight and bias of the bubble classification network, respectively, which are parameters obtained through continuous iterative learning; and Represents the current iteration state and the gradient of b; is the learning rate of the network, which is used to control the amplitude of each update of the network parameters; Repeat step S43 until the specified number of iterations is reached to obtain a trained bubble classification network.
5. The method for detecting bubbles in mobile phone cover glass according to claim 4, characterized in that: The S5 step includes: The image of the mobile phone cover glass to be detected is processed through steps S1-S3 to obtain the features of the candidate area image of the mobile phone cover glass to be detected ; Will Input to the bubble classification network trained in step S4, specifically: ; in, The trained bubble classification network; is the probability that the bubbles in the candidate area image of the mobile phone cover glass image to be detected belong to different bubble categories predicted by the trained network, which is an M-dimensional vector; The bubble category corresponding to the serial number of the dimension with the largest value in the vector is the bubble detection result, which is: ; in, Returns Get the maximum value .
6. A mobile phone cover glass bubble detection system, characterized in that: include: Image acquisition and denoising module: bilateral filtering is used to remove noise from the collected mobile phone cover glass images; Image segmentation module: Based on the minimum error threshold segmentation method, the denoised mobile phone cover glass image is segmented; Image feature extraction module: extracts the features of bubbles in the candidate area image, and obtains the features of the candidate area image based on the features of the bubbles and the segmentation results corresponding to the candidate area image and the candidate area image; Network construction module: constructs a bubble classification network and updates network parameters to obtain a trained bubble classification network; Network application module: Apply the trained bubble classification network to obtain bubble detection results; To realize a mobile phone cover glass bubble detection method as described in any one of claims 1-5.
Citation Information
Patent Citations
Method and device for rapidly detecting and classifying defects of glass image
CN101996405A
Method for detecting and classifying glass defects based on machine vision
CN102305798A