Voice diaphragm glue breaking defect detection method and device based on improved OSTU algorithm

Through the improved OSTU algorithm, adaptive threshold segmentation and opening operations are performed, the problem of unstable threshold settings in the existing tone film glue break detection method is solved, and more efficient and accurate tone film glue break defect detection is achieved, improving the speaker production quality.

CN120339153APending Publication Date: 2025-07-18XIAMEN UNIV OF TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310716969.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-16
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

The existing method of detecting the defect of the sound film breaking defect relies on manual setting of thresholds, and the effect is not ideal when the light changes, resulting in poor adhesion between the sound film and the voice coil, affecting the sound quality of the speaker.

Method used

Adaptive threshold segmentation is used to perform adaptive threshold segmentation, and the sound film glue breaking defects are accurately detected through filtering and denoising, improved OSTU algorithm threshold segmentation and opening operations.

Benefits of technology

It improves the accuracy of the detection of the sound film glue breaking defects and the detection efficiency on the production line, ensures the quality of the speakers, and reduces the generation of defective products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120339153A_ABST
    Figure CN120339153A_ABST
Patent Text Reader

Abstract

The invention discloses a voice diaphragm glue breaking defect detection method and device based on an improved OSTU algorithm, and the method comprises the steps: obtaining a gray image of a product after a voice diaphragm and a voice coil are glued, and carrying out the filtering and denoising of the gray image, and obtaining a denoised image; carrying out threshold segmentation on the denoised image by adopting an improved OSTU algorithm to obtain an area after threshold segmentation; performing opening operation on the region after threshold segmentation to obtain a target region; and detecting the voice diaphragm glue breaking defect according to the target area to obtain a detection result. According to the method, an improved OSTU algorithm is adopted to carry out self-adaptive threshold segmentation so as to realize detection of a voice diaphragm glue breaking defect. And compared with a traditional OSTU algorithm, the method shows a good segmentation effect and a wider application occasion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing, and particularly to a method and device for detecting the glue breakage defect of the voice coil former based on an improved OSTU algorithm. Background Art

[0002] The rapid development of portable consumer electronics has increased the market demand for micro speakers, and their production quality has received more and more attention. The sound generation principle of a micro speaker is that the voice coil drives the vibration of the voice coil former under the action of electromagnetic force, and then drives the air to generate sound. The voice coil former and the voice coil are adhered together by glue. At present, in the electro-acoustic industry, most enterprises use a dispensing machine to complete the dispensing of the voice coil former. However, due to the limited process level of the dispensing machine, it is impossible to ensure that each dispensing is qualified, resulting in defects during the dispensing process. Among them, the glue breakage defect is the most common. This defect seriously affects the adhesion tightness between the voice coil former and the voice coil. If these defective products cannot be removed in time during the production process, the sound quality of the micro speaker will be greatly reduced. Therefore, after the dispensing of the voice coil former, it is necessary to detect the defective products in time.

[0003] At present, the method for detecting the glue breakage defect of the voice coil former is a visual detection method. The glue area is extracted by threshold segmentation, and the contour or parameters of the glue area are calculated to determine whether there is glue breakage. However, it is necessary to manually set the threshold, and when the illumination changes, the extraction effect of the glue area is not ideal. Summary of the Invention

[0004] In view of the above-mentioned technical problems, the purpose of the embodiments of the present application is to propose a method and device for detecting the glue breakage defect of the voice coil former based on an improved OSTU algorithm to solve the technical problems mentioned in the above background art section.

[0005] In a first aspect, the present invention provides a method for detecting the glue breakage defect of the voice coil former based on an improved OSTU algorithm, including the following steps:

[0006] S1, obtaining a grayscale image of the product after the voice coil former and the voice coil are glued, and performing filtering and denoising on the grayscale image to obtain a denoised image;

[0007] S2, performing threshold segmentation on the denoised image by using an improved OSTU algorithm to obtain a region after threshold segmentation;

[0008] S3, performing an opening operation on the region after threshold segmentation to obtain a target region;

[0009] S4, detecting the glue breakage defect of the voice coil former according to the target region to obtain a detection result.

[0010] Preferably, step S2 specifically includes:

[0011] S21. Sort the gray values of each pixel in the denoised image to obtain the first set of gray values P, and calculate the median T0 of the first set of gray values P according to the total number n of pixels in the denoised image;

