Diamond wire sand amount state detection method and device, electronic equipment and storage medium
By automatically detecting the connecting domain and diamond area ratio of diamond line images, the problem of poor age and strong subjectivity of diamond line sand quantity state detection in the prior art is solved, and efficient and objective detection results are achieved.
Patent Information
- Application Number
- CN202311277512.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-04-04
AI Technical Summary
The existing diamond line quality detection methods rely on manual or simple machine detection, resulting in poor timeliness and strong subjectivity, and the inability to effectively detect the sand volume status of the diamond line.
By acquiring the diamond line image and converting it into a binarized image, conducting the connection domain detection, calculating the diamond area ratio, judging the sand volume state, and realizing automatic detection.
Automatic detection of the sand quantity state of diamond wire is realized, which improves the timeliness and objectivity of the detection, and avoids the subjectivity and workload of manual detection.
Smart Images

Figure CN119762405A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of diamond wire quality detection, and in particular to a diamond wire sand quantity state detection method and device, electronic equipment, and computer-readable storage medium. Background Art
[0002] In the field of diamond wire quality inspection, many manufacturers have not formed the same standard. Most companies use manual quality inspection and quality inspection machines for quality inspection, and the quality inspection content can include breaking force detection, diameter measurement, etc. Manual quality inspection requires the use of industrial cameras to take pictures of the diamond wire production line, and then check the photos. However, 1 meter of diamond wire may require hundreds of photos for quality inspection, and a roll of diamond wire is as long as 200 kilometers. The quality inspection process requires a large number of photos, and the workload of manual quality inspection is extremely large. In this case, manual quality inspection cannot give quality inspection results in a short time, and the timeliness is poor. In addition, manual quality inspection relies on experience and is too subjective to give objective quality inspection results. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method and device for detecting the sand quantity status of a diamond wire, an electronic device, and a storage medium, which are used to perform automated sand quantity status detection on the diamond wire, thereby avoiding the defects of poor timeliness and excessive subjectivity of manual detection.
[0004] On the one hand, the present application provides a method for detecting the sand quantity state of a diamond wire, comprising:
[0005] Obtain any diamond wire image corresponding to the diamond wire to be tested, and convert the diamond wire image into a corresponding binary image; wherein the binary image includes a plurality of diamond pixels and a plurality of non-diamond pixels;
[0006] Performing connected domain detection on the binary image, and determining the amount of diamond sand in the diamond wire image based on the detection result;
[0007] Identify the diamond wire area in the binary image, and calculate the diamond area ratio corresponding to the diamond wire area;
[0008] The sand amount state corresponding to the diamond wire image is determined according to the sand amount and the diamond area ratio.
[0009] In one embodiment, determining the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio includes:
[0010] Determine whether the sand amount and the diamond area ratio meet the sand shortage determination condition, and obtain the sand shortage determination result;
[0011] According to the sand shortage judgment result, it is determined whether the diamond in the diamond wire image is in a sand shortage state, wherein the sand quantity state includes the sand shortage state.
[0012] In one embodiment, the determining whether the sand amount and the diamond area ratio meet the sand shortage determination condition and obtaining the sand shortage determination result includes:
[0013] Determine whether the amount of sand is less than a set sand minority value, and obtain a first determination result;
[0014] Determine whether the diamond area ratio is less than the set sand ratio, and obtain a second determination result;
[0015] The sand shortage determination result is determined based on the first determination result and the second determination result.
[0016] In one embodiment, determining the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio includes:
[0017] Determine whether the sand amount and the diamond area ratio meet the full plating determination condition, and obtain the full plating determination result;
[0018] According to the full plating determination result, it is determined whether the diamond in the diamond wire image is in a full plating state, wherein the sand amount state includes the full plating state.
[0019] In one embodiment, the determining whether the sand amount and the diamond area ratio meet the full plating determination condition and obtaining the full plating determination result includes:
[0020] Determine whether the amount of sand is greater than a set full plating value, and obtain a third determination result, wherein the set full plating value is greater than the set sand minority value;
[0021] Determine whether the diamond area ratio is greater than a set full plating ratio, and obtain a fourth determination result, wherein the set full plating ratio is greater than the set sand less ratio;
[0022] The full plating determination result is determined according to the third determination result and the fourth determination result.
[0023] In one embodiment, the performing connected domain detection on the binary image and determining the amount of diamond grit in the diamond wire image based on the detection result includes:
[0024] Performing a connected domain analysis on the binary image to obtain a connected domain set corresponding to diamond, wherein the connected domain set includes a plurality of connected domains;
[0025] According to the set pixel quantity, a large connected domain subset is selected from the connected domain set, wherein the pixel quantity contained in each connected domain in the large connected domain subset is greater than the set pixel quantity;
[0026] Using the target pixel number corresponding to a single diamond, each connected domain in the large connected domain subset is split to obtain the number of split connected domains corresponding to the large connected subset;
[0027] The amount of sand corresponding to the diamond wire image is determined according to the number of remaining connected domains and the number of split connected domains, wherein the number of remaining connected domains is the total amount of all connected domains in the connected domain set except the large connected domain subset.
[0028] In one embodiment, using the target pixel number corresponding to a single diamond to split each connected domain in the large connected domain subset to obtain the number of split connected domains corresponding to the large connected subset includes:
[0029] For each connected domain in the large connected domain subset, determining the number of splits corresponding to the connected domain according to the number of pixels occupied by the connected domain and the target number of pixels;
[0030] The number of split connected domains is determined according to the sum of the number of splits of all connected domains in the large connected domain subset.
[0031] In one embodiment, the step of obtaining the target number of pixels includes:
[0032] Obtaining an average number of pixels corresponding to all connected domains in the connected domain set as a first pixel quantity;
[0033] The target pixel quantity is determined according to the first pixel quantity.
[0034] In one embodiment, the step of obtaining the target number of pixels includes:
[0035] Acquire a specified connected domain subset in which the number of pixels in the connected domain set is within a set pixel number range;
[0036] Obtaining an average number of pixels corresponding to all connected domains in the specified connected domain subset as a second pixel quantity;
[0037] The target pixel quantity is determined according to the second pixel quantity.
[0038] In one embodiment, the identifying the diamond wire region in the binary image includes:
[0039] Acquire a first row of pixels and a second row of pixels satisfying a diamond line boundary recognition condition from the binary image, use the first row of pixels as an upper boundary of the diamond line in the binary image, and use the second row of pixels as a lower boundary of the diamond line in the binary image, wherein the first row of pixels is located above the second row of pixels;
[0040] The area between the upper boundary and the lower boundary is used as the diamond wire area.
[0041] In one embodiment, acquiring a first row of pixels and a second row of pixels satisfying a diamond line boundary recognition condition from the binary image includes:
[0042] If the diamond line boundary recognition condition includes a diamond line boundary setting value, then from top to bottom, it is determined in sequence whether the sum of the pixel values of each row of pixels in the binary image is greater than the diamond line boundary setting value, and a row of pixels whose pixel values and the sum of the pixels are greater than the diamond line boundary setting value determined for the first time are used as the first row of pixels;
[0043] And in order from bottom to top, determine in turn whether the sum of the pixel values of each row of pixels in the binary image is greater than the diamond line boundary setting value, and use a row of pixels whose pixel values are first determined to be greater than the diamond line boundary setting value as the second row of pixels.
[0044] In one embodiment, acquiring a first row of pixels and a second row of pixels satisfying a diamond line boundary recognition condition from the binary image includes:
[0045] If the diamond wire boundary recognition condition includes pixel values and changes, the first row of pixels and the second row of pixels are obtained according to the ratio of the change value between the sum of pixel values of two adjacent rows of pixels in the binary image and the sum of pixel values and changes.
[0046] In one embodiment, obtaining the first row of pixels and the second row of pixels according to a ratio of a change value between the sum of pixel values of two adjacent rows of pixels in the binary image and the amount of change of the sum of pixel values includes:
[0047] Detecting the sum of pixel values of each row of pixels in the binary image in order from top to bottom, and when it is first detected that a first change value between the sum of pixel values of first two adjacent rows of pixels is greater than the change amount of the sum of pixel values, taking the next row of pixels in the first two adjacent rows of pixels as the first row of pixels;
[0048] The pixel value sum of each row of pixels in the binary image is detected in order from bottom to top. When it is first detected that the second change value between the pixel sum of the second two adjacent rows of pixels is greater than the pixel value sum change, the upper row of pixels in the second two adjacent rows of pixels is used as the second row of pixels.
[0049] In one embodiment, the calculating the diamond area ratio corresponding to the diamond wire area includes:
[0050] Counting the total number of diamond pixels corresponding to the diamonds in the diamond wire area;
[0051] Counting the total number of pixels in the diamond wire area;
[0052] The diamond area ratio is determined based on the total number of diamond pixels and the total number of region pixels.
[0053] In one embodiment, converting the diamond wire image into a corresponding binary image includes:
[0054] Converting the diamond wire image into a corresponding target grayscale image;
[0055] Clustering the pixels in the target grayscale image through three preset initial clustering centers to obtain a ternary image, wherein the ternary image includes a plurality of background pixels, a plurality of busbar pixels, and a plurality of diamond pixels;
[0056] The ternary image is converted into the binary image.
[0057] On the other hand, the present application provides a diamond wire sand state detection device, comprising:
[0058] A conversion module, used for acquiring any diamond wire image corresponding to the diamond wire to be tested, and converting the diamond wire image into a corresponding binary image; wherein the binary image includes a plurality of diamond pixels and a plurality of background pixels;
[0059] A detection module, used for performing connected domain detection on the binary image, and determining the amount of diamond sand in the diamond wire image based on the detection result;
[0060] A calculation module, used for identifying the diamond wire area in the binary image, and calculating the diamond area ratio corresponding to the diamond wire area;
[0061] A determination module is used to determine the sand quantity state corresponding to the diamond wire image according to the sand quantity and the diamond area ratio.
[0062] Furthermore, the present application provides an electronic device, the electronic device comprising:
[0063] processor;
[0064] a memory for storing processor-executable instructions;
[0065] Wherein, the processor is configured to execute the above-mentioned diamond wire sand quantity state detection method.
[0066] In addition, the present application provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by a processor to complete the above-mentioned diamond wire sand amount state detection method.
[0067] In the present application, after converting the diamond wire image into a binary image that can characterize the location of the diamond, the connected domain detection can be performed on the binary image to determine the amount of diamond sand based on the detection results, and the diamond area ratio can be calculated after identifying the diamond wire area in the binary image, so as to obtain the number of diamonds and the density of diamonds in the section of the diamond wire to be tested that appears in the diamond wire image, and accurately evaluate the sand output status based on this. This process is automatically performed by electronic equipment, avoiding the problem of manual detection being unable to respond in a timely manner, and improving the real-time nature of the detection. By determining the amount of sand and the proportion of diamond area based on the image, the sand output status can be accurately obtained, avoiding the problem of excessive subjectivity in manual detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the technical solution of the embodiments of the present application, the drawings required for use in the embodiments of the present application are briefly introduced below.
[0069] Figure 1 A schematic flow chart of a method for detecting the sand content state of a diamond wire provided in one embodiment of the present application;
[0070] Figure 2 A schematic diagram of a target grayscale image provided by an embodiment of the present application;
[0071] Figure 3 An embodiment of the present application provides Figure 1 Detailed flow chart of step 120;
[0072] Figure 4 A schematic diagram of a diamond wire area in an image provided by an embodiment of the present application;
[0073] Figure 5 A schematic flow chart of a method for calculating the diamond area ratio provided in one embodiment of the present application;
[0074] Figure 6 A block diagram of a diamond wire sand quantity state detection device provided in one embodiment of the present application;
[0075] Figure 7A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0076] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0077] Similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0078] See also Figure 1 , is a flow chart of a method for detecting the sand content of a diamond wire according to an embodiment of the present application. Figure 1 As shown, the method may include the following steps 110 to 140.
[0079] Step 110: obtaining any diamond wire image corresponding to the diamond wire to be tested, and converting the diamond wire image into a corresponding binary image; wherein the binary image includes a plurality of diamond pixels and a plurality of non-diamond pixels.
[0080] Here, the diamond wire to be tested refers to the diamond wire that needs to be tested for sand quantity status. The sand quantity status refers to the amount of sand in the diamond on the diamond wire, which can be too little sand, too much sand, fully plated, normal sand quantity, etc. In the production process of the diamond wire to be tested, multiple diamond wire images can be taken on the production line by an industrial camera, and each diamond wire image is used to detect the sand quantity status of a section of the diamond wire to be tested. Electronic devices (such as host computers, servers, etc.) that are docked with industrial cameras can obtain diamond wire images from the industrial cameras, and then detect the sand quantity status with the help of the diamond wire images.
[0081] For each diamond wire image, the electronic device can identify the category information corresponding to each pixel in the diamond wire image, thereby dividing the pixels in the diamond wire image into diamond pixels (pixels where the diamonds are located) and non-diamond pixels (pixels where the mother line and the background are located), thereby converting the diamond wire image into a corresponding binary image.
[0082] Step 120: Perform connected domain detection on the binary image, and determine the amount of diamond sand in the diamond wire image based on the detection result.
[0083] The area where the diamond is located in the binary image constitutes a connected domain, so each connected domain represents the position of the diamond in the image. In this case, the electronic device can perform connected domain detection on the binary image to obtain multiple connected domains, and then determine the amount of diamond sand in the diamond wire image based on the multiple connected domains, and the amount of sand is the number of diamonds.
[0084] Step 130: Identify the diamond wire area in the binary image, and calculate the diamond area ratio corresponding to the diamond wire area.
[0085] Since the category information corresponding to each pixel in the binary image is represented based on the pixel value, the area where the diamond is located in the binary image can be clearly identified, and then the diamond wire area can be determined based on the area where the diamond is located. Furthermore, the electronic device can calculate the diamond area ratio for the diamond wire area, and the diamond area ratio is the ratio between the total area of the diamonds in the diamond wire area and the total area of the diamond wire area. The diamond area ratio can characterize the density of the diamonds on the diamond wire to be tested.
[0086] Step 140: Determine the sand quantity state corresponding to the diamond wire image according to the sand quantity and the diamond area ratio.
[0087] After obtaining the diamond sand content in the diamond wire image and the diamond area ratio in the diamond wire region, the number and density of diamonds in this section of the tested diamond wire in the diamond wire image can be known, and the sand content state corresponding to the diamond wire image can be determined accordingly.
[0088] Through the above measures, after the diamond wire image is converted into a binary image that can characterize the location of the diamond, the connected domain detection can be performed on the binary image to determine the amount of diamond sand based on the detection results, and the diamond area ratio can be calculated after identifying the diamond wire area in the binary image, so that the number of diamonds and the density of diamonds in the section of the diamond wire to be tested that appears in the diamond wire image can be obtained, and the sand output state can be accurately evaluated based on this. This process is automatically performed by electronic equipment, avoiding the problem of manual detection being unable to respond in time, and improving the real-time nature of the detection. By determining the amount of sand and the proportion of diamond area based on the image, the sand output state can be accurately obtained, avoiding the problem of excessive subjectivity in manual detection.
[0089] In one embodiment, the sand amount state may include a sand low state.
[0090] When determining the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio, the electronic device can determine whether the sand amount and the diamond area ratio meet the sand shortage judgment condition, thereby obtaining the sand shortage judgment result. Further, the electronic device can determine whether the diamond in the diamond wire image is in a sand shortage state according to the sand shortage judgment result. Here, the sand shortage judgment result can indicate whether the diamond in the diamond wire image is in a sand shortage state or not in a sand shortage state.
[0091] Through the above measures, the sand amount and diamond area ratio are compared according to the sand-less judgment conditions to determine whether the diamond in the diamond wire image is in a sand-less state.
[0092] In one embodiment, when determining whether the sand amount and the diamond area ratio meet the sand shortage determination condition and obtaining the sand shortage determination result, the electronic device can determine whether the sand amount is less than the set sand shortage value to obtain the first determination result. The electronic device can determine whether the diamond area ratio is less than the set sand shortage ratio to obtain the second determination result.
[0093] Among them, setting the sand minority value and setting the sand minority ratio can be configured based on experience, which is used to characterize the upper limit of the sand amount and the upper limit of the diamond area ratio when the sand amount is too little. The setting sand minority value can be adaptively adjusted according to the length of the diamond wire in the diamond wire image. In one embodiment, the setting sand minority value can be 80, and the setting sand minority ratio can be 14%. At this time, when the sand amount is less than 80 and the diamond area ratio is less than 14%, it can be determined that the sand amount state is too little.
[0094] After obtaining the first judgment result and the second judgment result, the sand-less judgment result can be determined. On the one hand, if the first judgment result and the second judgment result are both yes, it can be determined that the sand-less judgment result is that the diamond is in a sand-less state. On the other hand, if the first judgment result and the second judgment result are not all yes, it can be determined that the sand-less judgment result is that the diamond is not in a sand-less state.
[0095] Through the above measures, the sand amount and the diamond area ratio can be compared based on the set sand amount value and the set sand ratio in the sand shortage judgment condition to obtain the sand shortage judgment result.
[0096] In one embodiment, the sand amount state may include a full plating state.
[0097] When determining the sand quantity state corresponding to the diamond wire image according to the sand quantity and the diamond area ratio, the electronic device can determine whether the sand quantity and the diamond area ratio meet the full plating determination condition, thereby obtaining the full plating determination result. Further, the electronic device can determine whether the diamond in the diamond wire image is in a full plating state according to the full plating determination result. Here, the full plating determination result can indicate whether the diamond in the diamond wire image is in a full plating state or not in a full plating state.
[0098] Through the above measures, the sand volume and diamond area ratio are compared according to the full plating judgment conditions to determine whether the diamond in the diamond wire image is in a full plating state.
[0099] In one embodiment, when determining whether the sand amount and the diamond area ratio meet the full plating determination condition and obtaining the full plating determination result, the electronic device can determine whether the sand amount is greater than the set full plating value and obtain the third determination result. The set full plating value can be greater than the set sand minority value.
[0100] The electronic device can determine whether the diamond area ratio is greater than the set full plating ratio to obtain a fourth determination result. The set full plating ratio is greater than the set sand less ratio.
[0101] Among them, setting the full plating value and setting the full plating ratio can be configured based on experience, which is used to characterize the lower limit of the sand amount and the lower limit of the diamond area ratio when the diamond is fully plated. The setting of the full plating value can be adaptively adjusted according to the length of the diamond wire in the diamond wire image. In one embodiment, the setting of the full plating value can be 165, and the setting of the full plating ratio can be 25%. At this time, when the sand amount is greater than 165, or when the diamond area ratio is greater than 25%, it can be determined that the sand amount state is fully plated.
[0102] After obtaining the third judgment result and the fourth judgment result, the full plating judgment result can be determined. On the one hand, if at least one of the third judgment result and the fourth judgment result is yes, the full plating judgment result can be determined to be that the diamond is in a full plating state. On the other hand, if both the third judgment result and the fourth judgment result are no, the full plating judgment result can be determined to be that the diamond is not in a full plating state.
[0103] Through the above measures, the sand amount and the diamond area ratio can be compared based on the set full plating value and the set full plating ratio in the full plating judgment condition, so as to obtain the full plating judgment result.
[0104] In one embodiment, the sand amount state may include a sand-rich state.
[0105] When determining the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio, the electronic device can determine whether the sand amount and the diamond area ratio meet the sand-excess determination condition, thereby obtaining a sand-excess determination result. Further, the electronic device can determine whether the diamond in the diamond wire image is in a sand-excess state according to the sand-excess determination result. Here, the sand-excess determination result can indicate whether the diamond in the diamond wire image is in a sand-excess state or not in a sand-excess state.
[0106] Through the above measures, the sand amount and diamond area ratio are compared according to the sand-excess judgment conditions to determine whether the diamond in the diamond wire image is in a sand-excess state.
[0107] In one embodiment, when determining whether the sand amount and the diamond area ratio meet the sand-excess determination condition and obtaining the sand-excess determination result, the electronic device can determine whether the sand amount is greater than a set sand-excess value and obtain a fifth determination result. The set sand-excess value can be greater than a set sand-excess value and less than a set full plating value.
[0108] The electronic device can determine whether the diamond area ratio is greater than the set sand-rich ratio to obtain a sixth determination result. The set sand-rich ratio can be greater than the set sand-less ratio and less than the set full plating ratio.
[0109] Among them, setting the sand amount value and setting the sand amount ratio can be configured based on experience, which is used to characterize the lower limit of the sand amount and the lower limit of the diamond area ratio when the diamond is in the sand amount state. The setting sand amount value can be adaptively adjusted according to the length of the diamond wire in the diamond wire image. In one embodiment, the setting sand amount value can be 150, and the setting full plating ratio can be 23%. At this time, when the sand amount is greater than 150, or when the diamond area ratio is greater than 23%, it can be determined that the sand amount state is a sand amount state.
[0110] After obtaining the fifth and sixth judgment results, the sandy determination result can be determined. On the one hand, if at least one of the fifth and sixth judgment results is yes, the sandy determination result can be determined to be that the diamond is in a sandy state. On the other hand, if both the fifth and sixth judgment results are no, the sandy determination result can be determined to be that the diamond is not in a sandy state.
[0111] Through the above measures, the sand amount and the diamond area ratio can be compared based on the set sand amount value and the set sand amount ratio in the sand amount judgment condition, so as to obtain the sand amount judgment result.
[0112] In one embodiment, when converting the diamond wire image into a corresponding binary image, the electronic device may convert the diamond wire image into a corresponding target grayscale image.
[0113] The diamond wire image is a three-channel image with the color channel order of BGR (Blue Green Red). The sand quantity status detection can be realized through a single-channel grayscale image. In order to facilitate subsequent processing and reduce the amount of calculation, for each diamond wire image, the electronic device can convert it into a target grayscale image.
[0114] See also Figure 2 , is a schematic diagram of a target grayscale image provided by an embodiment of the present application, such as Figure 2 As shown in the figure, the black part in the target grayscale image is the background; the gray part is the edge of the busbar, and the busbar is between the two busbar edges; the part with the highest brightness is the diamond on the busbar. The busbar and the diamond together constitute the diamond wire.
[0115] In one embodiment, the electronic device can convert the diamond wire image into an initial grayscale image, which is a grayscale image obtained by direct conversion. Further, the initial grayscale image can be used as a target grayscale image. For example, the three-channel RGB pixel value of each pixel in the colored diamond wire image can be converted into a single-channel grayscale value, for example, the formula Gray = R*0.299+G*0.587+B*0.114 can be used for conversion, wherein Gray is the grayscale value of the pixel after conversion, 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.
[0116] In one embodiment, the electronic device can convert the diamond wire image into an initial grayscale image, and use morphological processing of a closing operation to eliminate noise in the initial grayscale image, thereby obtaining a target grayscale image. Through this measure, the image can be denoised, thereby clarifying the boundaries between diamonds in the image, reducing the adverse effects of noise on diameter recognition, and facilitating subsequent processing.
[0117] After obtaining the target grayscale image, the electronic device can cluster the pixels in the target grayscale image through three preset initial clustering centers to obtain a ternary image, wherein the ternary image includes a plurality of background pixels, a plurality of busbar pixels, and a plurality of diamond pixels. After obtaining the ternary image, the ternary image is converted into a binary image.
[0118] According to the first initial cluster center corresponding to the background, the second initial cluster center corresponding to the busbar, and the third initial cluster center corresponding to the diamond, the pixel values of multiple pixels in the target grayscale image are clustered using the K-means clustering algorithm. During the clustering process, the cluster center will change. After the clustering is completed, three clusters can be obtained. Each cluster includes multiple pixels. After obtaining the three clusters, the electronic device can classify the pixels in each cluster, obtain the category information of the pixels in each cluster, and can mark the corresponding category information for each pixel.
[0119] In the present application, three different gray levels correspond to multiple background pixels, multiple diamond pixels, and multiple busbar pixels. Separating the background pixels, busbar pixels, and diamond pixels of the diamond wire in the ternary image can make the determined diamond pixels more accurate and improve the overall detection accuracy of the sand volume detection.
[0120] In the target grayscale image, the brightness of the pixel corresponding to diamond is the largest and the pixel value is the largest. Therefore, the result cluster center of the cluster where the pixel value corresponding to diamond is located is the largest. Here, the result cluster center is the actual cluster center of each cluster after clustering is completed. The electronic device can select the maximum value from the result cluster centers of the three clusters, and determine the category information of each pixel in the cluster corresponding to the selected maximum value as a diamond pixel. At this time, the pixels corresponding to the remaining two pixel values can be determined as background pixels and busbar pixels, and these two types of pixels are classified as non-diamond pixels.
[0121] Furthermore, the pixel value of the diamond pixel can be set to a specified positive integer or remain unchanged; similarly, the pixel value of the non-diamond pixel can be set to zero, or the pixel value of the non-diamond pixel can be set to the pixel value of the background pixel or the busbar pixel, thereby converting the ternary image into a binary image, and using the binary image as the preprocessed image.
[0122] Through the above measures, after the diamond wire image is converted into a target grayscale image, the pixels in the target grayscale image can be first divided by clustering to obtain diamond pixels and non-diamond pixels, and then corresponding pixel values are set for the diamond pixels and non-diamond pixels respectively, thereby generating a binary image corresponding to the diamond wire image.
[0123] In one embodiment, after determining the category information of each pixel in the target grayscale image, the diamond pixels can be expanded. During the clustering process, the pixels at the edge of the diamond may be divided into clusters corresponding to the busbar, that is, the category information of the pixels at the edge of the diamond is identified as busbar pixels, which will result in a reduction in the area of the identified diamond. Therefore, by expanding the pixels whose category information is diamond, the area of the diamond in the image can be restored, so as to correctly detect the sand state of the diamond wire later.
[0124] In one embodiment, see Figure 3 , provided in one embodiment of the present application Figure 1 The detailed flow chart of step 120 is as follows: Figure 3 As shown, when executing step 120, the following steps 121 to 124 may be specifically executed.
[0125] Step 121: Performing connected domain analysis on the binary image to obtain a connected domain set corresponding to diamonds, wherein the connected domain set includes multiple connected domains.
[0126] The position of the diamond in the binary image corresponds to the connected domain. The electronic device can perform connected domain detection on the binary image to obtain multiple connected domains, and the multiple connected domains constitute a connected domain set.
[0127] Step 122: selecting a large connected domain subset from the connected domain set according to the set pixel quantity, wherein the pixel quantity contained in each connected domain in the large connected domain subset is greater than the set pixel quantity.
[0128] Here, the set pixel quantity can be configured as needed to characterize the lower limit of the pixel quantity of the connected domain in the large connected domain set.
[0129] The electronic device can compare the pixel quantity of each connected domain in the connected domain set with the set pixel quantity, thereby screening out several connected domains whose pixel quantity is greater than the set pixel quantity, and constructing the screened several connected domains into a large connected domain subset. Each connected domain in the large connected domain subset can be considered to correspond to at least two diamonds in contact with each other.
[0130] Step 123: Using the target number of pixels corresponding to a single diamond, split each connected domain in the large connected domain subset to obtain the number of split connected domains corresponding to the large connected subset.
[0131] Here, the target pixel number represents the number of pixels occupied by a single diamond in the image.
[0132] In one embodiment, for each connected domain in the large connected domain subset, the electronic device can determine the number of splits corresponding to the connected domain according to the number of pixels occupied by the connected domain and the target number of pixels. Here, the number of splits refers to the number of diamonds split out.
[0133] The electronic device may divide the number of pixels of each connected domain in the large connected domain subset by the target number of pixels, thereby obtaining the number of splits corresponding to the connected domain. Here, the calculated number of splits may be a decimal. In this case, the decimal part of the number of splits may be rounded off, or the decimal part of the number of splits may be directly deleted, or the number of splits may be rounded up. The specific processing method may be pre-configured.
[0134] The electronic device can determine the number of split connected domains according to the sum of the split numbers of all connected domains in the large connected domain subset. After obtaining the number of splits of all connected domains in the large connected domain subset, multiple split numbers are summed to obtain the number of split connected domains.
[0135] Step 124: Determine the amount of sand corresponding to the diamond wire image according to the number of remaining connected domains and the number of split connected domains, wherein the number of remaining connected domains is the total amount of all connected domains in the connected domain set except the large connected domain subset.
[0136] The electronic device can add the number of remaining connected domains to the number of split connected domains to obtain the amount of sand corresponding to the diamond wire image. Here, the remaining connected domain can be considered as a connected domain corresponding to a single diamond.
[0137] Through the above measures, after multiple connected domains are detected from the binary image, all connected domains where at least two diamonds are located can be split according to the target number of pixels of a single diamond, thereby obtaining the number of split connected domains, which represents the number of diamonds contained in the connected domain where at least two diamonds are located. Then, based on the number of split connected domains and the number of remaining connected domains corresponding to the single diamond, the amount of diamond sand in the image is obtained by summing up.
[0138] In one embodiment, the target number of pixels corresponding to a single diamond may be determined before executing step 123. The electronic device may obtain the average number of pixels corresponding to all connected domains in the connected domain set as the first pixel quantity.
[0139] The electronic device may calculate the average of the number of pixels corresponding to all connected domains to obtain the average number of pixels. Here, when the calculated average is not an integer, the decimal part may be rounded to obtain an integer, and the integer is used as the average number of pixels. For example, 12.4 is rounded to 12 as the average number of pixels; 13.7 is rounded to 14 as the average number of pixels.
[0140] The electronic device may determine the target pixel number according to the first pixel number. Exemplarily, the first pixel number may be directly used as the target pixel number. Alternatively, the first pixel number may be added with a preset constant to obtain the target pixel number. Here, the preset constant may be configured as needed.
[0141] In this case, it can be considered that most diamonds are distributed in a discrete state on the diamond wire, and most connected domains correspond to a single diamond. Therefore, the target pixel number can be determined based on the average pixel number of all connected domains.
[0142] In one embodiment, the electronic device may obtain a specified connected domain subset whose pixel quantity in the connected domain set is within a set pixel number range. Here, the set pixel number range is used to screen the connected domain corresponding to a single diamond. The set pixel number range may be configured based on experience, and illustratively, the set pixel number range may be greater than 5 and not greater than 40.
[0143] The electronic device determines whether the pixel quantity of each connected domain in the connected domain set is within the set pixel number range, and the connected domains whose pixel quantity is within the set pixel number range constitute the specified connected domain subset. Further, the electronic device can obtain the average number of pixels corresponding to all connected domains in the specified connected domain subset as the second pixel quantity. The electronic device can calculate the average number of pixels of all connected domains in the specified connected domain subset to obtain the average number of pixels. Here, when the calculated average is not an integer, the decimal part can be rounded to obtain an integer, and the integer is used as the average number of pixels.
[0144] After obtaining the second pixel quantity, the electronic device may determine the target pixel quantity according to the second pixel quantity. Exemplarily, the second pixel quantity may be directly used as the target pixel quantity. Alternatively, the second pixel quantity may be added with a preset constant to obtain the target pixel quantity. Here, the preset constant may be configured as needed.
[0145] In this case, the pixel counts of connected domains corresponding to diamonds that are too small and the pixel counts of connected domains corresponding to at least two touching diamonds can be filtered out to select several connected domains corresponding to single diamonds, thereby calculating the average number of pixels, and using the average number of pixels to determine the target number of pixels, accurately characterizing the number of pixels occupied by a single diamond in the image.
[0146] In one embodiment, when the electronic device executes step 120, it can perform connected domain detection on the binary image to obtain multiple connected domains. The electronic device can count the total amount of connected domains of the multiple connected domains and directly use the total amount of connected domains as the amount of sand. In this case, it can be considered that each connected domain in the binary image corresponds to a diamond, so the total amount of connected domains can be considered as the amount of sand.
[0147] In one embodiment, when identifying the diamond line area in the binary image, the electronic device can obtain the first row of pixels and the second row of pixels that meet the diamond line boundary recognition condition from the binary image, and use the first row of pixels as the upper boundary of the diamond line in the preprocessed image, and use the second row of pixels as the lower boundary of the diamond line in the preprocessed image. The first row of pixels is located above the second row of pixels.
[0148] Here, the diamond wire boundary recognition condition is used to recognize the boundary of the diamond wire in the image.
[0149] The electronic device can calculate the sum of the pixel values of each row of pixels in the binary image, and check whether the sum of the pixel values satisfies the diamond line boundary, thereby determining the first row of pixels and the second row of pixels, and obtaining the upper boundary and the lower boundary of the diamond line image. After obtaining the upper boundary and the lower boundary, the area between the upper boundary and the lower boundary can be used as the diamond line area.
[0150] See also Figure 4 , is a schematic diagram of a diamond wire area in an image provided by an embodiment of the present application, such as Figure 4 As shown, the first row of pixels on the upper side of the diamond line is the upper boundary, the second row of pixels on the lower side of the diamond line is the lower boundary, and the area between the upper boundary and the lower boundary is the diamond line area.
[0151] In one embodiment, if the diamond line boundary recognition condition includes a diamond line boundary setting value, the electronic device can determine, from top to bottom, whether the sum of the pixel values of each row of pixels in the binary image is greater than the diamond line boundary setting value. Here, the diamond line boundary setting value is used to screen the diamond line boundary, representing the minimum sum of the pixel values of a row of pixels in the area where the diamond line is located.
[0152] On the one hand, if in the process of traversing each row of pixels, it is determined that the sum of the pixel values of any row of pixels is not greater than the diamond line boundary setting value, the next row of pixels can be checked. On the other hand, if it is determined that the sum of the pixel values of a row of pixels is greater than the diamond line boundary setting value, the row of pixels whose sum of pixels is greater than the diamond line boundary setting value determined for the first time can be used as the first row of pixels.
[0153] The electronic device can sequentially determine whether the sum of the pixel values of each row of pixels in the binary image is greater than the diamond line boundary setting value in a bottom-up order. On the one hand, if it is determined that the sum of the pixel values of any row of pixels is not greater than the diamond line boundary setting value during the process of traversing each row of pixels, the next row of pixels can be checked. On the other hand, if it is determined that the sum of the pixel values of a row of pixels is greater than the diamond line boundary setting value, the row of pixels whose sum of the pixels determined for the first time is greater than the diamond line boundary setting value can be used as the second row of pixels.
[0154] Through the above measures, since the pixel value of non-diamond pixels in the binary image is zero, and the pixel value of diamond pixels is a specified positive integer, in the process of scanning pixels line by line and summing the pixel values, if the edge of the diamond wire is encountered, the number of diamond pixels in a row of pixels is large and the sum result is relatively large. Therefore, based on the diamond wire boundary setting value, a row of pixels with diamond pixels can be effectively screened out, thereby accurately identifying the upper and lower boundaries of the diamond wire.
[0155] In one embodiment, if the diamond wire boundary recognition conditions include pixel values and changes, the electronic device can obtain the first row of pixels and the second row of pixels based on the ratio of the change value between the sum of pixel values of two adjacent rows of pixels in the binary image and the pixel value change.
[0156] Here, the pixel value and the variation are used to screen the diamond line boundary, and are proportional to the minimum difference between the pixel value sum of the diamond line boundary and the pixel value sum of a row of pixels in the area outside the diamond line. Exemplarily, the pixel value and the variation are the minimum difference between the pixel value sum of the diamond line boundary and the pixel value sum of a row of pixels in the area outside the diamond line.
[0157] Since the pixel value of the diamond pixel in the binary image is a specified positive integer, the pixel value of the non-diamond pixel is zero. For any pair of adjacent two rows of pixels in the binary image, if the two adjacent rows of pixels are both located in the diamond line area or the area outside the diamond line, the difference in the number of diamond pixels in the two rows of pixels is small, and accordingly, the change value between the sum of the pixel values is also small. If the two adjacent rows of pixels are located exactly at the junction of the diamond line area and the non-diamond line area, one row of pixels belongs to the diamond line area and the other row of pixels belongs to the non-diamond line area, then the difference in the number of diamond pixels in the two rows of pixels is large, and accordingly, the change value between the sum of the pixel values is also large.
[0158] In this case, by calculating the sum of the pixel values of each row of pixels in the binary image, the change value between the sum of the pixel values of multiple pairs of two adjacent rows of pixels is determined, and the ratio of the change value to the pixel value and the change value is calculated. The larger the ratio, the larger the change value between the pixel sums of two adjacent rows of pixels. The electronic device can determine the two adjacent rows of pixels at the junction of the diamond line area and the non-diamond line area based on the ratio, and then determine the first row of pixels and the second row of pixels therefrom as the upper boundary and the lower boundary. Exemplarily, if the pixel value and the change amount are the minimum difference between the pixel value sum of the diamond line boundary and the pixel value sum of a row of pixels in the area outside the diamond line, then when the ratio of the change value to the pixel value and the change amount is not less than 1, it can be determined that there is a diamond line boundary in the two adjacent rows of pixels corresponding to the change value.
[0159] Through the above measures, the first row of pixels and the second row of pixels can be found from the binary image based on the rule that the pixel values of the two rows of pixels at the junction of the diamond line area and the non-diamond line area will change significantly.
[0160] In one embodiment, when obtaining the first row of pixels and the second row of pixels according to the ratio of the change value between the sum of pixel values of two adjacent rows of pixels in the binary image to the change amount of the sum of pixel values, the electronic device can detect the sum of pixel values of each row of pixels in the binary image in a top-to-bottom order. After detecting the sum of pixel values of each row, the first change value between the sum of pixel values of two adjacent rows of pixels can be calculated. Here, the first change value is the change value between the sum of pixel values calculated for each pair of two adjacent rows of pixels when traversing each row of pixels from top to bottom.
[0161] The electronic device can determine whether the first change value is greater than the pixel value and the change amount. In one case, if the first change value is not greater than the pixel value and the change amount, the first change value of the sum of the pixel values of the next pair of adjacent two rows of pixels can be checked. In another case, if the first change value is greater than the pixel value and the change amount, when it is first detected that the first change value between the sum of the pixel values of the first two adjacent rows of pixels is greater than the pixel value and the change amount, the next row of pixels in the first two adjacent rows of pixels can be used as the first row of pixels. Here, the first two adjacent rows of pixels are the two adjacent rows of pixels corresponding to the first change value greater than the pixel value and the change amount that is detected for the first time.
[0162] The electronic device can detect the sum of the pixel values of each row of pixels in the binary image in a bottom-up order. After detecting the sum of the pixel values of each row, a second change value between the sum of the pixel values of two adjacent rows of pixels can be calculated. Here, the second change value is a change value between the sum of the pixel values calculated for each pair of two adjacent rows of pixels when traversing each row of pixels from bottom to top.
[0163] The electronic device can determine whether the second change value is greater than the pixel value and the change amount. In one case, if the second change value is not greater than the pixel value and the change amount, the second change value of the sum of the pixel values of the next pair of adjacent two rows of pixels can be checked. In another case, if the second change value is greater than the pixel value and the change amount, when it is first detected that the second change value between the sum of the pixel values of the second adjacent two rows of pixels is greater than the pixel value and the change amount, the previous row of pixels in the second adjacent two rows of pixels can be used as the second row of pixels. Here, the second adjacent two rows of pixels are the adjacent two rows of pixels corresponding to the second change value greater than the pixel value and the change amount that is first detected.
[0164] Through the above measures, detection can be performed sequentially from the top and bottom of the binary image, so as to accurately detect the first row of pixels and the second row of pixels based on the pixel values of the two rows of pixels at the junction of the diamond line area and the non-diamond line area and the law of large changes.
[0165] In one embodiment, see Figure 5 , is a flow chart of a method for calculating the diamond area ratio provided in an embodiment of the present application, such as Figure 5 As shown, the method may include the following steps 510 to 530.
[0166] Step 510: Count the total number of diamond pixels corresponding to diamonds in the diamond wire area.
[0167] Step 520: Count the total number of pixels in the diamond line area.
[0168] The area ratio of diamond in the diamond wire area can be expressed by the ratio of the total number of diamond pixels to the total number of regional pixels in the diamond wire area. Here, the total number of diamond pixels is the total number of pixels whose category information is diamond. The total number of regional pixels is the total number of pixels in the diamond wire area.
[0169] The electronic device can count the diamond pixels to obtain the total number of diamond pixels, and count the pixels in the diamond wire area to obtain the total number of area pixels.
[0170] Step 530: Determine the diamond area ratio based on the total number of diamond pixels and the total number of regional pixels.
[0171] The electronic device can divide the total number of diamond pixels by the total number of regional pixels to obtain the diamond area ratio.
[0172] Through the above measures, since the pixel ratio is equal to the area ratio, after calculating the ratio of the number of diamond pixels in the diamond area, the diamond area ratio can be obtained.
[0173] Figure 6 is a block diagram of a device for detecting the sand quantity state of a diamond wire according to an embodiment of the present invention. Figure 6 As shown, the device may include:
[0174] The conversion module 610 is used to obtain any diamond wire image corresponding to the diamond wire to be tested, and convert the diamond wire image into a corresponding binary image; wherein the binary image includes a plurality of diamond pixels and a plurality of non-diamond pixels;
[0175] A detection module 620 is used to perform connected domain detection on the binary image and determine the amount of diamond sand in the diamond wire image based on the detection result;
[0176] A calculation module 630 is used to identify the diamond wire area in the binary image and calculate the diamond area ratio corresponding to the diamond wire area;
[0177] The determination module 640 is used to determine the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio.
[0178] In one embodiment, the determination module 640 is further configured to:
[0179] Determine whether the sand amount and the diamond area ratio meet the sand shortage determination condition, and obtain the sand shortage determination result;
[0180] According to the sand shortage judgment result, it is determined whether the diamond in the diamond wire image is in a sand shortage state, wherein the sand quantity state includes the sand shortage state.
[0181] In one embodiment, the determination module 640 is further configured to:
[0182] Determine whether the amount of sand is less than a set sand minority value, and obtain a first determination result;
[0183] Determine whether the diamond area ratio is less than the set sand ratio, and obtain a second determination result;
[0184] The sand shortage determination result is determined based on the first determination result and the second determination result.
[0185] In one embodiment, the determination module 640 is further configured to:
[0186] Determine whether the sand amount and the diamond area ratio meet the full plating determination condition, and obtain the full plating determination result;
[0187] According to the full plating determination result, it is determined whether the diamond in the diamond wire image is in a full plating state, wherein the sand amount state includes the full plating state.
[0188] In one embodiment, the determination module 640 is further configured to:
[0189] Determine whether the amount of sand is greater than a set full plating value, and obtain a third determination result, wherein the set full plating value is greater than the set sand minority value;
[0190] Determine whether the diamond area ratio is greater than a set full plating ratio, and obtain a fourth determination result, wherein the set full plating ratio is greater than the set sand less ratio;
[0191] The full plating determination result is determined according to the third determination result and the fourth determination result.
[0192] In one embodiment, the detection module 620 is further configured to:
[0193] Performing a connected domain analysis on the binary image to obtain a connected domain set corresponding to diamond, wherein the connected domain set includes a plurality of connected domains;
[0194] According to the set pixel quantity, a large connected domain subset is selected from the connected domain set, wherein the pixel quantity contained in each connected domain in the large connected domain subset is greater than the set pixel quantity;
[0195] Using the target pixel number corresponding to a single diamond, each connected domain in the large connected domain subset is split to obtain the number of split connected domains corresponding to the large connected subset;
[0196] The amount of sand corresponding to the diamond wire image is determined according to the number of remaining connected domains and the number of split connected domains, wherein the number of remaining connected domains is the total amount of all connected domains in the connected domain set except the large connected domain subset.
[0197] In one embodiment, the detection module 620 is further configured to:
[0198] For each connected domain in the large connected domain subset, determining the number of splits corresponding to the connected domain according to the number of pixels occupied by the connected domain and the target number of pixels;
[0199] The number of split connected domains is determined according to the sum of the number of splits of all connected domains in the large connected domain subset.
[0200] In one embodiment, the detection module 620 is further configured to:
[0201] Obtaining an average number of pixels corresponding to all connected domains in the connected domain set as a first pixel quantity;
[0202] The target pixel quantity is determined according to the first pixel quantity.
[0203] In one embodiment, the detection module 620 is further configured to:
[0204] Acquire a specified connected domain subset in which the number of pixels in the connected domain set is within a set pixel number range;
[0205] Obtaining an average number of pixels corresponding to all connected domains in the specified connected domain subset as a second pixel quantity;
[0206] The target pixel quantity is determined according to the second pixel quantity.
[0207] In one embodiment, the calculation module 630 is further configured to:
[0208] Acquire a first row of pixels and a second row of pixels satisfying a diamond line boundary recognition condition from the binary image, use the first row of pixels as an upper boundary of the diamond line in the binary image, and use the second row of pixels as a lower boundary of the diamond line in the binary image, wherein the first row of pixels is located above the second row of pixels;
[0209] The area between the upper boundary and the lower boundary is used as the diamond wire area.
[0210] In one embodiment, the calculation module 630 is further configured to:
[0211] If the diamond line boundary recognition condition includes a diamond line boundary setting value, then from top to bottom, it is determined in sequence whether the sum of the pixel values of each row of pixels in the binary image is greater than the diamond line boundary setting value, and a row of pixels whose pixel values and the sum of the pixels are greater than the diamond line boundary setting value determined for the first time are used as the first row of pixels;
[0212] And in order from bottom to top, determine in turn whether the sum of the pixel values of each row of pixels in the binary image is greater than the diamond line boundary setting value, and use a row of pixels whose pixel values are first determined to be greater than the diamond line boundary setting value as the second row of pixels.
[0213] In one embodiment, the calculation module 630 is further configured to:
[0214] If the diamond wire boundary recognition condition includes pixel values and changes, the first row of pixels and the second row of pixels are obtained according to the ratio of the change value between the sum of pixel values of two adjacent rows of pixels in the binary image and the sum of pixel values and changes.
[0215] In one embodiment, the calculation module 630 is further configured to:
[0216] Detecting the sum of pixel values of each row of pixels in the binary image in order from top to bottom, and when it is first detected that a first change value between the sum of pixel values of first two adjacent rows of pixels is greater than the change amount of the sum of pixel values, taking the next row of pixels in the first two adjacent rows of pixels as the first row of pixels;
[0217] The pixel value sum of each row of pixels in the binary image is detected in order from bottom to top. When it is first detected that the second change value between the pixel sum of the second two adjacent rows of pixels is greater than the pixel value sum change, the upper row of pixels in the second two adjacent rows of pixels is used as the second row of pixels.
[0218] In one embodiment, the calculation module 630 is further configured to:
[0219] Counting the total number of diamond pixels corresponding to the diamonds in the diamond wire area;
[0220] Counting the total number of pixels in the diamond wire area;
[0221] The diamond area ratio is determined based on the total number of diamond pixels and the total number of region pixels.
[0222] In one embodiment, the conversion module 610 is further configured to:
[0223] Converting the diamond wire image into a corresponding target grayscale image;
[0224] Clustering the pixels in the target grayscale image through three preset initial clustering centers to obtain a ternary image, wherein the ternary image includes a plurality of background pixels, a plurality of busbar pixels, and a plurality of diamond pixels;
[0225] The ternary image is converted into the binary image.
[0226] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned diamond wire sand quantity state detection method, which will not be repeated here.
[0227] like Figure 7 As shown, this embodiment provides an electronic device 1, including: at least one processor 11 and a memory 12, Figure 7 A processor 11 is taken as an example. The processor 11 and the memory 12 are connected via a bus 10. The memory 12 stores instructions that can be executed by the processor 11. The instructions are executed by the processor 11 so that the electronic device 1 can execute all or part of the process of the method in the above embodiment. In one embodiment, the electronic device 1 can be a host, a server, a server cluster, etc., for executing the sand state detection method of the diamond wire.
[0228] The memory 12 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.
[0229] The present application also provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by the processor 11 to complete the diamond wire sand state detection method provided in the present application.
[0230] In several embodiments provided in the present application, the disclosed devices and methods may also be implemented in other ways. The device embodiments described above are merely schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram may represent a module, a program segment or a part of a code, and a module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0231] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0232] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
Claims
1. A method for detecting the sand content of a diamond wire, characterized in that: include: Obtain any diamond wire image corresponding to the diamond wire to be tested, and convert the diamond wire image into a corresponding binary image; wherein the binary image includes a plurality of diamond pixels and a plurality of non-diamond pixels; Performing connected domain detection on the binary image, and determining the amount of diamond sand in the diamond wire image based on the detection result; Identify the diamond wire area in the binary image, and calculate the diamond area ratio corresponding to the diamond wire area; The sand amount state corresponding to the diamond wire image is determined according to the sand amount and the diamond area ratio.
2. The method according to claim 1, characterized in that Determining the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio includes: Determine whether the sand amount and the diamond area ratio meet the sand shortage determination condition, and obtain the sand shortage determination result; According to the sand shortage judgment result, it is determined whether the diamond in the diamond wire image is in a sand shortage state, wherein the sand quantity state includes the sand shortage state.
3. The method according to claim 2, characterized in that The determining whether the sand amount and the diamond area ratio meet the sand shortage determination condition and obtaining the sand shortage determination result includes: Determine whether the amount of sand is less than a set sand minority value, and obtain a first determination result; Determine whether the diamond area ratio is less than the set sand ratio, and obtain a second determination result; The sand shortage determination result is determined based on the first determination result and the second determination result.
4. The method according to claim 1, characterized in that: Determining the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio includes: Determine whether the sand amount and the diamond area ratio meet the full plating determination condition, and obtain the full plating determination result; According to the full plating determination result, it is determined whether the diamond in the diamond wire image is in a full plating state, wherein the sand amount state includes the full plating state.
5. The method according to claim 4, characterized in that The determining whether the sand amount and the diamond area ratio meet the full plating determination condition and obtaining the full plating determination result includes: Determine whether the amount of sand is greater than a set full plating value, and obtain a third determination result, wherein the set full plating value is greater than the set sand minority value; Determine whether the diamond area ratio is greater than a set full plating ratio, and obtain a fourth determination result, wherein the set full plating ratio is greater than the set sand less ratio; The full plating determination result is determined according to the third determination result and the fourth determination result.
6. The method according to claim 1, characterized in that The performing connected domain detection on the binary image and determining the amount of diamond sand in the diamond wire image based on the detection result includes: Performing a connected domain analysis on the binary image to obtain a connected domain set corresponding to diamond, wherein the connected domain set includes a plurality of connected domains; According to the set pixel quantity, a large connected domain subset is selected from the connected domain set, wherein the pixel quantity contained in each connected domain in the large connected domain subset is greater than the set pixel quantity; Using the target pixel number corresponding to a single diamond, each connected domain in the large connected domain subset is split to obtain the number of split connected domains corresponding to the large connected subset; The amount of sand corresponding to the diamond wire image is determined according to the number of remaining connected domains and the number of split connected domains, wherein the number of remaining connected domains is the total amount of all connected domains in the connected domain set except the large connected domain subset.
7. The method according to claim 6, characterized in that The method of using the target pixel number corresponding to a single diamond to split each connected domain in the large connected domain subset to obtain the number of split connected domains corresponding to the large connected subset includes: For each connected domain in the large connected domain subset, determining the number of splits corresponding to the connected domain according to the number of pixels occupied by the connected domain and the target number of pixels; The number of split connected domains is determined according to the sum of the number of splits of all connected domains in the large connected domain subset.
8. The method according to claim 6 or 7, characterized in that: The step of obtaining the target pixel number comprises: Obtaining an average number of pixels corresponding to all connected domains in the connected domain set as a first pixel quantity; The target pixel quantity is determined according to the first pixel quantity.
9. The method according to claim 6 or 7, characterized in that: The step of obtaining the target pixel number comprises: Acquire a specified connected domain subset in which the number of pixels in the connected domain set is within a set pixel number range; Obtaining an average number of pixels corresponding to all connected domains in the specified connected domain subset as a second pixel quantity; The target pixel quantity is determined according to the second pixel quantity.
10. The method according to claim 1, characterized in that The identifying of the diamond wire area in the binary image comprises: Acquire a first row of pixels and a second row of pixels satisfying a diamond line boundary recognition condition from the binary image, use the first row of pixels as an upper boundary of the diamond line in the binary image, and use the second row of pixels as a lower boundary of the diamond line in the binary image, wherein the first row of pixels is located above the second row of pixels; The area between the upper boundary and the lower boundary is used as the diamond wire area.
11. The method according to claim 10, characterized in that The step of acquiring a first row of pixels and a second row of pixels satisfying a diamond line boundary recognition condition from the binary image comprises: If the diamond line boundary recognition condition includes a diamond line boundary setting value, then from top to bottom, it is determined in sequence whether the sum of the pixel values of each row of pixels in the binary image is greater than the diamond line boundary setting value, and a row of pixels whose pixel values and the sum of the pixels are greater than the diamond line boundary setting value determined for the first time are used as the first row of pixels; And in order from bottom to top, determine in turn whether the sum of the pixel values of each row of pixels in the binary image is greater than the diamond line boundary setting value, and use a row of pixels whose pixel values are first determined to be greater than the diamond line boundary setting value as the second row of pixels.
12. The method according to claim 10, characterized in that The step of acquiring a first row of pixels and a second row of pixels satisfying a diamond line boundary recognition condition from the binary image comprises: If the diamond wire boundary recognition condition includes pixel values and changes, the first row of pixels and the second row of pixels are obtained according to the ratio of the change value between the sum of pixel values of two adjacent rows of pixels in the binary image and the sum of pixel values and changes.
13. The method according to claim 12, characterized in that The acquiring the first row of pixels and the second row of pixels according to the ratio of the change value between the sum of pixel values of two adjacent rows of pixels in the binary image and the change amount of the sum of pixel values comprises: Detecting the sum of pixel values of each row of pixels in the binary image in order from top to bottom, and when it is first detected that a first change value between the sum of pixel values of first two adjacent rows of pixels is greater than the change amount of the sum of pixel values, taking the next row of pixels in the first two adjacent rows of pixels as the first row of pixels; The pixel value sum of each row of pixels in the binary image is detected in order from bottom to top. When it is first detected that the second change value between the pixel sum of the second two adjacent rows of pixels is greater than the pixel value sum change, the upper row of pixels in the second two adjacent rows of pixels is used as the second row of pixels.
14. The method according to claim 1 or 11, characterized in that: The calculating the proportion of the diamond area corresponding to the diamond wire area includes: Counting the total number of diamond pixels corresponding to the diamonds in the diamond wire area; Counting the total number of pixels in the diamond wire area; The diamond area ratio is determined based on the total number of diamond pixels and the total number of region pixels.
15. The method according to claim 1, characterized in that The step of converting the diamond wire image into a corresponding binary image comprises: Converting the diamond wire image into a corresponding target grayscale image; Clustering the pixels in the target grayscale image through three preset initial clustering centers to obtain a ternary image, wherein the ternary image includes a plurality of background pixels, a plurality of busbar pixels, and a plurality of diamond pixels; The ternary image is converted into the binary image.
16. A diamond wire sand quantity state detection device, characterized in that: include: A conversion module, used for acquiring any diamond wire image corresponding to the diamond wire to be tested, and converting the diamond wire image into a corresponding binary image; wherein the binary image includes a plurality of diamond pixels and a plurality of non-diamond pixels; A detection module, used for performing connected domain detection on the binary image, and determining the amount of diamond sand in the diamond wire image based on the detection result; A calculation module, used for identifying the diamond wire area in the binary image, and calculating the diamond area ratio corresponding to the diamond wire area; A determination module is used to determine the sand quantity state corresponding to the diamond wire image according to the sand quantity and the diamond area ratio.
17. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to execute the diamond wire sand quantity state detection method according to any one of claims 1-15.
18. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program can be executed by a processor to complete the diamond wire sand quantity state detection method according to any one of claims 1 to 15.
Citation Information
Patent Citations
Silicon carbide line particle counting method, storage equipment and terminal equipment
CN107767361A
Diamond wire surface carborundum particle quality detection method based on machine vision
CN113063705A
Diamond wire diamond powder particle distribution uniformity evaluation method
CN115541456A