Diamond wire sand amount state recognition method and device, electronic equipment and storage medium
By automatically identifying the sand quantity status of the diamond wire, the problems of poor timeline and strong subjectivity of artificial quality inspection are solved, and efficient and accurate quality inspection of the diamond wire is achieved.
Patent Information
- Application Number
- CN202311285294.2
- 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
In diamond line quality inspection, artificial quality inspection has problems such as poor timeliness and strong subjectivity, which makes it impossible to give accurate quality inspection results in a short period of time.
A method of sand quantity state recognition of diamond lines is adopted. By acquiring the diamond line image and converting it into a binary image, connecting domain analysis, expansion corrosion algorithm splitting and sand quantity state determination are carried out, and the sand quantity state of diamond lines is automatically identified.
The automatic sand volume state detection of diamond wire is realized, avoiding the problems of poor timeliness and strong subjectivity of manual detection, and improving the real-time and accuracy of detection.
Smart Images

Figure CN119762411A_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 recognition 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 identifying the sand quantity status of a diamond wire, an electronic device, and a computer-readable storage medium, which are used to automatically detect the sand quantity status of 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 identifying the sand quantity state of a diamond wire, comprising:
[0005] Acquire a 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 a connected domain analysis on the binary image to obtain a connected domain set corresponding to diamond pixels, wherein the connected domain set includes a plurality of connected domains;
[0007] According to the set pixel quantity, a large connected domain subset is selected from the connected domain set, wherein the number of pixels contained in each large connected domain in the large connected domain subset is greater than the set pixel quantity;
[0008] Using an expansion-corrosion algorithm, split each large connected domain in the large connected domain subset to obtain the number of split connected domains corresponding to the large connected domain subset;
[0009] 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;
[0010] Identify the diamond wire area in the binary image, and calculate the diamond area ratio corresponding to the diamond wire area;
[0011] The sand amount state corresponding to the diamond wire image is determined according to the sand amount and the diamond area ratio corresponding to the diamond wire area.
[0012] In one embodiment, determining the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio corresponding to the diamond wire area includes:
[0013] Determine whether the sand amount and the diamond area ratio meet the sand shortage determination condition, and obtain the sand shortage determination result;
[0014] 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.
[0015] 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:
[0016] Determine whether the amount of sand is less than a set sand minority value, and obtain a first determination result;
[0017] Determine whether the diamond area ratio is less than the set sand ratio, and obtain a second determination result;
[0018] The sand shortage determination result is determined based on the first determination result and the second determination result.
[0019] In one embodiment, determining the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio corresponding to the diamond wire area includes:
[0020] Determine whether the sand amount and the diamond area ratio meet the full plating determination condition, and obtain the full plating determination result;
[0021] 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.
[0022] 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:
[0023] 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;
[0024] 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;
[0025] The full plating determination result is determined according to the third determination result and the fourth determination result.
[0026] In one embodiment, the calculating the diamond area ratio corresponding to the diamond wire area includes:
[0027] Counting the total number of diamond pixels corresponding to the diamonds in the diamond wire area;
[0028] Counting the total number of pixels in the diamond wire area;
[0029] The diamond area ratio is determined based on the total number of diamond pixels and the total number of region pixels.
[0030] In one embodiment, the use of the expansion-corrosion algorithm to split each large connected domain in the large connected domain subset to obtain the number of split connected domains corresponding to the large connected subset includes:
[0031] For each large connected domain, the dilation-corrosion algorithm at N scales is used to split the large connected domain to obtain the number of N sub-connected domains of the large connected domain, and a number of sub-connected domains is selected from the number of N sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain;
[0032] The number of split connected domains corresponding to the large connected subset is obtained according to the sum of the target sub-connected numbers of all large connected domains.
[0033] In one embodiment, the selecting a number of sub-connected domains from the N numbers of sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain includes:
[0034] For each large connected domain, the maximum value is selected from the N numbers of sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain.
[0035] In one embodiment, the identifying the diamond wire region in the binary image includes:
[0036] 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;
[0037] The area between the upper boundary and the lower boundary is used as the diamond wire area.
[0038] In one embodiment, acquiring the first row of pixels and the second row of pixels satisfying the diamond line boundary recognition condition from the binary image includes:
[0039] 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;
[0040] 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.
[0041] In one embodiment, acquiring the first row of pixels and the second row of pixels satisfying the diamond line boundary recognition condition from the binary image includes:
[0042] 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.
[0043] 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:
[0044] 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;
[0045] 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.
[0046] In one embodiment, converting the diamond wire image into a corresponding binary image includes:
[0047] Converting the diamond wire image into a corresponding target grayscale image;
[0048] 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;
[0049] The ternary image is converted into the binary image.
[0050] On the other hand, the present application provides a device for identifying the sand quantity state of a diamond wire, comprising:
[0051] A conversion module, used for acquiring a 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;
[0052] An analysis module, used for performing connected domain analysis on the binary image to obtain a connected domain set corresponding to diamond pixels, wherein the connected domain set includes multiple connected domains;
[0053] A selection module, configured to select a large connected domain subset from the connected domain set according to a set pixel quantity, wherein the number of pixels contained in each large connected domain in the large connected domain subset is greater than the set pixel quantity;
[0054] A splitting module is used to split each large connected domain in the large connected domain subset by using an expansion-corrosion algorithm to obtain the number of split connected domains corresponding to the large connected domain subset;
[0055] A determination module, used for determining 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;
[0056] 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;
[0057] The identification module is used to determine the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio corresponding to the diamond wire area.
[0058] Furthermore, the present application provides an electronic device, the electronic device comprising:
[0059] processor;
[0060] a memory for storing processor-executable instructions;
[0061] Wherein, the processor is configured to execute the above-mentioned diamond wire sand quantity state identification method.
[0062] 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 quantity state identification method.
[0063] In the present application scheme, 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, and a large connected domain including multiple diamonds can be screened out with a set pixel quantity, and a large connected domain is formed with the large connected domain to form a large connected domain subset. After performing an expansion and corrosion operation on each large connected domain in the large connected domain subset, the large connected domain can be split to obtain the number of split connected domains corresponding to the large connected domain subset, and the number of split connected domains characterizes the total amount of diamonds corresponding to all large connected domains in the large connected domain subset; according to the number of split connected domains and the number of remaining connected domains, the amount of diamond sand in the diamond wire image can be determined; and the diamond wire area can be identified in the binary image and the proportion of diamond area can be calculated to determine the density of diamonds. With the help of the sand amount and the proportion of diamond area, 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 determined, 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 inspection being unable to respond in a timely manner and improving the real-time nature of identification. By determining the amount of sand and the proportion of diamond area through images, the sand quantity status can be accurately determined, avoiding the problem of excessive subjectivity in manual inspection. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] 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.
[0065] Figure 1 A schematic flow chart of a method for identifying the sand content state of a diamond wire provided in one embodiment of the present application;
[0066] Figure 2 A schematic diagram of a large connected domain provided in an embodiment of the present application;
[0067] Figure 3 A schematic diagram of a target grayscale image provided by an embodiment of the present application;
[0068] Figure 4 A schematic diagram of a diamond wire area in an image provided by an embodiment of the present application;
[0069] Figure 5 A block diagram of a device for identifying the sand quantity state of a diamond wire provided in one embodiment of the present application;
[0070] Figure 6 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0071] 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.
[0072] 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.
[0073] See also Figure 1 , is a flow chart of a method for identifying the sand content state of a diamond wire provided in an embodiment of the present application, such as Figure 1 As shown, the method may include the following steps 110 to 150.
[0074] Step 110: obtaining a 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.
[0075] 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.
[0076] For each diamond wire image, the electronic device can identify the category information corresponding to each pixel in the diamond wire image, and convert the diamond wire image into a corresponding binary image by including the category information as diamond pixels and non-diamond pixels. In one embodiment, the pixel value of the diamond pixel can be set to a specified positive integer, and the pixel value of the non-diamond pixel can be set to zero.
[0077] Step 120: Performing connected domain analysis on the binary image to obtain a connected domain set corresponding to diamond pixels, wherein the connected domain set includes multiple connected domains.
[0078] 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 a connected domain composed of multiple diamond pixels, and then construct a connected domain set corresponding to the diamond pixel based on the multiple connected domains.
[0079] Step 130: selecting a large connected domain subset from the connected domain set according to the set pixel quantity, wherein the pixel quantity contained in each large connected domain in the large connected domain subset is greater than the set pixel quantity.
[0080] Here, the set pixel quantity is used to distinguish the connected domain corresponding to a single diamond from the connected domain corresponding to at least two contacting diamonds, and the set pixel quantity can be configured based on experience. In one embodiment, the first set pixel number can be 40, 41, 42, etc.
[0081] For each connected domain in the connected domain set, the electronic device can count the number of pixels in the connected domain to obtain the pixel quantity corresponding to the connected domain. After counting multiple connected domains respectively, the pixel quantity of all connected domains in the connected domain set can be obtained.
[0082] There may be some diamonds that are in contact and overlap with each other on the diamond wire to be tested. In the image, the diamonds that are in contact and overlap with each other will be in the same connected domain. Such connected domains have a larger area in the image and a larger number of pixels than the connected domain corresponding to a single diamond. The electronic device can compare the number of pixels of each connected domain with the set number of pixels, thereby screening out multiple connected domains with a pixel number greater than the set number of pixels as large connected domains, and construct a large connected domain subset based on the screened multiple large connected domains. Each large connected domain in the large connected domain subset can be considered to correspond to at least two diamonds that are in contact and overlap with each other.
[0083] Step 140: Using the expansion-corrosion algorithm, split each large connected domain in the large connected domain subset to obtain the number of split connected domains corresponding to the large connected subset.
[0084] At least two diamonds that are in contact and superimposed on each other, and their connection is at a relatively narrow position in the large connected domain. Figure 2 , which is a schematic diagram of a large connected domain provided in an embodiment of the present application, such as Figure 2 As shown in the figure, the white part in the image is the area where the diamonds are located. Multiple diamonds are in contact with each other to form a connected domain, while the connected domain is narrow at the connection between two diamonds, and the corresponding pixels of non-diamonds on both sides are almost stuck. Therefore, the electronic device can perform expansion and corrosion operations on each large connected domain in the large connected domain subset, first dilating and then corroding, disconnecting the narrow connection in the connected domain, thereby splitting the large connected domain into several sub-connected domains. Here, each sub-connected domain corresponds to a single diamond.
[0085] For each large connected domain, after splitting it into several sub-connected domains, the number of sub-connected domains can be used as the sub-sand amount corresponding to the large connected domain. Here, the sub-sand amount refers to the number of diamonds contained in the large connected domain. By adding the number of sub-connected domains corresponding to all large connected domains in the large connected domain subset, the number of split connected domains corresponding to the large connected domain subset can be obtained, and the number of split connected domains can represent the number of diamonds contained in all large connected domains in the large connected domain subset.
[0086] Step 150: 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.
[0087] Since the pixel quantity of the connected domains except the large connected domain subset in the connected domain set is not greater than the set pixel quantity, they can be considered to correspond to a single diamond. Therefore, the number of remaining connected domains can be considered to be the number of isolated diamonds in the image.
[0088] 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.
[0089] Step 160: Identify the diamond wire region in the binary image, and calculate the diamond area ratio corresponding to the diamond wire region.
[0090] The diamond area ratio is the ratio of the total area of diamonds in the diamond wire region to the total area of the diamond wire region. The diamond area ratio can represent the density of diamonds on the diamond wire to be tested.
[0091] 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.
[0092] After the diamond wire area is determined, the diamond area ratio may be determined based on the diamond area within the diamond wire area and the total area of the diamond wire area.
[0093] In one embodiment, the diamond area may be represented by the total number of diamond pixels in the diamond wire region, and the total area of the diamond wire region may also be represented by the total number of regional pixels in the diamond wire region.
[0094] The electronic device can count the total number of diamond pixels corresponding to the diamonds in the diamond wire area, and count the total number of regional pixels in the diamond wire area. After obtaining the total number of diamond pixels and the total number of regional pixels, the diamond area ratio is determined based on the total number of diamond pixels and the total number of regional pixels. The total number of diamond pixels is divided by the total number of regional pixels to obtain the diamond area ratio.
[0095] Through this measure, the area is characterized by the amount of pixels, so that the diamond area ratio can be accurately calculated.
[0096] Step 170: Determine the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio corresponding to the diamond wire area.
[0097] The electronic device can determine the number of diamonds on this section of the diamond wire in the diamond wire image based on the sand amount, determine the density of diamonds on this section of the diamond wire based on the diamond area ratio, and then determine the sand amount state corresponding to the diamond wire.
[0098] 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, and a large connected domain including multiple diamonds can be screened out with a set pixel quantity, and the large connected domains are used to form a large connected domain subset. After the expansion and corrosion operation is performed on each large connected domain in the large connected domain subset, the large connected domain can be split to obtain the number of split connected domains corresponding to the large connected domain subset, and the number of split connected domains represents the total amount of diamonds corresponding to all large connected domains in the large connected domain subset; according to the number of split connected domains and the number of remaining connected domains, the amount of diamond sand in the diamond wire image can be determined; and the diamond wire area can be identified in the binary image and the proportion of diamond area can be calculated to determine the density of diamonds. With the help of the sand amount and the proportion of diamond area, 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 determined, 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 inspection being unable to respond in a timely manner and improving the real-time nature of identification. By determining the amount of sand and the proportion of diamond area through images, the sand quantity status can be accurately determined, avoiding the problem of excessive subjectivity in manual inspection.
[0099] In one embodiment, the sand amount state may include a sand low state.
[0100] 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.
[0101] 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.
[0102] 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.
[0103] 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.
[0104] 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.
[0105] 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.
[0106] In one embodiment, the sand amount state may include a full plating state.
[0107] 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.
[0108] 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.
[0109] 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.
[0110] 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.
[0111] 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.
[0112] 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.
[0113] 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.
[0114] In one embodiment, the sand amount state may include a sand-rich state.
[0115] 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.
[0116] 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.
[0117] 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.
[0118] 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.
[0119] 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.
[0120] 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.
[0121] 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.
[0122] In one embodiment, when executing step 140 to split each large connected domain in the large connected domain subset, for each large connected domain, the electronic device can split the large connected domain using an expansion-corrosion algorithm at N scales. Here, the N scales refer to the scales of the structural elements used for the expansion-corrosion operation. Exemplarily, the scales of the structural elements may include but are not limited to 2*2, 3*3, 4*4, 5*5, etc.
[0123] After splitting, the number of N sub-connected domains of the large connected domain can be obtained. In other words, the expansion and corrosion algorithm at each scale can split the large connected domain to obtain a number of sub-connected domains. Further, the electronic device can select a number of sub-connected domains from the number of N sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain. Here, the target number of sub-connected domains is the number of sub-connected domains actually split.
[0124] In one embodiment, when selecting a number of sub-connected domains from the number of N sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain, for each large connected domain, the electronic device may select the maximum value from the number of N sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain. In this case, the most adequate splitting result may be used as the number of diamonds contained in the large connected domain.
[0125] In one embodiment, when selecting a number of sub-connected domains from the number of N sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain, the electronic device can respond to the selection instruction and select a number of sub-connected domains as the target number of sub-connected domains based on the indication of the selection instruction. Here, the selection instruction can be issued by the terminal device after manually checking the splitting result. For example: after manually checking the splitting result through a mobile phone, a tablet computer, a host, etc., a selection instruction can be issued through a mobile phone, a tablet computer, or a host to select the target number of sub-connected domains from the number of N sub-connected domains. In this case, it can be ensured that the corresponding target number of sub-connected domains is determined when the splitting effect is manually verified to be optimal.
[0126] After obtaining the number of target sub-connected domains of all large connected domains, the numbers of multiple target sub-connected domains can be summed, and the number of split connected domains corresponding to the large connected domain subset can be obtained according to the sum of the number of target sub-connected domains of all large connected domains. The electronic device can directly use the sum of the number of target sub-connected domains as the number of split connected domains.
[0127] Through the above measures, the large connected domain can be split with structural elements of N scales to obtain N splitting results, and then the best splitting result is selected as the actual splitting result. The number of target sub-connected domains corresponding to the best splitting result indicates the number of diamonds actually split from the large connected domain, so that the total amount of diamonds actually split from the large connected domain set can be indicated based on the sum of the number of target sub-connected domains.
[0128] 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.
[0129] 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.
[0130] See also Figure 3 , is a schematic diagram of a target grayscale image provided by an embodiment of the present application, such as Figure 3 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.
[0131] 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.
[0132] 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.
[0133] 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 can be converted into a binary image.
[0134] 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.
[0135] 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.
[0136] 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 of the pixel 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. For pixels in the target grayscale image whose category information is not diamond pixels, the remaining two types of pixels can be determined as background pixels and busbar pixels, and these two types of pixels can be classified as non-diamond pixels.
[0137] Furthermore, the pixel value of the diamond pixel can be set to a specified positive integer or remain unchanged; 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.
[0138] 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.
[0139] 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.
[0140] 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.
[0141] Here, the diamond wire boundary recognition condition is used to recognize the boundary of the diamond wire in the image.
[0142] 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.
[0143] 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.
[0144] 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.
[0145] 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.
[0146] 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.
[0147] 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.
[0148] 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.
[0149] 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.
[0150] 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.
[0151] 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.
[0152] 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.
[0153] 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.
[0154] 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.
[0155] 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.
[0156] 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.
[0157] 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. Figure 5 is a block diagram of a device for identifying the sand quantity state of a diamond wire according to an embodiment of the present invention. Figure 5 As shown, the device may include:
[0158] The conversion module 510 is used to obtain a 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;
[0159] An analysis module 520 is used to perform a connected domain analysis on the binary image to obtain a connected domain set corresponding to diamond pixels, wherein the connected domain set includes multiple connected domains;
[0160] A selection module 530 is used to select a large connected domain subset from the connected domain set according to a set pixel quantity, wherein the number of pixels contained in each large connected domain in the large connected domain subset is greater than the set pixel quantity;
[0161] A splitting module 540 is used to split each large connected domain in the large connected domain subset by using an expansion-corrosion algorithm to obtain the number of split connected domains corresponding to the large connected domain subset;
[0162] A determination module 550 is used to 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;
[0163] A calculation module 560 is used to identify the diamond wire area in the binary image and calculate the diamond area ratio corresponding to the diamond wire area;
[0164] The identification module 570 is used to determine the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio corresponding to the diamond wire area.
[0165] In one embodiment, the identification module 570 is further configured to:
[0166] Determine whether the sand amount and the diamond area ratio meet the sand shortage determination condition, and obtain the sand shortage determination result;
[0167] 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.
[0168] In one embodiment, the identification module 570 is further configured to:
[0169] Determine whether the amount of sand is less than a set sand minority value, and obtain a first determination result;
[0170] Determine whether the diamond area ratio is less than the set sand ratio, and obtain a second determination result;
[0171] The sand shortage determination result is determined based on the first determination result and the second determination result.
[0172] In one embodiment, the identification module 570 is further configured to:
[0173] Determine whether the sand amount and the diamond area ratio meet the full plating determination condition, and obtain the full plating determination result;
[0174] 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.
[0175] In one embodiment, the identification module 570 is further configured to:
[0176] 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;
[0177] 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;
[0178] The full plating determination result is determined according to the third determination result and the fourth determination result.
[0179] In one embodiment, the calculation module 560 is further configured to:
[0180] Counting the total number of diamond pixels corresponding to the diamonds in the diamond wire area;
[0181] Counting the total number of pixels in the diamond wire area;
[0182] The diamond area ratio is determined based on the total number of diamond pixels and the total number of region pixels.
[0183] In one embodiment, the splitting module 540 is further configured to:
[0184] For each large connected domain, the dilation-corrosion algorithm at N scales is used to split the large connected domain to obtain the number of N sub-connected domains of the large connected domain, and a number of sub-connected domains is selected from the number of N sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain;
[0185] The number of split connected domains corresponding to the large connected subset is obtained according to the sum of the target sub-connected numbers of all large connected domains.
[0186] In one embodiment, the splitting module 540 is further configured to:
[0187] For each large connected domain, the maximum value is selected from the N numbers of sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain.
[0188] In one embodiment, the calculation module 560 is further configured to:
[0189] 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;
[0190] The area between the upper boundary and the lower boundary is used as the diamond wire area.
[0191] In one embodiment, the calculation module 560 is further configured to:
[0192] 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;
[0193] 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.
[0194] In one embodiment, the calculation module 560 is further configured to:
[0195] 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.
[0196] In one embodiment, the calculation module 560 is further configured to:
[0197] 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;
[0198] 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.
[0199] In one embodiment, the conversion module 510 is further configured to:
[0200] Converting the diamond wire image into a corresponding target grayscale image;
[0201] Clustering pixels in the target grayscale image using 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;
[0202] The ternary image is converted into the binary image.
[0203] 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 identification method, and will not be repeated here.
[0204] like Figure 6 As shown, this embodiment provides an electronic device 1, including: at least one processor 11 and a memory 12, Figure 6 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 quantity state identification method of the diamond wire.
[0205] 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.
[0206] 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 identification method provided in the present application.
[0207] 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.
[0208] 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.
[0209] 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 identifying the sand content state of a diamond wire, characterized in that: include: Acquire a 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 a connected domain analysis on the binary image to obtain a connected domain set corresponding to diamond pixels, 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 number of pixels contained in each large connected domain in the large connected domain subset is greater than the set pixel quantity; Using an expansion-corrosion algorithm, split each large connected domain in the large connected domain subset to obtain the number of split connected domains corresponding to the large connected domain subset; 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; 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 corresponding to the diamond wire area.
2. The method according to claim 1, characterized in that The step of determining the sand quantity state corresponding to the diamond wire image according to the sand quantity and the proportion of the diamond area corresponding to the diamond wire area 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 The step of determining the sand quantity state corresponding to the diamond wire image according to the sand quantity and the proportion of the diamond area corresponding to the diamond wire area 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 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.
7. The method according to claim 1, characterized in that The method of using the expansion-corrosion algorithm to split each large 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 large connected domain, the dilation-corrosion algorithm at N scales is used to split the large connected domain to obtain the number of N sub-connected domains of the large connected domain, and a number of sub-connected domains is selected from the number of N sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain; The number of split connected domains corresponding to the large connected subset is obtained according to the sum of the target sub-connected numbers of all large connected domains.
8. The method according to claim 7, characterized in that The step of selecting a number of sub-connected domains from the N numbers of sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain comprises: For each large connected domain, the maximum value is selected from the N numbers of sub-connected domains of the large connected domain as the target number of sub-connected domains of the large connected domain.
9. 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.
10. The method according to claim 9, 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.
11. The method according to claim 9, 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.
12. The method according to claim 11, 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.
13. 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.
14. A device for identifying the sand quantity state of a diamond wire, characterized in that: include: A conversion module, used for acquiring a 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; An analysis module, used for performing connected domain analysis on the binary image to obtain a connected domain set corresponding to diamond pixels, wherein the connected domain set includes multiple connected domains; A selection module, configured to select a large connected domain subset from the connected domain set according to a set pixel quantity, wherein the number of pixels contained in each large connected domain in the large connected domain subset is greater than the set pixel quantity; A splitting module is used to split each large connected domain in the large connected domain subset by using an expansion-corrosion algorithm to obtain the number of split connected domains corresponding to the large connected domain subset; A determination module, used for determining 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; 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; The identification module is used to determine the sand amount state corresponding to the diamond wire image according to the sand amount and the diamond area ratio corresponding to the diamond wire area.
15. 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 identification method according to any one of claims 1-13.
16. 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 method for identifying the sand quantity state of the diamond wire according to any one of claims 1 to 13.
Citation Information
Patent Citations
Diamond wire surface carborundum particle quality detection method based on machine vision
CN113063705A
Diamond wire monitoring device
CN216816461U