[0012] S22. Perform threshold segmentation on the denoised image according to the median T0 to obtain the first region and the second region. The gray level of the denoised image is L, and the gray range is [0, L - 1]. The gray range of the first region is [0, T0 - 1], and the gray range of the second region is [T0, L - 1];

[0013] S23. Sort the gray values of each pixel in the first region to obtain the second set of gray values P', and calculate the median A1 of the second set of gray values P' according to the total number N of pixels in the first region A Calculate the median A1 of the second set of gray values P';

[0014] S24. Calculate the average value B1 of the gray values of all pixels in the second region. The calculation method is as follows:

[0015] Count the number of pixels in the second region as N B ;

[0016] The gray value of the j-th pixel in the second region is G j Then B1 is:

[0017]

[0018] S25. Calculate the average value T of A1 and B1 h , and the formula is as follows:

[0019]

[0020] S26. Calculate the absolute value Δt of the difference between T h and T0. If Δt < 1, take the average value T of A1 and B1 h as the initial segmentation threshold; if Δt ≥ 1, let T0 = T h , and repeat steps S23 - S26 until Δt < 1;

[0021] S27. Perform threshold segmentation on the denoised image according to the initial segmentation threshold and crop to obtain the initially segmented image. The gray range of the initially segmented image is [T h , L - 1];

[0022] S28. Process the initially segmented image using the OSTU algorithm to obtain the threshold-segmented region.

[0023] Preferably, step S21 specifically includes:

[0024] In response to determining that the total number n of pixel points in the denoised image is odd, T0 is the middle value in the first set P of gray values;

[0025] In response to determining that the total number n of pixel points in the denoised image is even, T0 is the average of the n / 2-th element and the (n / 2 + 1)-th element in the first set P of gray values;

[0026] Step S23 specifically includes:

[0027] In response to determining that the total number N of pixel points in the first region A is odd, A1 is the middle value in the second set P' of gray values;

[0028] In response to determining that the total number N of pixel points in the first region A is even, A1 is the average of the N / 2-th element and the (N / 2 + 1)-th element in the second set P' of gray values; A / 2 A / 2 + 1

[0029] Preferably, step S28 specifically includes:

[0030] The gray range in the initially segmented image is [T h , L - 1], the total number of pixel points in the initially segmented image is N R , the number of pixel points with gray level k is N k , then the probability that the gray level of the pixel is k is:

[0031]

[0032] And there is:

[0033]

[0034] Assume there is a threshold T. According to the threshold T, the initially segmented image is segmented into a third region and a fourth region. The gray range of the third region is [T h , T - 1], and the gray range of the fourth region is [T, L - 1];

[0035] Then the probability that the pixel in the initially segmented image is classified into the third region is:

[0036]

[0037] The probability that the pixel in the initially segmented image is classified into the fourth region is:

[0038]

[0039] The gray average value of the third region is:

[0040]

[0041] The average gray value of the fourth region is:

[0042]

[0043] The average gray value of the image after the initial segmentation is:

[0044]

[0045] The between-class variance of the image after the initial segmentation is:

[0046] σ 2 = w1(u1 - u) 2 + w2(u2 - u) 2 ;

[0047] Let the threshold T be in the range of [T h , L - 1], and increment it by 1 step by step. When the between-class variance σ 2 is the largest, the corresponding T is the optimal threshold sought;

[0048] Perform threshold segmentation on the denoised image according to the optimal threshold to obtain the region after threshold segmentation. The gray range of the region after threshold segmentation is [T, L - 1].

[0049] Preferably, in step S1, obtaining the gray image of the product after the diaphragm and voice coil are glued together specifically includes:

[0050] S11, obtaining the color image of the product after the diaphragm and voice coil are glued together, and splitting the color image into several single-channel images;

[0051] S12, performing image enhancement on several single-channel images to obtain several enhanced single-channel images;

[0052] S13, sequentially superimposing several enhanced single-channel images to obtain the superimposed image, and determining the edge of the product after the diaphragm and voice coil are glued together by performing measurement caliper interpolation fitting on the superimposed image;

[0053] S14, converting the color image into the original gray image, and cropping the original gray image according to the edge to obtain the gray image of the product after the diaphragm and voice coil are glued together.

[0054] Preferably, median filtering is used for the filtering and denoising in step S1; a circular structural element with a radius of 10 pixel is used for the opening operation in step S3.

