Method and device for detecting diamond agglomeration on surface of diamond wire and electronic equipment
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2026-08-11
AI Technical Summary
然而,现有技术中对金刚线表面的金刚石团聚的检测效率和检测精准度较低
Smart Images

Figure CN119762407B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of diamond wire, and more specifically, to a method, apparatus, electronic device, and computer-readable storage medium for detecting diamond agglomeration on the surface of diamond wire. Background Technology
[0002] Diamond wire saws, also known as diamond wire saws, are processing tools that use electroplating, brazing, or resin bonding methods to fix diamond abrasive onto a metal wire, utilizing the hardness of diamond to process silicon wafers, sapphire, or ceramics. Currently, diamond wire saws are mostly manufactured using electroplating. Electroplating uses a metal wire as the substrate and diamond powder as the abrasive. The diamond powder is electrodeposited onto the surface of the metal wire using an electroplating diamond wire saw tooling, thus producing a diamond wire saw.
[0003] During the production of diamond wire, it is necessary to detect whether the diamond particles attached to it have agglomerated. Agglomeration refers to the excessively concentrated distribution of diamond powder on the diamond wire. However, existing technologies have low efficiency and accuracy in detecting diamond agglomeration on the surface of diamond wire. Summary of the Invention
[0004] The purpose of this application is to provide a method, apparatus, electronic device, and computer-readable storage medium for detecting diamond agglomerations on the surface of diamond wire, which can improve the detection efficiency and accuracy of diamond agglomerations on the surface of diamond wire.
[0005] In a first aspect, embodiments of this application provide a method for detecting diamond agglomerations on the surface of diamond wire, comprising: preprocessing an image of the diamond wire to be detected to obtain a preprocessed image, wherein the preprocessed image includes a plurality of background pixels, a plurality of diamond wire pixels, and a plurality of diamond pixels; for at least a portion of the columns of pixels in the preprocessed image, obtaining the sum of pixel densities of each column of pixels under M vertical sliding windows, wherein M is an integer greater than 1; obtaining a target pixel density from the sum of pixel densities corresponding to all the obtained columns of pixels, and using the target pixel density as the diamond pixel density of the preprocessed image, wherein the target pixel density... The density is not less than the average of the sum of pixel densities corresponding to all column pixels; for at least a portion of the row pixels in the preprocessed image, the sum of abrasive density for each row pixel under N horizontal sliding windows is obtained, where N is an integer greater than 1; the target abrasive density is obtained from the sum of abrasive density corresponding to all row pixels, and the target abrasive density is used as the diamond abrasive density of the preprocessed image, wherein the target abrasive density is not less than the average of the sum of abrasive density corresponding to all row pixels; based on the diamond pixel density and the diamond abrasive density, it is determined whether the diamond wire image is a diamond agglomeration image.
[0006] Compared with existing technologies, the diamond agglomeration detection method for diamond wire surfaces provided in this application embodiment obtains the sum of pixel densities of each column of pixels under M vertical sliding windows by at least some column pixels, and determines the diamond pixel density corresponding to the diamond wire image based on the sum of pixel densities. It also obtains the sum of abrasive density of each row of pixels under N horizontal sliding windows by at least some row pixels, and determines the diamond abrasive density corresponding to the diamond wire image based on the sum of abrasive density. Finally, it determines whether the diamond wire image is a diamond agglomeration image based on the diamond pixel density and diamond abrasive density. By comprehensively considering the diamond pixel density and diamond abrasive density, it determines whether diamond wire agglomeration exists in the diamond wire image. Through the comprehensive judgment of diamond pixel density and diamond abrasive density in the diamond wire image, it can more accurately determine whether diamond wire agglomeration exists in the diamond wire image, improving the accuracy of the detection results. Furthermore, compared with the prior art of manually detecting diamond agglomerations, this application embodiment directly achieves diamond agglomeration detection by image processing and analysis of the diamond wire image, thus improving the detection efficiency of diamond agglomeration.
[0007] In an optional embodiment, obtaining the sum of pixel densities of each column of pixels under M vertical sliding windows includes: for the i-th column of pixels in the preprocessed image, obtaining the M pixel densities of the i-th column of pixels under the M vertical sliding windows, and taking the sum of the M pixel densities corresponding to the i-th column of pixels as the sum of pixel densities of the i-th column of pixels.
[0008] In an optional embodiment, obtaining the M pixel densities of the i-th column pixels under the M vertical sliding windows includes: for each vertical sliding window in the i-th column pixels, if i is less than half the width of the vertical sliding window, then the number of image columns in the vertical sliding window is expanded by mirroring, and the pixel density of the i-th column pixels under the vertical sliding window is obtained based on the expanded image of the vertical sliding window; if i is not less than half the width of the vertical sliding window, then the pixel density of the i-th column pixels under the vertical sliding window is obtained based on the image under the vertical sliding window. By mirroring the diamond wire image, it is possible to avoid the diamond wire image failing to fill the first sliding window when sampling at both ends of the diamond wire image, thus preventing the sampled first diamond wire sub-image from being abnormal, thereby reducing the generation of abnormal images and improving the accuracy of the final detection result.
[0009] In an optional embodiment, obtaining the target pixel density from the sum of pixel densities corresponding to all column pixels includes: obtaining the maximum sum of pixel densities from the sum of pixel densities corresponding to all column pixels, and using the maximum sum of pixel densities as the target pixel density.
[0010] In an optional embodiment, obtaining the sum of sand density for each row of pixels under N horizontal sliding windows includes: for the k-th row of pixels in the preprocessed image, obtaining N sand densities of the k-th row of pixels under the N horizontal sliding windows, and taking the sum of the N sand densities corresponding to the k-th row of pixels as the sum of sand density for the k-th row of pixels.
[0011] In an optional embodiment, obtaining the N sand density values of the k-th row pixels within the N horizontal sliding windows includes: for each horizontal sliding window in the k-th row pixels, if k is less than half the width of the horizontal sliding window, the number of image rows in the horizontal sliding window is expanded by mirroring; based on the expanded image of the horizontal sliding window, the sand density of the k-th row pixels under the horizontal sliding window is obtained; if k is not less than half the width of the horizontal sliding window, the sand density of the k-th row pixels under the horizontal sliding window is obtained based on the image under the horizontal sliding window. By mirroring the diamond wire image, it is possible to avoid the diamond wire image failing to fill the first sliding window when sampling at both ends of the diamond wire image, thus preventing the sampled first diamond wire sub-image from becoming abnormal, thereby reducing the generation of abnormal images and improving the accuracy of the final detection result.
[0012] In an optional embodiment, obtaining the target sand density from the sum of sand densities corresponding to all obtained row pixels includes: obtaining the maximum sum of sand densities from the sum of sand densities corresponding to all obtained row pixels, and using the maximum sum of sand densities as the target sand density.
[0013] In an optional embodiment, determining whether the diamond wire image is a diamond agglomeration image based on the diamond pixel density and the diamond abrasive density includes: determining whether the diamond pixel density is not greater than a preset pixel density threshold, and determining whether the diamond abrasive density is not greater than a preset abrasive density threshold; if it is determined that the diamond pixel density is greater than the preset pixel density threshold, or if it is determined that the diamond abrasive density is greater than the preset abrasive density threshold, then the diamond wire image is determined to be the diamond agglomeration image; otherwise, the diamond wire image is determined to be a non-diamond agglomeration image.
[0014] In an optional embodiment, the preprocessing of the diamond wire image to be detected to obtain a preprocessed image includes: converting the diamond wire image into a grayscale image; clustering the pixels in the grayscale image using three preset clustering centers to obtain a ternary image; and using the ternary image as the preprocessed image.
[0015] Secondly, embodiments of this application provide a diamond wire surface diamond agglomeration detection device, including: an image acquisition module, the image acquisition module being used to acquire an image of the diamond wire to be detected;
[0016] A preprocessing module is used to preprocess the diamond wire image to obtain a preprocessed image, wherein the preprocessed image includes multiple background pixels, multiple diamond wire pixels, and multiple diamond pixels. A pixel density acquisition module is used to acquire the sum of pixel densities of at least a portion of the columns of pixels in the preprocessed image under M vertical sliding windows, where M is an integer greater than 1; to obtain a target pixel density from the sum of pixel densities corresponding to all columns of pixels, and to use the target pixel density as the diamond pixel density of the preprocessed image, wherein the target pixel density is not less than the sum of pixel densities corresponding to all columns of pixels. The image includes a pixel density and an average value; a diamond abrasive density acquisition module, which acquires the diamond abrasive density of each row of pixels in the preprocessed image under N horizontal sliding windows, where N is an integer greater than 1; obtains a target diamond abrasive density from the acquired diamond abrasive density of all rows of pixels, and uses the target diamond abrasive density as the diamond abrasive density of the preprocessed image, wherein the target diamond abrasive density is not less than the average value of the diamond abrasive density of all rows of pixels; and a judgment module, which determines whether the diamond wire image is a diamond agglomeration image based on the diamond pixel density and the diamond abrasive density.
[0017] Thirdly, embodiments of this application provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the diamond agglomeration detection method on the surface of diamond wire as described above.
[0018] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which is executed by a processor to implement the aforementioned method for detecting diamond agglomerations on the surface of diamond wire. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic flowchart of the diamond wire surface diamond agglomeration detection method provided in Embodiment 1 of this application;
[0021] Figure 2 This is a schematic diagram of the process for preprocessing diamond wire images in the diamond wire surface diamond agglomeration detection method provided in Embodiment 1 of this application;
[0022] Figure 3 This is a schematic diagram of the diamond wire surface diamond agglomeration detection device provided in Embodiment 2 of this application;
[0023] Figure 4 This is a schematic diagram of the structure of a diamond wire surface diamond agglomeration detection device provided in another embodiment of this application;
[0024] Figure 5 This is a schematic diagram of the structure of the electronic device provided in Embodiment 3 of this application. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0026] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0027] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0028] In the description of this application, it should be noted that if the terms "upper", "lower", "inner", "outer", etc. appear to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship that the product of this application is usually placed in, it is only for the convenience of describing this application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application.
[0029] Furthermore, the terms "first" and "second" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0030] It should be noted that, where there is no conflict, the features in the embodiments of this application can be combined with each other.
[0031] Embodiment 1 of this application provides a method for detecting diamond agglomerations on the surface of diamond wire, such as... Figure 1 As shown, it includes:
[0032] Step S101: Obtain the diamond wire image.
[0033] In some embodiments of this application, images of the diamond wire coil to be tested can be acquired in real time by a camera module, and each image acquired in real time can be used as a diamond wire image; alternatively, after the camera module has acquired all the images of the diamond wire coil to be tested, the images can be stored in a server, and then one or more images acquired can be retrieved from the server as diamond wire images.
[0034] The camera module can be a camera, industrial camera, video camera, or other similar device, and can be flexibly configured according to the actual situation. This manual does not impose specific restrictions.
[0035] Step S102: Preprocess the diamond wire image to obtain a preprocessed image.
[0036] In this step, the preprocessed image can be a ternary image, that is, the diamond wire image is converted into a ternary image. A ternary image maps a common image with 256 gray levels (or higher) to an image with three different gray levels. In this application, the three different gray levels correspond to multiple background pixels, multiple diamond pixels, and multiple wire pixels, respectively. Taking the diamond wire image as a color image as an example, the specific steps of the preprocessing are as follows: Figure 2 As shown, it includes:
[0037] Step S201: Convert the diamond wire image to a grayscale image.
[0038] In this step, converting a color diamond wire image to a grayscale image can specifically involve converting the three-channel RGBA pixel value of each pixel in the color diamond wire image to a single-channel grayscale value. For example, the formula Gray = R * 0.299 + G * 0.587 + B * 0.114 can be used for the conversion, where Gray is the converted grayscale value of the pixel, R is the color intensity value of the color pixel in the red channel, G is the color intensity value of the color pixel in the green channel, and B is the color intensity value of the color pixel in the blue channel.
[0039] Step S202: Cluster the pixels in the grayscale image using three preset cluster centers to obtain a ternary image.
[0040] In this step, the three preset cluster centers can be randomly selected and spaced apart by a certain amount. The interval can be a constant value, which can be flexibly set according to different practical application scenarios such as the diamond wire image capture method, shooting environment, and type of diamond wire. For example, a lower interval can be set for shooting environments with low brightness, and a lower interval can be set for diamond wires with high transparency.
[0041] In some embodiments of this application, the three randomly selected settings can be, for example, 50, 100, and 150. These settings are well-matched with the grayscale values of background pixels, diamond pixels, and wire pixels in actual applications. Using these settings for clustering operations can better separate diamond pixels in a single-channel grayscale image, improving the accuracy of diamond pixel separation and thus enhancing the accuracy of the final diamond wire abrasive content detection result.
[0042] In different embodiments of this application, different clustering algorithms can be used to cluster the gray values of multiple pixels. For example, the k-means clustering algorithm, Mean-Shift clustering algorithm, and synthetic clustering algorithm can be used to cluster the gray values of multiple pixels. Taking the k-means clustering algorithm as an example, the absolute difference between the gray value of each pixel and three set values can be calculated. The cluster center with the smallest absolute difference is the cluster center of that pixel. The convergence of the clustering algorithm is then determined (for example, whether the sum of the absolute differences between all pixels belonging to the same cluster center and that cluster center is greater than a set threshold; if it is greater, the clustering algorithm has not converged; otherwise, if it is less than or equal to the set threshold, the clustering algorithm has converged; or the number of operations can be determined by whether a threshold number of operations has been reached). If the clustering algorithm has converged... If the clustering algorithm converges, the cluster with the highest grayscale value can be designated as the diamond pixel, the cluster with the lowest grayscale value as the background pixel, and the cluster with the middle grayscale value as the parent line pixel. Conversely, if the clustering algorithm fails to converge, the cluster centers can be recalculated based on the grayscale values of pixels belonging to the same cluster center. For example, the average grayscale value of all pixels with a cluster center of any set value can be used as the new cluster center for the diamond pixel. The absolute difference between the grayscale value of each pixel and the new cluster center can then be recalculated until the clustering algorithm converges. In this application, three different grayscale levels correspond to multiple background pixels, multiple diamond pixels, and multiple parent line pixels, respectively. Classifying the background pixels, parent line pixels, and diamond pixels of the diamond wire in the ternary image can improve the accuracy of the identified diamond pixels and enhance the overall detection accuracy of sand content.
[0043] Step S103: For at least a portion of the columns of pixels in the preprocessed image, obtain the sum of pixel densities for each column of pixels under M vertical sliding windows.
[0044] In this step, taking the i-th column of pixels in the preprocessed image as an example, i can range from 1 to R, where R is the total number of pixel columns in the preprocessed image. Alternatively, it can range from 1 to R at fixed intervals, or be randomly selected from 1 to R. The specific settings can be configured according to actual needs. For the i-th column of pixels, the M pixel densities under M vertical sliding windows can be obtained. The sum of these M pixel densities is taken as the pixel density sum of the i-th column of pixels. That is, the i-th column of pixels corresponds to M vertical sliding windows, and the vertical centerline of each sliding window overlaps with the i-th column of pixels. Each sliding window can then sample a sub-image from the preprocessed image, and each sub-image corresponds to a pixel density. The M vertical sliding windows correspond to M pixel densities, and the sum of these M pixel densities is the pixel density sum under the M vertical sliding windows corresponding to the i-th column of pixels.
[0045] Specifically, for each sub-image sampled by a vertical sliding window, its pixel density can be calculated as the ratio of the number of diamond pixels in the sub-image to the total number of pixels in the sub-image. That is, obtain the number of diamond pixels and the total number of pixels in the sub-image, and then calculate the ratio of the number of diamond pixels to the total number of pixels to obtain the pixel density of each sub-image.
[0046] The height of the vertical sliding window can be the number of pixel rows in the preprocessed image, and the window width can range from 10 to 60 pixels. Setting the window width within this range can prevent the number of pixels in the first diamond wire sub-image from being too small or too large, which would reduce the accuracy of the calculation results and thus improve the accuracy of the final detection results.
[0047] Furthermore, in some embodiments of this application, for each vertical sliding window in the i-th column of pixels, if i is less than half the width of the vertical sliding window, the number of image columns in the vertical sliding window can be expanded by mirroring before sampling the sub-image obtained from the preprocessed image using the sliding window; if i is not less than half the width of the vertical sliding window, the sub-image can be sampled directly. By mirroring the preprocessed image, it is possible to avoid the preprocessed image failing to fill the vertical sliding window when sampling at both ends, thus preventing abnormal sub-images from being obtained, reducing the generation of abnormal images, and improving the accuracy of the final detection result. For example, if the sampling pixel column is the i-th column of pixels, and there are no pixels on one side, then using the sliding window to sample the sub-image will result in only a partial image being captured. Before using the sliding window to sample the sub-image, the preprocessed image can be flipped to fill one side of the i-th column of pixels, and then the sliding window can be used to sample the sub-image.
[0048] Among them, image flipping of the preprocessed image means mirroring the preprocessed image with the edge pixel columns on both sides as the axis of symmetry, thereby supplementing the preprocessed image on both sides.
[0049] Furthermore, in some embodiments of this application, the preprocessed image can be partially mirrored at both ends according to the width of the vertical sliding window. Partially mirroring the preprocessed image reduces the computational load of the mirroring process and improves detection efficiency. For example, the partially mirrored preprocessed image can be a portion of a diamond wire image with a width equal to the width of the vertical sliding window.
[0050] Step S104: Obtain the target pixel density from the sum of pixel densities corresponding to all column pixels, and use the target pixel density as the diamond pixel density of the preprocessed image.
[0051] In this step, the target pixel density is not less than the sum of the pixel densities of all columns of pixels and the average pixel density.
[0052] Furthermore, in some embodiments of this application, the maximum pixel density can be obtained from the sum of pixel densities corresponding to all column pixels, and the maximum pixel density can be used as the target pixel density.
[0053] It is understood that the above-mentioned method of obtaining the maximum pixel density from the sum of pixel densities corresponding to all column pixels and using the maximum pixel density as the target pixel density is only an example in some embodiments of this application. In some other embodiments of this application, the average pixel density of the sum of pixel densities corresponding to all column pixels can also be used as the target pixel density.
[0054] Taking a diamond wire image with a width of 659 pixels as an example, the column numbers of each pixel in the diamond wire image are 1 to 659, and the image pixel height is denoted as H. For example, in column 100, when the sliding window width is 11, the image within the range of columns 95 to 105 (all rows) is taken as the sub-image corresponding to column 100. First, calculate the number of diamond pixels cn in this range, and the diamond pixel density at this size is cn / (11*H). Similarly, when the sliding window width is 21, the image within the range of columns 90 to 110 (all rows) is taken, and the diamond pixel density at this size is cn / (21*H). After calculating the diamond pixel density for all sizes at this position, sum all the obtained densities and record it as the pixel density sum R100 corresponding to the 100th pixel column. The calculation method for other pixel columns is the same. After obtaining the pixel density sum R of all pixel columns, return the largest one as the diamond pixel density.
[0055] Step S105: For at least a portion of the rows of pixels in the preprocessed image, obtain the sand density of each row of pixels under N horizontal sliding windows.
[0056] In this step, taking the k-th row of pixels in the preprocessed image as an example, k can range from 1 to Q, where Q is the total number of pixel rows in the preprocessed image. Alternatively, k can range from 1 to Q at fixed intervals, or be randomly selected from 1 to Q. The specific settings can be configured according to actual needs. For the k-th row of pixels, N sand density values under N horizontal sliding windows can be obtained. The sum of these N sand density values is taken as the sand density sum of the k-th row of pixels. That is, the k-th row of pixels corresponds to N horizontal sliding windows, and the horizontal centerline of each sliding window overlaps with the k-th row of pixels. Each sliding window can then sample a sub-image from the preprocessed image, and each sub-image corresponds to a sand density. The N horizontal sliding windows correspond to N sand density values, and the sum of these N sand density values is the sand density sum under the N horizontal sliding windows corresponding to the k-th row of pixels.
[0057] The acquisition of sand density from a sub-image may include:
[0058] S1: Obtain multiple diamond connected regions formed by diamond pixels in the sub-image, with the multiple diamond connected regions spaced apart from each other.
[0059] In this step, connected component analysis can be performed on the diamond wire image to obtain the marked connected components corresponding to multiple diamond pixels as diamond connected components, and finally obtain multiple mutually spaced diamond connected components.
[0060] Furthermore, in some embodiments of this application, connected component analysis may include two-pass scanning and seed-filling methods, etc., and this specification does not impose specific limitations.
[0061] Specifically, for each sub-image sampled by a horizontal sliding window, its diamond density is calculated as the ratio of the amount of diamond in the sub-image to the total number of pixels in the sub-image. That is, the diamond density of the sub-image is calculated by obtaining the amount of diamond in the sub-image and the total number of pixels in the sub-image, and then using the ratio of the amount of diamond to the total number of pixels.
[0062] S2: Obtain the amount of diamond sand corresponding to the sub-image based on multiple diamond connected regions in the sub-image.
[0063] Specifically, the number of diamonds corresponding to each diamond connected region can be obtained separately, and the sum of the number of diamonds corresponding to all diamond connected regions is the amount of diamond sand corresponding to the sub-image.
[0064] The width of the horizontal sliding window can be the number of pixel columns in the preprocessed image, and the window height can range from 5 to 10 pixels. Setting the window width within this range can prevent the number of diamonds in the sub-image from being too small or too large, which would reduce the accuracy of the calculation results and thus improve the accuracy of the final detection results.
[0065] Furthermore, in some embodiments of this application, for each horizontal sliding window in the k-th row of pixels, if k is less than half the height of the horizontal sliding window, the number of image rows in the horizontal sliding window can be expanded by mirroring before sampling the sub-image obtained from the preprocessed image using the sliding window; if k is not less than half the height of the horizontal sliding window, the sub-image can be sampled directly. By mirroring the preprocessed image, it is possible to avoid the preprocessed image failing to fill the horizontal sliding window when sampling at both ends, thus preventing abnormal sub-images from being obtained, reducing the generation of abnormal images, and improving the accuracy of the final detection result. For example, if the sampling pixel row is the k-th row of pixels, and there are no pixels on one side, then using the sliding window to sample the sub-image will result in only a partial image being captured. Before using the sliding window to sample the sub-image, the preprocessed image can be flipped to fill one side of the k-th row of pixels, and then the sliding window can be used to sample the sub-image.
[0066] Among them, image flipping of the preprocessed image is to mirror the preprocessed image using the edge pixels on both sides of the preprocessed image as the axis of symmetry, thereby supplementing the preprocessed image on both sides.
[0067] Furthermore, in some embodiments of this application, the preprocessed image can be partially mirrored at both ends according to the height of the horizontal sliding window. Partially mirroring the preprocessed image reduces the computational load of the mirroring process and improves detection efficiency. For example, the partially mirrored preprocessed image can be a portion of a diamond wire image with a height equal to the height of the horizontal sliding window.
[0068] Step S106: Obtain the target abrasive density from the abrasive density corresponding to all row pixels, and use the target abrasive density as the diamond abrasive density of the preprocessed image.
[0069] In this step, the target sand density is not less than the average sand density of all row pixels.
[0070] Furthermore, in some embodiments of this application, the maximum sand density can be obtained from the sum of sand densities corresponding to all row pixels, and the maximum sand density can be used as the target sand density.
[0071] It is understood that the above-mentioned method of obtaining the maximum sand density from the sum of sand density corresponding to all row pixels and using the maximum sand density as the target sand density is only an example in some embodiments of this application. In some other embodiments of this application, the average sand density of the sum of sand density corresponding to all row pixels can also be used as the target sand density.
[0072] Step S107: Determine whether the diamond wire image is a diamond agglomeration image based on the diamond pixel density and diamond sand density.
[0073] In this step, it can be determined whether the target pixel density is not greater than a preset pixel density threshold, and whether the target abrasive density is not greater than a preset abrasive density threshold. If the target pixel density is greater than the preset pixel density threshold, or the target abrasive density is greater than the preset abrasive density threshold, then the diamond wire image is determined to be a diamond agglomeration image; otherwise, the diamond wire image is determined to be a non-diamond agglomeration image.
[0074] Compared with existing technologies, the diamond agglomeration detection method on the surface of diamond wire provided in Embodiment 1 of this application obtains the sum of pixel densities of each column of pixels under M vertical sliding windows by at least some column pixels, and determines the diamond pixel density corresponding to the diamond wire image based on the sum of pixel densities. It also obtains the sum of abrasive density of each row of pixels under N horizontal sliding windows by at least some row pixels, and determines the diamond abrasive density corresponding to the diamond wire image based on the sum of abrasive density. Finally, it determines whether the diamond wire image is a diamond agglomeration image based on the diamond pixel density and diamond abrasive density. By comprehensively considering the diamond pixel density and diamond abrasive density, it determines whether diamond wire agglomeration exists in the diamond wire image. Through the comprehensive judgment of diamond pixel density and diamond abrasive density in the diamond wire image, it can more accurately determine whether diamond wire agglomeration exists in the diamond wire image, improving the accuracy of the detection results. Furthermore, compared with the prior art of manually detecting diamond agglomeration, this embodiment of the application directly realizes the detection of diamond agglomeration by image processing and analysis of the diamond wire image, thus improving the detection efficiency of diamond agglomeration.
[0075] Embodiment 2 of this application relates to a device for detecting diamond agglomeration on the surface of diamond wire, such as... Figure 3As shown, the system includes: an image acquisition module 301, used to acquire an image of the diamond wire to be detected; a preprocessing module 302, used to preprocess the diamond wire image to obtain a preprocessed image, wherein the preprocessed image includes multiple background pixels, multiple diamond wire pixels, and multiple diamond pixels; and a pixel density acquisition module 303, used to acquire the sum of pixel densities of each column of pixels in at least a portion of the columns of pixels in the preprocessed image under M vertical sliding windows, wherein M is an integer greater than 1; and to acquire the target pixel density from the sum of pixel densities corresponding to all columns of pixels, and use the target pixel density as the diamond pixel density of the preprocessed image. The target pixel density is not less than the average of the sum of pixel densities of all columns of pixels; the abrasive density acquisition module 304 is used to acquire the sum of abrasive density of each row of pixels under N horizontal sliding windows for at least some pixels in the preprocessed image, where N is an integer greater than 1; the target abrasive density is obtained from the sum of abrasive density of all rows of pixels, and the target abrasive density is used as the diamond abrasive density of the preprocessed image, where the target abrasive density is not less than the average of the sum of abrasive density of all rows of pixels; the judgment module 305 is used to determine whether the diamond wire image is a diamond agglomeration image based on the diamond pixel density and the diamond abrasive density.
[0076] Compared with the prior art, in the diamond wire surface diamond agglomeration detection device provided in Embodiment 1 of this application, the pixel density acquisition module 303 acquires the sum of pixel densities of each column of pixels under M vertical sliding windows through at least some column pixels, and determines the diamond pixel density corresponding to the diamond wire image based on the sum of pixel densities. The abrasive density acquisition module 304 acquires the sum of abrasive density of each row of pixels under N horizontal sliding windows through at least some row pixels, and determines the diamond abrasive density corresponding to the diamond wire image based on the sum of abrasive density. Finally, the judgment module 305 determines whether the diamond wire image is diamond agglomerate based on the diamond pixel density and the diamond abrasive density. For diamond agglomeration images, the judgment module 305 comprehensively considers the diamond pixel density and diamond abrasive density to determine whether diamond wire agglomeration exists in the diamond wire image. By comprehensively judging the diamond pixel density and diamond abrasive density in the diamond wire image, the presence of diamond wire agglomeration can be more accurately determined, improving the accuracy of the detection results. In addition, compared with the existing technology of manually detecting diamond agglomeration, this embodiment of the application directly realizes the detection of diamond agglomeration by image processing and analysis of the diamond wire image, which also improves the detection efficiency of diamond agglomeration.
[0077] Furthermore, in some embodiments of this application, such as Figure 4As shown, it may also include an image flipping module 306. The image flipping module 306 is used to expand the number of image columns in the vertical sliding window by mirroring when i is less than half the width of the vertical sliding window. The pixel density acquisition module 303 obtains the pixel density of the i-th column of pixels in the vertical sliding window based on the expanded image of the vertical sliding window.
[0078] In some embodiments of this application, the image flipping module 306 is also used to expand the number of image rows in the horizontal sliding window by mirroring when k is less than half the width of the horizontal sliding window.
[0079] In some embodiments of this application, the pixel density acquisition module 303 is further configured to acquire the M pixel densities of the i-th column of pixels in the preprocessed image under M vertical sliding windows, and use the sum of the M pixel densities corresponding to the i-th column of pixels as the pixel density sum of the i-th column of pixels.
[0080] In some embodiments of this application, the pixel density acquisition module 303 is further configured to obtain the maximum pixel density sum from the pixel density sums corresponding to all column pixels, and use the maximum pixel density sum as the target pixel density.
[0081] In some embodiments of this application, the sand density acquisition module 304 is further configured to acquire N sand densities of the k-th row pixels in N horizontal sliding windows for the k-th row pixels in the preprocessed image, and use the sum of the N sand densities corresponding to the k-th row pixels as the sum of sand densities of the k-th row pixels.
[0082] In some embodiments of this application, the sand density acquisition module 304 is further configured to acquire the maximum sand density sum from the sand density sums corresponding to all acquired row pixels, and use the maximum sand density sum as the target sand density.
[0083] In some embodiments of this application, the determination module 305 is further configured to determine whether the diamond pixel density is not greater than a preset pixel density threshold and whether the diamond abrasive density is not greater than a preset abrasive density threshold; if the diamond pixel density is greater than the preset pixel density threshold, or if the diamond abrasive density is greater than the preset abrasive density threshold, then the diamond wire image is determined to be a diamond agglomeration image; otherwise, the diamond wire image is determined to be a non-diamond agglomeration image.
[0084] In some embodiments of this application, the preprocessing module 302 is further configured to convert the diamond wire image into a grayscale image; cluster the pixels in the grayscale image using three preset cluster centers to obtain a ternary image, and use the ternary image as the preprocessed image.
[0085] Embodiment 3 of this application relates to an electronic device, such as... Figure 5As shown, it includes: at least one processor 401; and a memory 402 communicatively connected to at least one processor 401; wherein the memory 402 stores instructions executable by at least one processor 401, the instructions being executed by at least one processor 401 to enable at least one processor 401 to perform the diamond agglomeration detection method on the diamond wire surface in the above embodiments.
[0086] The memory and processor are connected via a bus, which can include any number of interconnecting buses and bridges, connecting various circuits of one or more processors and memories. The bus can also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and will not be described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor is transmitted over the wireless medium via an antenna, which further receives data and transmits it to the processor.
[0087] The processor manages the bus and general processing, and also provides various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory is used to store data used by the processor during operation.
[0088] Embodiment 4 of this application relates to a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the method embodiments described above.
[0089] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0090] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for detecting diamond aggregation on the surface of a diamond wire, characterized by, include: The diamond wire image to be detected is preprocessed to obtain a preprocessed image, wherein the preprocessed image includes multiple background pixels, multiple diamond wire pixels, and multiple diamond pixels. For at least a portion of the columns of pixels in the preprocessed image, obtain the sum of pixel densities for each column of pixels under M vertical sliding windows, where M is an integer greater than 1; The target pixel density is obtained from the sum of pixel densities corresponding to all column pixels, and the target pixel density is used as the diamond pixel density of the preprocessed image, wherein the target pixel density is not less than the average pixel density of the sum of pixel densities corresponding to all column pixels; For at least a portion of the rows of pixels in the preprocessed image, obtain the sum of sand density for each row of pixels under N horizontal sliding windows, where N is an integer greater than 1; The target abrasive density is obtained from the sum of abrasive densities corresponding to all row pixels, and the target abrasive density is used as the diamond abrasive density of the preprocessed image, wherein the target abrasive density is not less than the average abrasive density of the sum of abrasive densities corresponding to all row pixels. Based on the diamond pixel density and the diamond agglomerate density, determine whether the diamond wire image is a diamond agglomeration image.
2. The diamond wire surface diamond aggregation detection method according to claim 1, characterized in that, The step of obtaining the sum of pixel densities for each column of pixels under M vertical sliding windows includes: For the i-th column of pixels in the preprocessed image, obtain the M pixel densities of the i-th column of pixels under the M vertical sliding windows, and take the sum of the M pixel densities corresponding to the i-th column of pixels as the pixel density sum of the i-th column of pixels.
3. The diamond wire surface diamond aggregation detection method according to claim 2, characterized in that, The step of obtaining the M pixel densities of the i-th column pixel under the M vertical sliding windows includes: For each vertical sliding window in the i-th column of pixels, if i is less than half the width of the vertical sliding window, the number of image columns in the vertical sliding window is expanded by mirroring and flipping. Based on the expanded image of the vertical sliding window, the pixel density of the i-th column of pixels under the vertical sliding window is obtained. If i is not less than half the width of the vertical sliding window, the pixel density of the i-th column of pixels under the vertical sliding window is obtained based on the image under the vertical sliding window.
4. The method for detecting diamond agglomerations on the surface of diamond wire according to claim 1, characterized in that, The step of obtaining the target pixel density from the sum of pixel densities corresponding to all column pixels includes: Obtain the maximum sum of pixel densities from the sum of pixel densities corresponding to all column pixels, and use the maximum sum of pixel densities as the target pixel density.
5. The method for detecting diamond agglomerations on the surface of diamond wire according to claim 1, characterized in that, The step of obtaining the sum of sand density for each row of pixels under N horizontal sliding windows includes: For the k-th row of pixels in the preprocessed image, obtain the N sand density values of the k-th row pixels in the N horizontal sliding windows, and take the sum of the N sand density values corresponding to the k-th row pixels as the sum of the sand density values of the k-th row pixels.
6. The method for detecting diamond agglomerations on the surface of diamond wire according to claim 5, characterized in that, The step of obtaining the N sand density values of the k-th row pixel in the N horizontal sliding windows includes: For each horizontal sliding window in the k-th row of pixels, if k is less than half the width of the horizontal sliding window, the number of image rows in the horizontal sliding window is expanded by mirroring and flipping. The sand density of the k-th row of pixels under the horizontal sliding window is obtained based on the image of the expanded horizontal sliding window. If k is not less than half the width of the horizontal sliding window, the sand density of the k-th row of pixels under the horizontal sliding window is obtained based on the image under the horizontal sliding window.
7. The method for detecting diamond agglomerations on the surface of diamond wire according to claim 5, characterized in that, The step of obtaining the target sand density from the sum of sand densities corresponding to all rows of pixels includes: The maximum sand density is obtained from the sum of sand density corresponding to all rows of pixels, and the maximum sand density is used as the target sand density.
8. The method for detecting diamond agglomerations on the surface of diamond wire according to claim 1, characterized in that, The step of determining whether the diamond wire image is a diamond agglomeration image based on the diamond pixel density and the diamond agglomerate density includes: Determine whether the diamond pixel density is not greater than a preset pixel density threshold, and determine whether the diamond abrasive density is not greater than a preset abrasive density threshold; If it is determined that the diamond pixel density is greater than the preset pixel density threshold, or if it is determined that the diamond abrasive density is greater than the preset abrasive density threshold, then the diamond wire image is determined to be the diamond agglomeration image; otherwise, the diamond wire image is determined to be a non-diamond agglomeration image.
9. The method for detecting diamond agglomerations on the surface of diamond wire according to claim 1, characterized in that, The process of preprocessing the diamond wire image to be detected to obtain a preprocessed image includes: Convert the diamond wire image into a grayscale image; The pixels in the grayscale image are clustered using three preset cluster centers to obtain a ternary image, which is then used as the preprocessed image.
10. A device for detecting diamond agglomeration on the surface of diamond wire, characterized in that, include: An image acquisition module is used to acquire an image of the diamond wire to be detected; A preprocessing module is used to preprocess the diamond wire image to obtain a preprocessed image, wherein the preprocessed image includes multiple background pixels, multiple diamond wire pixels, and multiple diamond pixels. A pixel density acquisition module is configured to acquire, for at least a portion of the column pixels in the preprocessed image, the pixel density sum of each column of pixels under M vertical sliding windows, where M is an integer greater than 1; acquire a target pixel density from the acquired pixel density sums corresponding to all column pixels, and use the target pixel density as the diamond pixel density of the preprocessed image, wherein the target pixel density is not less than the average pixel density sum of the pixel density sums corresponding to all column pixels; A diamond abrasive density acquisition module is configured to acquire, for at least a portion of the row pixels in the preprocessed image, the sum of diamond abrasive density for each row of pixels under N horizontal sliding windows, where N is an integer greater than 1; acquire a target diamond abrasive density from the sum of diamond abrasive density corresponding to all the acquired row pixels, and use the target diamond abrasive density as the diamond abrasive density of the preprocessed image, wherein the target diamond abrasive density is not less than the average abrasive density of the sum of diamond abrasive density corresponding to all the row pixels; The judgment module is used to determine whether the diamond wire image is a diamond agglomeration image based on the diamond pixel density and the diamond agglomerate density.
11. An electronic device, characterized in that, include: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the diamond agglomeration detection method on the surface of diamond wire as described in any one of claims 1 to 9.
12. A computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by a processor to implement the diamond agglomeration detection method on the surface of diamond wire according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method and device for detecting density and distribution of diamond wire abrasive particles
CN102890039A
Diamond wire surface carborundum particle quality detection method based on machine vision
CN113063705A