A mobile terminal assembly defect detection method based on machine vision
By distinguishing between point-like and region-like noise in mobile terminal images, an adaptive filtering window is constructed for bilateral filtering, which solves the shortcomings of traditional bilateral filtering in balancing noise suppression and detail preservation, and improves detection accuracy.
Patent Information
- Application Number
- CN202511163837.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-20
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2045-08-20
AI Technical Summary
In existing technologies, traditional bilateral filtering is difficult to balance noise suppression and detail preservation in mobile terminal image denoising, resulting in low detection accuracy.
By analyzing the degree of local mutation and positional relationship of each pixel in the grayscale image, suspected noise pixels are distinguished, and an adaptive filtering window is constructed to perform bilateral filtering to process point-like and regional noise respectively.
It improves image denoising while preserving important details, thus enhancing the accuracy of mobile terminal assembly defect detection.
Smart Images

Figure CN121095160B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method for detecting assembly defects in mobile terminals based on machine vision. Background Technology
[0002] With the rapid development of mobile communication technology and smart devices, mobile terminals have gradually become essential tools for people's daily lives and work. As a major power supplier and service provider in China, the State Grid Corporation of China requires its portable mobile service terminals to possess high efficiency, stability, and reliability to cope with various complex working environments and high-intensity tasks. Portable mobile service terminals are mainly used for on-site power services, equipment maintenance, and emergency operations; therefore, the precision, reliability, and stability of their hardware components are extremely important, making assembly quality control of mobile terminals particularly crucial during the production process.
[0003] For the assembly quality inspection of mobile terminals, most methods involve capturing images of the assembled mobile terminals and then performing quality inspection based on the captured images. However, because the circuit boards of mobile terminals contain many components, and the image acquisition process is easily affected by external interference and production noise, such as reflections on the surface of component metal parts and dust falling onto the component surface during assembly, noise can obscure component features, resulting in low image quality and significantly reducing the accuracy of inspection. Therefore, before inspecting the assembly quality of mobile terminals, the captured images should be denoised to ensure image quality.
[0004] Existing technologies use traditional Gaussian filtering to denoise images from mobile terminals. Although this method is simple and only considers the spatial domain, it can significantly blur the edges of components and has poor preservation of high-frequency details. Therefore, bilateral filtering, which considers both spatial information and grayscale similarity, is better. However, traditional bilateral filtering uses a fixed window size, which makes it difficult to balance noise suppression and detail preservation. Large windows can easily blur the edges of components and require a large amount of computation; small windows, on the other hand, are insufficient for denoising, resulting in poor image quality after denoising. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a machine vision-based method for detecting assembly defects in mobile terminals, in order to solve the problem of poor denoising effect when using traditional bilateral filtering to denoise images of mobile terminals.
[0006] This invention provides a machine vision-based method for detecting assembly defects in mobile terminals, comprising the following steps:
[0007] The assembled mobile terminal is image acquired to obtain a mobile terminal image, and a grayscale image of the mobile terminal image is obtained; based on the difference in grayscale value and gradient value between each pixel and its local pixels in the grayscale image, at least one suspected noise pixel is selected.
[0008] Edge detection is performed on the grayscale image to obtain the corresponding edge image. Connectivity analysis is performed on the edge image to obtain at least one connected component. Based on the positional relationship between each suspected noise pixel and the edge pixel and the connected component, at least one suspected point noise pixel and one suspected region noise pixel are obtained from all suspected noise pixels.
[0009] In the grayscale image, a multi-scale window is constructed for each of the suspected point noise pixels to obtain the noise level of each of the suspected point noise pixels. Based on the shape features of the connected domain to which each of the suspected noise pixels belongs, the noise level of each of the suspected noise pixels is obtained.
[0010] Based on the noise level of each suspected point noise pixel and the noise level of each suspected regional noise pixel, an adaptive filtering window is obtained for each pixel in the grayscale image. The grayscale image is then subjected to bilateral filtering based on the adaptive filtering window for each pixel to obtain a denoised image. The assembly defect detection of the mobile terminal is then performed based on the denoised image.
[0011] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:
[0012] This invention distinguishes between single-point noise and regional noise among suspected noise pixels based on the degree of local abrupt change of each pixel in a grayscale image. That is, suspected point-like noise pixels and suspected regional noise pixels, in order to exclude edge pixels belonging to normal regions among suspected noise pixels. Then, the noise level of each suspected point-like noise pixel and suspected regional noise pixel is analyzed to obtain an adaptive filtering window based on the noise level. This allows for flexible image denoising while greatly improving the preservation of important image details, thus making defect detection in mobile terminal assembly based on denoised images more accurate. Attached Figure Description
[0013] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1This is a flowchart of a method for detecting assembly defects in mobile terminals based on machine vision, provided in Embodiment 1 of the present invention.
[0015] Figure 2 This is a schematic diagram of a mobile terminal image provided in an embodiment of the present invention. Detailed Implementation
[0016] Embodiments of this disclosure are described in detail below, with examples of these embodiments illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting it.
[0017] It should be noted that the terms "first," "second," etc., used in this disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure.
[0018] To illustrate the technical solution of the present invention, specific embodiments are described below.
[0019] See Figure 1 This is a flowchart of a method for detecting assembly defects in mobile terminals based on machine vision, as provided in Embodiment 1 of the present invention. Figure 1 As shown, the method may include:
[0020] Step S101: Image acquisition is performed on the assembled mobile terminal to obtain a mobile terminal image, and a grayscale image of the mobile terminal image is obtained; based on the difference in grayscale value and gradient value between each pixel and its local pixels in the grayscale image, at least one suspected noise pixel is selected.
[0021] After the mobile terminal is assembled, it is placed on a conveyor belt. An image acquisition device, including a high-definition camera and lighting, is fixed at a position on the conveyor belt. When the assembled mobile terminal passes the image acquisition device, it pauses for 0.5 seconds to capture an image of the mobile terminal. Figure 2 As shown.
[0022] When using bilateral filtering to denoise mobile terminal images, the size of the bilateral filtering window determines the denoising intensity and, consequently, the image quality after denoising. However, traditional bilateral filtering uses a fixed window size, making it difficult to balance noise suppression and detail preservation. Large windows tend to blur the edges of components and require a large amount of computation; small windows, on the other hand, result in insufficient denoising, leading to poor image quality after denoising. Therefore, in order to ensure the denoising effect of mobile terminal images, this embodiment of the invention divides the pixels in the mobile terminal image. Normal pixels are filtered using small windows or not filtered at all to preserve the details of each component, while noisy pixels are effectively denoised using larger windows, facilitating more accurate defect identification during subsequent defect detection.
[0023] Based on the above analysis, firstly, the mobile terminal image is converted to grayscale to obtain a corresponding grayscale image. Grayscale conversion is an existing technology and will not be elaborated here. Then, the grayscale value and gradient value of each pixel in the grayscale image are obtained. The methods for obtaining grayscale values and gradient values are also existing technologies and will not be elaborated here. Finally, based on the differences in grayscale values and gradient values between each pixel and its local pixels in the grayscale image, at least one suspected noise pixel is selected. The specific selection method is as follows:
[0024] Considering that pixels belonging to noise regions generally exhibit abrupt changes compared to surrounding pixels, i.e., a large difference in grayscale from the local area and a large gradient value, a local window of a preset size is constructed centered on any pixel in the grayscale image. Preferably, since noise regions are generally single-point or small noise regions, a smaller window is used, so the preset size is set to 5×5, which is not limited here. The absolute value of the grayscale difference between each pixel in the local window and any given pixel is calculated, and all the absolute values of grayscale difference are accumulated to obtain the accumulated value. The ratio between the accumulated value and the number of pixels in the local window is taken as the local grayscale deviation degree of any given pixel, and the product of the gradient value of any given pixel and the local grayscale deviation degree is taken as the local abrupt change degree of any given pixel.
[0025] The degree of local mutation of each pixel in the grayscale image is obtained. A preset mutation degree threshold is set to 0.7. Pixels with a local mutation degree greater than or equal to the preset mutation degree threshold are recorded as suspected noise pixels, thus obtaining at least one suspected noise pixel in the grayscale image.
[0026] In one embodiment, taking the i-th pixel as an example, the formula for calculating the degree of local mutation of the i-th pixel is:
[0027]
[0028] in, The degree of local mutation at the i-th pixel. Let be the gradient value of the i-th pixel. Let be the number of pixels in the local window of the i-th pixel. Let be the grayscale value of the i-th pixel. Let be the grayscale value of the j-th pixel, where | represents the absolute value sign.
[0029] It should be noted that, The larger the value, the greater the grayscale difference between the i-th pixel and its surrounding pixels, and the greater the likelihood that the pixel is a sudden change pixel. The larger the value, the more the i-th pixel deviates from the gray values of the surrounding pixels, and the greater the degree of local mutation of the i-th pixel.
[0030] Step S102: Perform edge detection on the grayscale image to obtain the corresponding edge image, perform connected component analysis on the edge image to obtain at least one connected component, and obtain at least one suspected point noise pixel and one suspected region noise pixel from all suspected noise pixels based on the positional relationship between each suspected noise pixel and the edge pixel and the connected component.
[0031] After obtaining the degree of local mutation of each pixel in the grayscale image, since pixels belonging to the edge region in the image also have a high degree of local mutation, and noise is generally divided into single-point noise and regional noise, it is necessary to exclude edge pixels belonging to the normal region from the suspected noise pixels, so as to use a larger filtering window to denoise the suspected point noise pixels (that is, single-point noise points) and suspected regional noise pixels, thereby improving the denoising effect.
[0032] In this embodiment of the invention, edges in a grayscale image are first detected using an edge detection method to obtain the corresponding edge image and edge and non-edge pixels. Then, connected component analysis is performed on the edge image to obtain multiple connected components in the grayscale image. Both edge detection and connected component analysis are existing technologies and will not be elaborated upon here. Furthermore, based on the characteristics of each suspected noise pixel in the connected components and its positional relationship with edge pixels and connected components, the probability that a suspected noise pixel belongs to a point-like noise point or a suspected region-like noise pixel is obtained, so as to obtain at least one suspected point-like noise pixel and one suspected region-like noise pixel from all suspected noise pixels. The specific method is as follows:
[0033] Suspected point noise pixels exist alone and appear as having no associated connected component in a grayscale image. Suspected region noise pixels, on the other hand, are pixels within a region and appear as having an associated connected component in a grayscale image, with a smaller area of the connected component. Therefore, for any suspected noise pixel, we obtain the pixels within its eight-neighborhood. If there are no edge pixels within the eight-neighborhood, the suspected noise pixel is considered a suspected point noise pixel, meaning the probability of it belonging to the suspected point noise pixel category is 1. Conversely, if at least one edge pixel exists within the eight-neighborhood, we obtain the associated connected component of the suspected noise pixel. Based on this component, we obtain a probability index that the suspected noise pixel belongs to the suspected region noise pixel category: we calculate the area of the associated connected component and use the negative of this area as the independent variable of an exponential function with the natural constant as its base. It is worth noting that the area of a connected region refers to the number of pixels contained within that region. A preset probability threshold of 0.8 is set, but this is not limited here. If the probability index is greater than or equal to the preset probability threshold, then any noise pixel is considered a suspected region noise pixel. Similarly, each suspected noise pixel is traversed to obtain suspected point-like noise pixels and suspected region noise pixels.
[0034] In one embodiment, taking the j-th suspected noise pixel as an example, the formula for calculating the probability index that the j-th suspected noise pixel belongs to the suspected region noise pixel is as follows:
[0035]
[0036] in, This represents the probability that the j-th suspected noise pixel belongs to the suspected noise pixel region. This represents an exponential function with the natural constant as its base. This represents the area of the connected region to which the j-th suspected noise pixel belongs.
[0037] It should be noted that the area of the connected region to which the j-th suspected noise pixel belongs is more likely to be regional noise.
[0038] At this point, the pixels in the grayscale image are divided into normal pixels, suspected point noise pixels, and suspected area noise pixels.
[0039] Step S103: Construct a multi-scale window for each suspected point noise pixel in the grayscale image, obtain the noise level of each suspected point noise pixel, and obtain the noise level of each suspected noise pixel according to the shape features of the connected domain to which each suspected noise pixel belongs.
[0040] Since both point noise and the point texture of the component shell in the normal area exhibit single-point distribution, it is easy to confuse the shell texture with point noise. Therefore, it is also necessary to analyze the noise level by combining the local distribution characteristics of each suspected point noise pixel. Since point noise is randomly distributed in any area of the image, has irregular texture, and the similarity of noise pixels is low; while the point texture of the component shell exhibits a uniform texture distribution and high grayscale similarity, in this embodiment of the invention, a multi-scale window is constructed for each suspected point noise pixel in the grayscale image, centered on each suspected point noise pixel. The multi-scale window includes three windows of different sizes, such as 5×5, 7×7, and 9×9, which are not limited here. Then, the noise level of each suspected point noise pixel is obtained through the multi-scale window. The specific method for obtaining this information is as follows:
[0041] For any suspected point-like noise pixel, any window is taken as the target window. Based on the standard deviation of the gray values of all suspected point-like noise pixels within the target window, a gray-level consistency index is obtained. The gray-level co-occurrence matrix of the target window is obtained. Based on the gray-level co-occurrence matrix of the target window, the product of autocorrelation and inverse difference is obtained and denoted as the texture uniformity index of the target window. The product of the reciprocal of the texture uniformity index and the gray-level consistency index is denoted as the noise probability corresponding to the target window. The noise probability corresponding to each window is obtained, and the mean noise probability is denoted as the noise level of any suspected point-like noise pixel.
[0042] In one embodiment, the expression for calculating the noise level of any suspected point-like noise pixel is:
[0043]
[0044] in, This represents the noise level of any suspected point-like noise pixel, where N represents the number of windows contained in the multi-scale window. This represents the standard deviation of the grayscale values of all suspected point-like noise pixels within the nth window. This represents the autocorrelation of the gray-level co-occurrence matrix of the nth window. This represents the inverse difference of the gray-level co-occurrence matrix of the nth window.
[0045] It should be noted that, Used to characterize the grayscale consistency of suspected point-like noise pixels within a window. The larger the value, the worse the grayscale consistency, the more irregular the texture within the window, the greater the possibility of it being a noise pixel, and the greater its noise level. This is used to reflect the uniformity and regularity of texture within a window. The more uniform and regular the texture within a window, the more it conforms to the characteristics of a normal texture area, meaning it is less likely to belong to a noise area. The larger the value, the more uniform and regular the texture features within the window, and the lower the corresponding noise level.
[0046] Similarly, following the above method for obtaining noise levels, the noise level of each suspected point-like noise pixel is obtained. Secondly, noise areas such as dust and reflective spots are typically small areas, as are normal areas such as solder pads and BGA solder balls in the component. Therefore, to prevent normal component areas from being mistakenly identified as noise areas, it is necessary to combine the local features of each suspected noise pixel to obtain its corresponding noise level.
[0047] Although the area of the noise region is small, its random shape results in irregular and poorly defined edges. In contrast, normal regions such as solder pads and BGA solder balls are manufactured according to specific requirements, resulting in regular and well-defined edges. Therefore, the noise level can be determined based on the connected component characteristics of each suspected noise pixel: for any suspected noise pixel, the connected component to which it belongs is denoted as the target connected component. Since solder pads and BGA solder balls exhibit regular circular or rectangular shapes, while noise regions have no fixed shape, the regularity of the target connected component is obtained through the roundness and rectangle fitting degree of each region. This means obtaining the roundness of the target connected component. The absolute value of the first difference between the constant 1 and the roundness is calculated. The ratio between the area of the target connected component and the area of its smallest bounding rectangle is obtained. The absolute value of the second difference between the constant 1 and the ratio is calculated. The sum of the first and second absolute differences is taken as the regional irregularity of the target connected component.
[0048] Meanwhile, since the normal region is a rule-defined region, its edges are clear, while the noise region is randomly formed and has various causes of formation, so its edges are blurry. Therefore, all edge pixels on the target connected region are obtained, and any edge pixel is taken as the target point. The normal of the target point is obtained, and the gradient mean of a preset number of pixels adjacent to the target point is obtained in the direction of the normal. This is recorded as the edge width of the target point. The edge width of each edge pixel is obtained, and the cumulative edge width value is obtained. The preset number is 3, which is not limited here.
[0049] Then, based on the gradient value of each edge pixel in the target connected region, the mean gradient value and the standard deviation of the gradient value are obtained. The product of the mean gradient value and the standard deviation of the gradient value is calculated. The product of the reciprocal of the product and the cumulative edge width is recorded as the edge ambiguity of the target connected region. The product of the probability index of any suspected noise pixel belonging to the suspected noise pixel, the region irregularity, and the edge ambiguity is used as the noise level of any suspected noise pixel.
[0050] In one embodiment, taking the j-th suspected noise pixel as an example, the formula for calculating the noise level of the j-th suspected noise pixel is as follows:
[0051]
[0052] in, This indicates the noise level of the j-th suspected noise pixel. This represents the probability that the j-th suspected noise pixel belongs to the suspected noise region. This represents the roundness of the connected component to which the j-th suspected noise pixel belongs. This represents the area of the connected region to which the j-th suspected noise pixel belongs. Let represent the area of the minimum bounding rectangle of the connected region to which the j-th suspected noise pixel belongs. Let represent the average gradient value of all edge pixels within the connected region to which the j-th suspected noise pixel belongs. This represents the standard deviation of the gradient values of all edge pixels within the connected region to which the j-th suspected noise pixel belongs. This represents the average gradient of a predetermined number of pixels adjacent to the y-th edge pixel along the direction of the normal of the y-th edge pixel within the connected region to which the j-th suspected noise pixel belongs. This represents the number of edge pixels within the connected component to which the j-th suspected noise pixel belongs, where 1 represents a constant and || represents the absolute value sign.
[0053] It should be noted that, Used to reflect the edge width of each edge pixel The larger the value, the larger the gradient of the pixels around the connected component, the wider the edge of the connected component, the more blurred the edge, the more it conforms to the characteristics of noise, and the greater the degree of noise. Used to characterize edge sharpness The larger the value, the clearer the edge of the connected region to which the j-th suspected noise pixel belongs, the less it conforms to the characteristics of noise, and the smaller the corresponding noise level. The larger, The larger the value, the more regular the shape of the connected region to which the j-th suspected noise pixel belongs, the more it conforms to the characteristics of a normal region, and the smaller the corresponding noise level.
[0054] Similarly, the noise level of each suspected noise pixel is obtained. Thus, the noise levels of each suspected point-like noise pixel and each suspected region-like noise pixel are obtained.
[0055] Step S104: Based on the noise level of each suspected point noise pixel and the noise level of each suspected area noise pixel, obtain the adaptive filtering window of each pixel in the grayscale image, perform bilateral filtering on the grayscale image based on the adaptive filtering window of each pixel to obtain a denoised image, and perform assembly defect detection of the mobile terminal based on the denoised image.
[0056] After obtaining the noise level of each pixel in the grayscale image, that is, the noise level of each suspected point noise pixel and the noise level of each suspected area noise pixel, the greater the noise level, the greater the probability that it is noise, and a larger filtering window is needed to remove noise interference. Similarly, the smaller the noise level, the smaller the filtering window is needed for denoising processing to preserve image details. Therefore, in this embodiment of the invention, an adaptive filtering window for each pixel in the grayscale image is obtained based on the noise level of each suspected point noise pixel and the noise level of each suspected area noise pixel, and is used to perform adaptive bilateral filtering processing on the grayscale image.
[0057] The method for obtaining the adaptive filtering window for each pixel in the grayscale image is as follows:
[0058] For any pixel in the grayscale image, if the pixel is a normal pixel, no adaptive filtering window is set. A normal pixel refers to a pixel that is neither suspected to be dot-like noise nor a pixel suspected to be a region-like noise pixel. If the pixel is suspected to be dot-like noise, the product of the noise level of the pixel and the preset maximum filtering window size is obtained, and the product is rounded down to obtain the size of the adaptive filtering window for that pixel. If the pixel is suspected to be a region-like noise pixel, the product of the noise level of the pixel and the preset maximum filtering window size is obtained, and the product is rounded down to obtain the size of the adaptive filtering window for that pixel.
[0059] In one implementation, normal pixels in a grayscale image are not subjected to bilateral filtering; the original image information is preserved, and the size of their adaptive filtering window is 0. For suspected point-like noise pixels or suspected region-like noise pixels, the size of the adaptive filtering window is determined based on the noise level. The formula for calculating the size of the adaptive filtering window is as follows:
[0060]
[0061] in, Indicates the size of the adaptive filtering window. This indicates the noise level of any suspected point-like noise pixel. This indicates the noise level of any suspected noisy pixel. This indicates the preset maximum filter window size. This indicates the floor function.
[0062] It should be noted that, Set to an odd number, such as 1×1, 3×3, 5×5, 7×7, etc., corresponding to... The maximum value of the filtering window here is set according to user needs. The greater the noise level, the larger the filtering window, and the better the noise reduction effect. When the pixel is a suspected point-like noise pixel, When a pixel is a suspected noise pixel in the region, .
[0063] At this point, the size of the adaptive filtering window for each pixel in the grayscale image can be obtained. Then, bilateral filtering is performed on the grayscale image based on the adaptive filtering window for each pixel to obtain a denoised image. Bilateral filtering is an existing technology and will not be elaborated upon here. After obtaining the denoised image, machine learning is needed to perform assembly defect detection on it. Before this, a defect detection model for the mobile terminal needs to be obtained: First, manually labeled images of mobile terminals containing defects such as scratches and excessive gaps are acquired; a lightweight convolutional neural network (such as MobileNet or YOLO object detection framework) is trained on the labeled data, balancing detection accuracy and mobile terminal deployment efficiency; the trained defect model is embedded into the edge computing device of the production line, and after image denoising, the assembly image in the mobile terminal is analyzed in real time, and the defect location, type, and confidence level are output, triggering alarms or automatic sorting for defective products. It is worth noting that using machine learning for defect detection in denoised images is an existing technology and will not be elaborated upon here.
[0064] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for detecting assembly defects of a mobile terminal based on machine vision, characterized by, The method comprises: image acquisition is performed on the assembled mobile terminal to obtain a mobile terminal image, and a gray image of the mobile terminal image is acquired; at least one suspected noise pixel point is screened according to the gray value difference and the gradient value difference between each pixel point in the gray image and local pixel points thereof; edge detection is performed on the gray image to obtain a corresponding edge image, connected domain analysis is performed on the edge image to obtain at least one connected domain, and at least one suspected point noise pixel point and a suspected area noise pixel point are acquired from all suspected noise pixel points according to the positional relationship between each suspected noise pixel point and edge pixel points and connected domains; a multi-scale window of each suspected point noise pixel point is constructed in the gray image, the noise degree of each suspected point noise pixel point is acquired, and the noise degree of each suspected area noise pixel point is acquired according to the shape feature of the connected domain to which each suspected area noise pixel point belongs; an adaptive filtering window of each pixel point in the gray image is acquired according to the noise degree of each suspected point noise pixel point and the noise degree of each suspected area noise pixel point, bilateral filtering is performed on the gray image according to the adaptive filtering window of each pixel point to obtain a denoising image, and assembly defect detection of the mobile terminal is performed according to the denoising image.
2. The method of claim 1, wherein the method comprises: The at least one suspected noise pixel point is screened according to the gray value difference and the gradient value difference between each pixel point in the gray image and local pixel points thereof, and comprises: For any pixel point in the gray image, a local window of a preset size is constructed with the any pixel point as the center, the absolute value of the gray value difference between each pixel point in the local window and the any pixel point is calculated, the absolute values of all gray value differences are accumulated to obtain an accumulated value, the ratio between the accumulated value and the number of pixel points in the local window is taken as the local gray deviation degree of the any pixel point, and the product between the gradient value of the any pixel point and the local gray deviation degree is taken as the local mutation degree of the any pixel point; the local mutation degree of each pixel point in the gray image is acquired, the pixel point with a local mutation degree greater than or equal to a preset mutation degree threshold is recorded as a suspected noise pixel point, and at least one suspected noise pixel point in the gray image is obtained.
3. The method of claim 1, wherein the method comprises: The at least one suspected point noise pixel point and the suspected area noise pixel point are acquired from all suspected noise pixel points according to the positional relationship between each suspected noise pixel point and edge pixel points and connected domains, and comprise: For any suspected noise pixel point, if there is no edge pixel point in the eight-neighbor domain of the any suspected noise pixel point, the any suspected noise pixel point is taken as a suspected point-like noise pixel point; if there is at least one edge pixel point in the eight-neighbor domain of the any suspected noise pixel point, according to the connected domain to which the any suspected noise pixel point belongs, a possibility index of the any suspected noise pixel point belonging to a suspected area noise pixel point is obtained, and if the possibility index is greater than or equal to a preset possibility threshold, the any noise pixel point is taken as a suspected area noise pixel point.
4. The method of claim 3, wherein the method further comprises: The possibility index of the any suspected noise pixel point belonging to a suspected area noise pixel point is obtained according to the connected domain to which the any suspected noise pixel point belongs, and includes: The area of the connected domain to which the any suspected noise pixel point belongs is counted, and the reciprocal of the connected domain area is taken as an independent variable of an exponential function with a natural constant as a base number, to obtain the possibility index of the any suspected noise pixel point belonging to a suspected area noise pixel point.
5. The method of claim 1, wherein the method further comprises: The multi-scale window includes three windows of different sizes, and the multi-scale window of each suspected point-like noise pixel point is constructed in the gray-scale image to obtain the noise degree of each suspected point-like noise pixel point, including: For any suspected point-like noise pixel point, any window is taken as a target window, a gray-scale consistency index is obtained according to the gray-scale value standard deviation of all suspected point-like noise pixel points in the target window, a gray-scale co-occurrence matrix of the target window is obtained, a product of autocorrelation and inverse distance is obtained according to the gray-scale co-occurrence matrix of the target window, and is recorded as a texture uniformity index of the target window, and a product of the reciprocal of the texture uniformity index and the gray-scale consistency index is recorded as a noise probability corresponding to the target window. The noise probability corresponding to each window is obtained, and a noise probability mean value is obtained, which is recorded as the noise degree of any suspected point-like noise pixel point.
6. The machine vision-based mobile terminal assembly defect detection method of claim 3, wherein, The noise degree of each suspected area noise pixel point is obtained according to the shape feature of the connected domain to which each suspected area noise pixel point belongs, and includes: For any suspected area noise pixel point, the connected domain to which the any suspected area noise pixel point belongs is recorded as a target connected domain, the circularity of the target connected domain is obtained, the first difference absolute value between a constant 1 and the circularity is calculated, the ratio between the area of the target connected domain and the area of the minimum circumscribed rectangle thereof is obtained, the second difference absolute value between a constant 1 and the ratio is calculated, and the sum of the first difference absolute value and the second difference absolute value is taken as the area irregularity of the target connected domain. The edge pixel points of the target connected domain are obtained, any edge pixel point is taken as a target point, the normal line of the target point is obtained, the gradient mean value of a preset number of pixel points adjacent to the target point in the direction of the normal line is obtained, which is recorded as the edge width of the target point, the edge width of each edge pixel point is obtained, and the edge width cumulative value is obtained. According to the gradient value of each edge pixel point of the target connected domain, an average gradient value and a gradient value standard deviation are obtained, a multiplication value between the average gradient value and the gradient value standard deviation is calculated, and a product of an inverse of the multiplication value and the edge width accumulation value is recorded as an edge fuzziness of the target connected domain; A product between the possibility index of the any suspected regional noise pixel point belonging to a suspected regional noise pixel point, the region irregularity, and the edge fuzziness is taken as a noise degree of the any suspected regional noise pixel point.
7. The machine vision-based mobile terminal assembly defect detection method of claim 1, wherein, The adaptive filtering window of each pixel point in the gray-scale image is obtained according to the noise degree of each suspected point noise pixel point and the noise degree of each suspected regional noise pixel point, and includes: For any pixel point in the gray-scale image, if the any pixel point is a normal pixel point, no adaptive filtering window is set, wherein the normal pixel point refers to a non-suspected point noise pixel point and a non-suspected regional noise pixel point; if the any pixel point is a suspected point noise pixel point, a product between the noise degree of the any pixel point and a preset maximum filtering window size is obtained, the product is down-rounded to obtain a size of the adaptive filtering window of the any pixel point; if the any pixel point is a suspected regional noise pixel point, a product between the noise degree of the any pixel point and the preset maximum filtering window size is obtained, and the product is down-rounded to obtain the size of the adaptive filtering window of the any pixel point.
Citation Information
Patent Citations
Illuminator accessory defect detection method based on machine vision
CN116363133A
Artificial board defective product rapid tracing method and system based on big data
CN116740065A