[0055] Preferably, step S4 specifically includes:

[0056] The area_holes operator is used to calculate the area of the enclosed area in the target area, and this area is the number of pixels contained in the enclosed area in the target area;

[0057] In response to determining that the area of the enclosed area is greater than 0, it indicates that the product has no defect of broken glue on the sound film;

[0058] In response to determining that the area of the enclosed area is equal to 0, it indicates that the product has a defect of broken glue on the sound film.

[0059] In a second aspect, the present invention provides a sound film broken glue defect detection device based on an improved OSTU algorithm, including:

[0060] A denoising module, configured to obtain a grayscale image of the product after the sound film and the voice coil are glued, perform filtering and denoising on the grayscale image, and obtain a denoised image;

[0061] A segmentation module, configured to perform threshold segmentation on the denoised image by using an improved OSTU algorithm to obtain a region after threshold segmentation;

[0062] An opening operation module, configured to perform an opening operation on the region after threshold segmentation to obtain a target region;

[0063] A detection module, configured to detect the sound film broken glue defect according to the target region to obtain a detection result.

[0064] In a third aspect, the present invention provides an electronic device, including one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method described in any implementation manner in the first aspect.

[0065] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method described in any implementation manner in the first aspect is implemented.

[0066] Compared with the prior art, the present invention has the following beneficial effects:

[0067] (1) The sound film broken glue defect detection method based on the improved OSTU algorithm proposed by the present invention can perform adaptive threshold segmentation on the denoised image to achieve the detection of the sound film broken glue defect.

[0068] (2) The sound film broken glue defect detection method based on the improved OSTU algorithm proposed by the present invention can be deployed on the production line of the speaker and use the production line pictures for detection and testing, and can timely detect defective products after the sound film is dispensed, improving the production efficiency.

[0069] (3) The method for detecting the glue breakage defect of the voice coil former based on the improved OSTU algorithm proposed by the present invention has a better segmentation effect compared with the traditional OSTU algorithm, can more accurately distinguish the glue area of the voice coil former from the background area, and effectively improves the accuracy of threshold segmentation. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.

[0071] Figure 1 It is a schematic diagram of an exemplary device architecture to which an embodiment of the present application can be applied;

[0072] Figure 2 It is a schematic flowchart of the method for detecting the glue breakage defect of the voice coil former based on the improved OSTU algorithm according to the embodiment of the present application;

[0073] Figure 3 It is a flowchart of the method for detecting the glue breakage defect of the voice coil former based on the improved OSTU algorithm according to the embodiment of the present application;

[0074] Figure 4 It is an image of the edge of the product after the voice coil former and the voice coil are glued together according to the method for detecting the glue breakage defect of the voice coil former based on the improved OSTU algorithm according to the embodiment of the present application;

[0075] Figure 5 It is a grayscale image of the product after the voice coil former and the voice coil are glued together and cropped according to the method for detecting the glue breakage defect of the voice coil former based on the improved OSTU algorithm according to the embodiment of the present application;

[0076] Figure 6 It is an effect diagram of threshold segmentation of the traditional OSTU algorithm;

[0077] Figure 7 It is an effect diagram of threshold segmentation of the method for detecting the glue breakage defect of the voice coil former based on the improved OSTU algorithm according to the embodiment of the present application;

[0078] Figure 8 It is a defect detection result diagram of the method for detecting the glue breakage defect of the voice coil former based on the improved OSTU algorithm according to the embodiment of the present application;

[0079] Figure 9 It is a schematic diagram of the device for detecting the glue breakage defect of the voice coil former based on the improved OSTU algorithm according to the embodiment of the present application;

[0080] Figure 10It is a schematic structural diagram of a computer device suitable for implementing the electronic device according to the embodiments of the present application. Detailed implementation manners

[0081] To make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Apparently, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.

[0082] Figure 1 An exemplary device architecture 100 is shown that can apply the method for detecting sound film delamination defects based on the improved OSTU algorithm or the device for detecting sound film delamination defects based on the improved OSTU algorithm according to the embodiments of the present application.

[0083] As Figure 1 shown, the device architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0084] Users can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various applications can be installed on the terminal devices 101, 102, 103, such as data processing applications, file processing applications, etc.

[0085] The terminal devices 101, 102, 103 can be hardware or software. When the terminal devices 101, 102, 103 are hardware, they can be various electronic devices, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc. When the terminal devices 101, 102, 103 are software, they can be installed in the above-listed electronic devices. It can be implemented as multiple software or software modules (such as software or software modules for providing distributed services), or can be implemented as a single software or software module. No specific limitation is made here.

[0086] The server 105 can be a server that provides various services, such as a background data processing server that processes files or data uploaded by the terminal devices 101, 102, 103. The background data processing server can process the obtained files or data and generate processing results.

[0087] It should be noted that the method for detecting the glue breakage defect of the sound film based on the improved OSTU algorithm provided by the embodiments of the present application can be executed by the server 105, or can be executed by the terminal devices 101, 102, and 103. Correspondingly, the device for detecting the glue breakage defect of the sound film based on the improved OSTU algorithm can be set in the server 105, or can be set in the terminal devices 101, 102, and 103.

[0088] It should be understood that Figure 1 the numbers of the terminal devices, the network, and the server in

[0089] Figure 2 are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. In the case where the data to be processed does not need to be obtained remotely, the above device architecture may not include a network, but only a server or a terminal device.

[0090] S1. Obtain the grayscale image of the product after the sound film is glued to the voice coil, and perform filtering and denoising on the grayscale image to obtain the denoised image.

[0091] In a specific embodiment, obtaining the grayscale image of the product after the sound film is glued to the voice coil in step S1 specifically includes:

[0092] S11. Obtain the color image of the product after the sound film is glued to the voice coil, and split the color image into a plurality of single-channel images;

[0093] S12. Perform image enhancement on the plurality of single-channel images to obtain a plurality of enhanced single-channel images;

[0094] S13. Stack the plurality of enhanced single-channel images in sequence to obtain the stacked image, and determine the edge of the product after the sound film is glued to the voice coil by performing measurement caliper interpolation fitting on the stacked image;

[0095] S14. Convert the color image into the original grayscale image, and crop the original grayscale image according to the edge to obtain the grayscale image of the product after the sound film is glued to the voice coil.

[0096] In a specific embodiment, median filtering is used for filtering and denoising in step S1.

[0097] Specifically, the overall process of the method for detecting the glue breakage defect of the sound film based on the improved OSTU algorithm proposed by the embodiments of the present application is as Figure 3As shown, the color image of the product after the voice coil membrane is adhesively connected to the voice coil can be a production line picture. By using the production line picture for detection and testing, the detection of the defect of the broken adhesive of the voice coil membrane is realized. In step S11, the color image is split into three single-channel images of R, G, and B according to the following formula:

[0098]

[0099] where f(x i , y i , z i ) represents the gray value of the pixel point i in the color image, and f(x i ), f(y i ), and f(z i ) respectively represent the gray values of i in the R component, G component, and B component.

[0100] The image enhancement method in step S12 adopts linear gray transformation.

[0101] In step S13, the following formula is used to sequentially superimpose the three single-channel images:

[0102] q = (q1 + q2) * Mult + Add;

[0103] where q is the gray value of the pixel point of the superimposed image, q1 and q2 are respectively the gray values of the pixel points of the two enhanced single-channel images participating in the superposition, Mult is the proportionality coefficient, and Add is the offset. The edge is obtained by interpolation fitting according to the measuring caliper, and the voice coil membrane edge image is obtained as shown in Figure 4 .

[0104] In step S14, the following formula is used to convert the color image into a gray image:

[0105] g = 0.299 * red + 0.587 * green + 0.114 * blue;

[0106] where g is the gray value of the pixel point in the gray image, red represents the red component of the gray value of the pixel point in the color image, green represents the green component of the gray value of the pixel point in the color image, and blue represents the blue component of the gray value of the pixel point in the color image.

[0107] Image cropping reduces the image domain, and the gray image of the product after the voice coil membrane is adhesively connected to the voice coil as shown in Figure 5 is obtained. In step S1, median filtering is used to remove the noise in the image, and the denoised image is obtained.

[0108] S2. The denoised image is subjected to threshold segmentation using an improved OSTU algorithm to obtain the threshold-segmented region.

[0109] In a specific embodiment, step S2 specifically includes:

[0110] S21, sort the gray values of each pixel in the denoised image to obtain the first gray value set P, and calculate the median T0 of the first gray value set P according to the total number n of pixels in the denoised image;

[0111] S22, perform threshold segmentation on the denoised image according to the median T0 to obtain a first region and a second region. The gray level of the denoised image is L, and the gray range is [0, L - 1]. The gray range of the first region is [0, T0 - 1], and the gray range of the second region is [T0, L - 1];

[0112] S23, sort the gray values of each pixel in the first region to obtain the second gray value set P', and calculate the median A1 of the second gray value set P' according to the total number N of pixels in the first region A Calculate the median A1 of the second gray value set P';

[0113] S24, calculate the average value B1 of the gray values of all pixels in the second region. The calculation method is as follows:

[0114] Count the number of pixels in the second region as N B ;

[0115] The gray value of the j-th pixel in the second region is G j , then B1 is:

[0116]

[0117] S25, calculate the average value T of A1 and B1 h , and the formula is as follows:

[0118]

[0119] S26, calculate the absolute value Δt of the difference between T h and T0. If Δt < 1, take the average value T of A1 and B1 h as the initial segmentation threshold; if Δt ≥ 1, let T0 = T h , and repeat steps S23 - S26 until Δt < 1;

[0120] S27, perform threshold segmentation on the denoised image according to the initial segmentation threshold and crop to obtain the initially segmented image. The gray range of the initially segmented image is [T h , L - 1];

[0121] S28, process the initially segmented image using the OSTU algorithm to obtain the threshold-segmented region.

[0122] In a specific embodiment, step S21 specifically includes:

[0123] In response to determining that the total number n of pixel points in the denoised image is odd, T0 is the middle value in the first set P of gray values;

[0124] In response to determining that the total number n of pixel points in the denoised image is even, T0 is the average value of the n / 2-th element and the (n / 2 + 1)-th element in the first set P of gray values;

[0125] Step S23 specifically includes:

[0126] In response to determining that the total number N of pixel points in the first region A is odd, A1 is the middle value in the second set P' of gray values;

[0127] In response to determining that the total number N of pixel points in the first region A is even, A1 is the average value of the N / 2-th element and the (N / 2 + 1)-th element in the second set P' of gray values; A / 2 elements and the N A / 2 + 1 elements;

[0128] In a specific embodiment, step S28 specifically includes:

[0129] The gray level range in the image after the initial segmentation is [T h , L - 1], the total number of pixel points in the image after the initial segmentation is N R , the number of pixel points with gray level k is N k , then the probability that the gray level of the pixel is k is:

[0130]

[0131] And there is:

[0132]

[0133] Suppose there is a threshold T. According to the threshold T, the image after the initial segmentation is segmented into a third region and a fourth region. The gray level range of the third region is [T h , T - 1], and the gray level range of the fourth region is [T, L - 1];

[0134] Then the probability that the pixel in the image after the initial segmentation is classified into the third region is:

[0135]

[0136] The probability that the pixel in the image after the initial segmentation is classified into the fourth region is:

[0137]

[0138] The average gray value of the third region is:

[0139]

[0140] The average gray value of the fourth region is:

[0141]

[0142] The average gray value of the image after the initial segmentation is:

[0143]

[0144] The between-class variance of the image after the initial segmentation is:

[0145] σ 2 = w1(u1 - u) 2 + w2(u2 - u) 2 ;

[0146] Let the threshold T be in the range of [T h , L - 1], and increase it sequentially with a step size of 1. When the between-class variance σ 2 is the largest, the corresponding T is the optimal threshold sought;

[0147] Perform threshold segmentation on the denoised image according to the optimal threshold to obtain the region after threshold segmentation. The gray range of the region after threshold segmentation is [T, L - 1].

[0148] Specifically, in step S2, the OSTU algorithm is improved by using the method of adaptive threshold segmentation. By calculating the median T0 of the set of gray values of all pixel points in the denoised image, and using this median to perform threshold segmentation on the denoised image, it is segmented into two regions, namely the first region and the second region. Then, calculate the median A1 of the gray values of all pixel points in the first region and the average value B2 of the gray values of all pixel points in the second region respectively. Determine that Th is the initial segmentation threshold under the condition according to the average value Th of A1 and B1 and T0. Use the initial segmentation threshold Th to perform threshold segmentation on the denoised image to obtain the image after the initial segmentation, and further process the image after the initial segmentation using the OSTU algorithm to obtain the region after threshold segmentation. The OSTU algorithm used for the image after the initial segmentation belongs to the traditional OSTU algorithm.

[0149] S3. Perform an opening operation on the region after threshold segmentation to obtain the target region.

[0150] In a specific embodiment, the opening operation in step S3 uses a circular structuring element with a radius of 10 pixel.

[0151] Specifically, a circular structuring element with a radius of 10 pixels is used to perform an opening operation on the region after threshold segmentation to obtain the target region. If the traditional OSTU algorithm is used in step S2 to perform threshold segmentation on the denoised image, the segmentation effect of the obtained target region is as shown in Figure 6 shown, while the segmentation effect of the target region obtained by performing threshold segmentation on the denoised image using the improved OSTU algorithm proposed in the embodiments of the present application is as shown in Figure 7 shown. Figure 6 And Figure 7 The red regions in are the extracted target regions, that is, the glue regions. In terms of the segmentation effect, the improved OSTU algorithm of the present application can more accurately distinguish the glue region of the voice coil membrane from the background region compared with the traditional OSTU algorithm, effectively improving the accuracy of threshold segmentation.

[0152] S4. Detect the voice coil membrane glue break defect according to the target region to obtain a detection result.

[0153] In a specific embodiment, step S4 specifically includes:

[0154] Use the area_holes operator to calculate the area of the closed region in the target region, and this area is the number of pixels contained in the closed region in the target region;

[0155] In response to determining that the area of the closed region is greater than 0, it means that there is no voice coil membrane glue break defect in this product;

[0156] In response to determining that the area of the closed region is equal to 0, it means that there is a voice coil membrane glue break defect in this product.

[0157] Specifically, the area of the closed region in the target region can be calculated by the area_holes operator. If there is a closed region in the target region and the area of the closed region is greater than 0, it means that a closed figure can be formed in the target region, that is, there is no voice coil membrane glue break defect; if there is no closed region in the target region and the area of the closed region is equal to 0, it means that a closed figure cannot be formed in the target region, that is, there is a voice coil membrane glue break defect. Therefore, the detection of the voice coil membrane glue break defect can be realized. Referring to Figure 8 , there is a closed region in the target region obtained by performing threshold segmentation on the product image in the first row using the improved OSTU algorithm, so there is no voice coil membrane glue break defect, while there is no closed region in the target regions obtained by performing threshold segmentation on the product images in the second row to the fourth row using the improved OSTU algorithm, so there are voice coil membrane glue break defects. Compared with the traditional OSTU algorithm, the improved OSTU algorithm proposed in the embodiments of the present application shows good segmentation effects and a wider range of application scenarios.

[0158] Further referring to Figure 9, as an implementation of the methods shown in the above figures, an embodiment of a voice coil membrane glue breakage defect detection device based on an improved OSTU algorithm is provided in the present application. This device embodiment corresponds to Figure 2 the method embodiment shown, and this device can be specifically applied to various electronic devices.

[0159] An embodiment of the present application provides a voice coil membrane glue breakage defect detection device based on an improved OSTU algorithm, including:

[0160] A denoising module 1, configured to obtain a grayscale image of the product after the voice coil membrane is glued to the voice coil, perform filtering denoising on the grayscale image, and obtain a denoised image;

[0161] A segmentation module 2, configured to perform threshold segmentation on the denoised image using an improved OSTU algorithm to obtain a region after threshold segmentation;

[0162] An opening operation module 3, configured to perform an opening operation on the region after threshold segmentation to obtain a target region;

[0163] A detection module 4, configured to detect the voice coil membrane glue breakage defect according to the target region to obtain a detection result.

[0164] Next, refer to Figure 10 , which shows a schematic structural diagram of a computer device 1000 suitable for implementing the embodiments of the present application (such as Figure 1 the server or terminal device shown). Figure 10 The electronic device shown is only an example and should not bring any restrictions to the functions and usage scopes of the embodiments of the present application.

[0165] As Figure 10 shown, the computer device 1000 includes a central processing unit (CPU) 1001 and a graphics processing unit (GPU) 1002, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1003 or the program loaded from the storage part 1009 into the random access memory (RAM) 1004. In the RAM 1004, various programs and data required for the operation of the device 1000 are also stored. The CPU 1001, GPU 1002, ROM 1003, and RAM 1004 are connected to each other through a bus 1005. The input / output (I / O) interface 1006 is also connected to the bus 1005.

[0166] The following components are connected to the I / O interface 1006: an input section 1007 including a keyboard, a mouse, etc.; an output section 1008 including, for example, a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 1009 including a hard disk, etc.; and a communication section 1010 including a network interface card such as a LAN card, a modem, etc. The communication section 1010 performs communication processing via a network such as the Internet. A drive 1011 may also be connected to the I / O interface 1006 as needed. A removable medium 1012, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1011 as needed so that a computer program read from it is installed into the storage section 1009 as needed.

[0167] Specifically, according to an embodiment of the present disclosure, the processes described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes program code for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1010, and / or installed from the removable medium 1012. When the computer program is executed by a central processing unit (CPU) 1001 and a graphics processing unit (GPU) 1002, the above-described functions defined in the method of the present application are executed.

[0168] It should be noted that the computer-readable medium described in this application can be a computer-readable signal medium, a computer-readable medium, or any combination of the two. The computer-readable medium can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor devices, apparatuses, or components, or any combination of the above. More specific examples of the computer-readable medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, the computer-readable medium can be any tangible medium that contains or stores a program, which can be used by or in conjunction with an instruction execution device, apparatus, or component. In this application, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries the computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution device, apparatus, or component. The program code contained on the computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination of the above.

[0169] The computer program code for performing the operations of this application can be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can also be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).

[0170] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of apparatuses, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combinations of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based device that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0171] The modules described in the embodiments of the present application can be implemented in software or in hardware. The described modules can also be provided in a processor.

[0172] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device is caused to: obtain a grayscale image of the product after the voice coil and the voice diaphragm are adhesively connected, perform filtering and denoising on the grayscale image to obtain a denoised image; perform threshold segmentation on the denoised image using an improved OSTU algorithm to obtain a region after threshold segmentation; perform an opening operation on the region after threshold segmentation to obtain a target region; detect the voice diaphragm glue breakage defect based on the target region to obtain a detection result.

[0173] The above description is only for the preferred embodiments of the present application and the explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the technical solutions formed by mutually replacing the above features with the (but not limited to) technical features having similar functions disclosed in the present application.

Claims

1. A method for detecting the glue break defect of the sound film based on an improved OSTU algorithm, characterized in that It includes the following steps: S1. Obtain the grayscale image of the product after the diaphragm and voice coil are glued together, filter and denoise the grayscale image to obtain the denoised image; S2. Perform threshold segmentation on the denoised image using an improved OSTU algorithm to obtain the region after threshold segmentation; S3. Perform opening operation on the region after threshold segmentation to obtain the target region; S4. Detect the diaphragm glue break defect according to the target region to obtain the detection result.

2. The method for detecting the glue break defect of the sound film based on the improved OSTU algorithm according to claim 1, wherein, The specific steps of S2 include: S21. Sort the grayscale values of each pixel point in the denoised image to obtain the first grayscale value set P, and calculate the median T0 of the first grayscale value set P according to the total number n of pixel points in the denoised image; S22. Perform threshold segmentation on the denoised image according to the median T0 to obtain the first region and the second region. The grayscale level of the denoised image is L, and the grayscale range is [0, L - 1]. The grayscale range of the first region is [0, T0 - 1], and the grayscale range of the second region is [T0, L - 1]; S23. Sort the gray values of each pixel point in the first region to obtain a second gray value set P', and calculate the median A1 of the second gray value set P' according to the total number N of pixel points in the first region A ; S24. Calculate the average value B1 of the grayscale values of all pixel points in the second region. The calculation method is as follows: Count the number of pixel points in the second region as N B ; The gray value of the j-th pixel in the second region is G j , then B1 is: S25, calculate the average value T of A1 and B1 h , and the formula is as follows: S26, Calculate T h Calculate the absolute value Δt of the difference between T and T0. If Δt < 1, use the average value T of A1 and B1 h as the initial segmentation threshold; if Δt ≥ 1, set T0 = T h , and repeat steps S23 - S26 until Δt < 1; S27. Perform threshold segmentation on the denoised image according to the initial segmentation threshold, and crop to obtain the initially segmented image, where the gray level range of the initially segmented image is [T h , L - 1]; S28. Process the initially segmented image using the OSTU algorithm to obtain the region after threshold segmentation.

3. The method for detecting the glue break defect of the sound film based on the improved OSTU algorithm according to claim 2, wherein, The specific steps of S21 include: In response to determining that the total number n of pixel points in the denoised image is odd, then T0 is the middle value in the first grayscale value set P; In response to determining that the total number n of pixel points in the denoised image is even, then T0 is the average value of the n / 2-th element and the (n / 2 + 1)-th element in the first grayscale value set P; The specific steps of S23 include: In response to determining that the total number N of pixel points in the first region A is odd, A1 is the median value in the second grayscale value set P'; In response to determining that the total number N of pixel points in the first region A is an even number, A1 is the average value of the N A / 2-th element and the N A / 2 + 1-th element in the second gray value set P'.

4. The method for detecting the glue break defect of the sound film based on the improved OSTU algorithm according to claim 2, characterized in that, The specific steps of S28 include: The gray level range in the image after the initial segmentation is [T h , L - 1], and the total number of pixel points in the image after the initial segmentation is N R , and the number of pixel points with a gray level of k is N k . Then the probability that the gray level of the pixel is k is as follows: And there is: A threshold T is provided, and the image after the initial segmentation is segmented into a third region and a fourth region according to the threshold T. The gray level range of the third region is [T h , T - 1], and the gray level range of the fourth region is [T, L - 1]; Then the probability that the pixel in the initially segmented image is classified into the third region is: The probability that the pixel in the initially segmented image is classified into the fourth region is: The average grayscale value of the third region is: The average grayscale value of the fourth region is: The average grayscale value of the initially segmented image is: The between-class variance of the initially segmented image is: σ 2 = w1(u1 - u) 2 + w2(u2 - u) 2 ; Let the threshold T increase successively by a step of 1 within the range of [Th, L - 1]. When the between-class variance σ 2 is the largest, the corresponding T is the desired optimal threshold; Perform threshold segmentation on the denoised image according to the optimal threshold to obtain the region after threshold segmentation. The grayscale range of the region after threshold segmentation is [T, L - 1].

5. The method for detecting the glue break defect of the sounding film based on the improved OSTU algorithm according to claim 1, characterized in that, In step S1, to obtain the grayscale image of the product after the diaphragm and voice coil are glued together, it specifically includes: S11. Obtain the color image of the product after the diaphragm and voice coil are glued together, and split the color image into several single-channel images; S12. Perform image enhancement on the several single-channel images to obtain several enhanced single-channel images; S13. Stack the several enhanced single-channel images in sequence to obtain the stacked image. Determine the edge of the product after the diaphragm and voice coil are glued together by performing measurement caliper interpolation fitting on the stacked image; S14. Convert the color image into the original grayscale image, and crop the original grayscale image according to the edge to obtain the grayscale image of the product after the diaphragm and voice coil are glued together.

6. The method for detecting the glue break defect of the sound film based on the improved OSTU algorithm according to claim 1, wherein, Median filtering is used for filtering and denoising in step S1; a circular structuring element with a radius of 10 pixels is used for the opening operation in step S3.

7. The method for detecting the glue break defect of the sound film based on the improved OSTU algorithm according to claim 1, characterized in that Step S4 specifically includes: Using the area_holes operator to calculate the area of the enclosed region in the target region, where this area is the number of pixels contained within the enclosed region in the target region; In response to determining that the area of the enclosed region is greater than 0, it indicates that there is no defect of broken glue on the voice coil membrane of the product; In response to determining that the area of the enclosed region is equal to 0, it indicates that there is a defect of broken glue on the voice coil membrane of the product.

8. A sound film glue-breaking defect detection device based on an improved OSTU algorithm, characterized in that, Including: A denoising module, configured to obtain a grayscale image of the product after the voice coil membrane and the voice coil are glued, perform filtering and denoising on the grayscale image, and obtain a denoised image; A segmentation module, configured to perform threshold segmentation on the denoised image using an improved OSTU algorithm to obtain a region after threshold segmentation; An opening operation module, configured to perform an opening operation on the region after threshold segmentation to obtain a target region; A detection module, configured to detect the defect of broken glue on the voice coil membrane based on the target region to obtain a detection result.

9. An electronic device, including: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method according to any one of claims 1-7.

Citation Information

Cited By

  • TAC film casting defect intelligent detection method based on machine vision

    CN121353239A