Detection method for sand amount distribution state of diamond wire, electronic equipment and storage medium
By preprocessing and density analysis of the diamond line image, the distribution status of the diamond line sand volume is automatically detected, which solves the problems of large workload and poor timeliness caused by artificial quality inspection, and achieves efficient and objective quality inspection results.
Patent Information
- Application Number
- CN202311280244.5
- 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 inspection methods rely on manual quality inspection, resulting in large workload, poor timeliness, and inability to give objective quality inspection results.
By preprocessing the diamond line image, the window image is extracted, the diamond pixel density and density variance are calculated, the density variance of the density is smaller than the set variance threshold, and the sand quantity distribution state is determined.
Automatic detection of the distribution status of the diamond line sand is realized, the timeliness of quality inspection is improved, and objective quality inspection results are provided.
Smart Images

Figure CN119762408A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of diamond wire quality detection, and in particular to a method for detecting the sand distribution state of a diamond wire, an electronic device, and a 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 may include breaking force detection, diameter measurement, etc. Manual quality inspection requires the use of industrial cameras to take pictures of the diamond wires on 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 for detecting the sand distribution state of a diamond wire, an electronic device, and a storage medium, so as to realize automatic detection of the sand distribution state, thereby improving the timeliness of quality inspection and avoiding the problem of manual quality inspection resulting in an inability to provide objective quality inspection results.
[0004] On the one hand, the present application provides a method for detecting the sand distribution state of a diamond wire, comprising:
[0005] Preprocessing the diamond wire image to be detected to obtain a preprocessed image; wherein the preprocessed image includes a plurality of diamond pixels and a plurality of non-diamond pixels;
[0006] Extracting M window images from the diamond line region of the preprocessed image, wherein M is an integer greater than 1, and image regions corresponding to the M window images cover the diamond line region;
[0007] Obtaining the diamond pixel density of each window image in the M window images, and obtaining M diamond pixel densities corresponding to the M window images;
[0008] Obtaining density variance of the M diamond pixel densities;
[0009] Determine whether the density variance is less than a set variance threshold, and obtain a determination result;
[0010] According to the judgment result, the distribution state of the sand amount in the diamond wire image is determined.
[0011] In one embodiment, extracting M window images from the diamond line region of the pre-processed image includes:
[0012] According to a preset sliding step length, the sliding window is controlled to slide in the horizontal and vertical directions of the diamond wire area until the entire diamond wire area is traversed;
[0013] The image areas within all the sliding windows obtained by traversal are taken as the M window images.
[0014] In one embodiment, acquiring the diamond pixel density of each window image in the M window images to obtain M diamond pixel densities corresponding to the M window images includes:
[0015] For each window image in the M window images, obtaining the number of diamond pixels of the window image;
[0016] According to the number of diamond pixels of the window image and the total number of window pixels, the diamond pixel density of the window image is obtained;
[0017] The above operation is performed on each window image of the M window images to obtain the M diamond pixel densities.
[0018] In one embodiment, for each window image in the M window images, obtaining the number of diamond pixels of the window image includes:
[0019] For each window image in the M window images, a diamond connected domain in the window image is selected from a pre-acquired diamond connected domain set, and the number of pixels corresponding to all diamond connected domains in the window image is used as the number of diamond pixels of the window image, wherein the diamond connected domain set is obtained by performing connected domain analysis on the preprocessed image.
[0020] In one embodiment, the step of obtaining the diamond connected domain set includes:
[0021] Performing connected domain analysis on the preprocessed image to obtain all connected domains corresponding to diamond pixels;
[0022] All connected domains corresponding to the diamond pixels are added to the diamond connected domain set.
[0023] In one embodiment, the step of obtaining the set variance threshold comprises:
[0024] Obtaining N sample variances of diamond pixel density of N sample diamond wire images, wherein the sand amount of the sample diamond wire images is in a state of uniform sand amount distribution, and N is an integer greater than 1;
[0025] The set variance threshold is determined based on the N sample variances.
[0026] In one embodiment, determining the distribution state of the amount of sand in the diamond wire image according to the judgment result includes:
[0027] If the judgment result indicates that the density variance is less than the set variance threshold, it is determined that the amount of sand in the diamond wire image is in a state of uniform sand distribution;
[0028] If the judgment result indicates that the density variance is not less than the set variance threshold, it is determined that the amount of sand in the diamond wire image is in an unevenly distributed state.
[0029] In one embodiment, the step of preprocessing the diamond wire image to be detected to obtain a preprocessed image includes:
[0030] Converting the diamond wire image into a corresponding target grayscale image;
[0031] 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;
[0032] The ternary image is converted into a binary image, and the binary image is used as the preprocessed image; wherein the binary image includes a plurality of diamond pixels and a plurality of non-diamond pixels.
[0033] In one embodiment, the method further comprises:
[0034] After obtaining the grit distribution states of the target diamond wire corresponding to the plurality of diamond wire images, a comprehensive evaluation result of the grit distribution of the target diamond wire is determined based on the plurality of grit distribution states.
[0035] On the other hand, the present application provides a device for detecting the sand distribution state of a diamond wire, comprising:
[0036] A preprocessing module, used for preprocessing the diamond wire image to be detected to obtain a preprocessed image; wherein the preprocessed image includes a plurality of diamond pixels and a plurality of non-diamond pixels;
[0037] An extraction module, used to extract M window images from the diamond line area of the pre-processed image, wherein M is an integer greater than 1, and the image areas corresponding to the M window images cover the diamond line area;
[0038] A first acquisition module is used to acquire the diamond pixel density of each window image in the M window images, and obtain M diamond pixel densities corresponding to the M window images;
[0039] A second acquisition module is used to acquire the density variance of the M diamond pixel densities;
[0040] A judgment module, used to judge whether the density variance is less than a set variance threshold, and obtain a judgment result;
[0041] A determination module is used to determine the distribution state of the sand amount in the diamond wire image according to the judgment result.
[0042] On the other hand, the present application provides an electronic device, the electronic device comprising:
[0043] processor;
[0044] a memory for storing processor-executable instructions;
[0045] Wherein, the processor is configured to execute the above-mentioned method for detecting the sand amount distribution state of the diamond wire.
[0046] 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 method for detecting the sand distribution state of the diamond wire.
[0047] In the present application, after calculating the M diamond pixel densities of the M window images extracted from the diamond wire area in the diamond wire image, since each diamond pixel density can characterize the distribution of the amount of sand in the window image, by calculating the density variance of the M diamond pixel densities, the discrete degree of the diamond pixel density corresponding to the M window images can be determined. At this time, after comparing the density variance and setting the variance threshold, the detection result of the sand amount distribution state can be accurately obtained. This process is automatically performed by electronic equipment, avoiding the problem of untimely response that may exist in manual quality inspection, and improving the timeliness of diamond wire quality inspection; in addition, by setting the variance threshold as the standard for detection, the problem of relying on manual experience and being unable to obtain objective quality inspection results is avoided. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] 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.
[0049] Figure 1 A schematic flow chart of a method for detecting the sand distribution state of a diamond wire provided in one embodiment of the present application;
[0050] Figure 2 An embodiment of the present application provides Figure 1 Detailed flow chart of step 120;
[0051] Figure 3 A schematic diagram of a diamond wire image provided by an embodiment of the present application;
[0052] Figure 4 A schematic diagram of a diamond wire area in a diamond wire image provided by an embodiment of the present application;
[0053] Figure 5 A schematic flow chart of a method for identifying a diamond wire area provided in one embodiment of the present application;
[0054] Figure 6 A block diagram of a device for detecting the sand distribution state of a diamond wire provided in one embodiment of the present application;
[0055] Figure 7 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0056] 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.
[0057] 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.
[0058] See also Figure 1 , is a flow chart of a method for detecting the sand distribution 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 160.
[0059] Step 110: preprocessing the diamond wire image to be detected to obtain a preprocessed image; wherein the preprocessed image includes a plurality of diamond pixels and a plurality of non-diamond pixels.
[0060] The sand amount distribution state refers to the distribution of the sand amount of diamonds on the diamond wire, which can be uniformly distributed or unevenly distributed. In the production process of the target diamond wire, multiple diamond wire images of the target diamond wire can be taken on the production line by an industrial camera for the detection of the sand amount distribution state. Here, the target diamond wire refers to the diamond wire that needs to be detected for the sand amount distribution state. Each diamond wire image can be used to detect the sand amount distribution state of a section of the target diamond wire. Electronic devices (such as: host, server, etc.) docked with the industrial camera can obtain diamond wire images from the industrial camera, and then detect the sand amount distribution state with the help of the diamond wire images. The electronic device can use each diamond wire image of the target diamond wire for sand amount distribution state detection, or, can select a diamond wire image every few images for sand amount distribution state detection, or, can periodically select a diamond wire image for sand amount distribution state detection, or, can randomly select several diamond wire images for sand amount distribution state detection.
[0061] For the diamond wire image to be detected, the electronic device can preprocess it to distinguish the diamond pixels (pixels where the diamond is located) and non-diamond pixels (pixels where the mother line and the background are located) in the image to obtain a preprocessed image.
[0062] Step 120: extracting M window images from the preprocessed diamond wire area, wherein M is an integer greater than 1, and the image areas corresponding to the M window images cover the diamond wire area.
[0063] In one embodiment, the electronic device can divide the diamond line area equally in the horizontal direction and the vertical direction to obtain a plurality of window images, for example, divide the diamond line area into 4 equal parts in the horizontal direction and the vertical direction to obtain 16 window images.
[0064] In one embodiment, the electronic device may randomly cut the window image at various positions in the diamond line area according to a preset window size of the window image, thereby obtaining a plurality of window images.
[0065] Step 130: Obtain the diamond pixel density of each window image in the M window images to obtain M diamond pixel densities corresponding to the M window images.
[0066] The diamond pixel density is the ratio of the number of diamond corresponding pixels (diamond pixels) to the total number of pixels in the window image.
[0067] See also Figure 2 , provided in one embodiment of the present application Figure 1 The detailed flow chart of step 130 is as follows: Figure 2 As shown, step 130 may specifically include the following steps 131 to 133.
[0068] Step 131: For each window image in the M window images, obtain the number of diamond pixels of the window image.
[0069] Step 132: Obtain the diamond pixel density of the window image according to the number of diamond pixels of the window image and the total number of window pixels.
[0070] For each window image, the electronic device can count the number of diamond pixels in the window image and the total number of pixels in the window image to obtain the number of diamond pixels and the total number of window pixels, and then divide the number of diamond pixels by the total number of window pixels to obtain the diamond pixel density corresponding to the window image.
[0071] For example, the diamond pixel density can be expressed by the following formula (1):
[0072] Q=cn / M*H (1)
[0073] Among them, Q is the diamond pixel density; cn is the number of diamond pixels in the window image; M is the width of the window image (expressed in the number of pixels); H is the height of the window image (expressed in the number of pixels).
[0074] Step 133: Perform the above operation on each window image in the M window images to obtain M diamond pixel densities. After calculating the diamond pixel densities of the M windows respectively, M diamond pixel densities can be obtained.
[0075] Step 140: Obtain density variances of M diamond pixel densities.
[0076] Step 150: Determine whether the density variance is less than a set variance threshold and obtain a determination result.
[0077] Step 160: Determine the distribution state of the sand amount in the diamond wire image according to the judgment result.
[0078] The variance threshold is set as the basis for detecting the sand distribution state, and is used to distinguish between uniform distribution and uneven distribution. The variance threshold can be configured as needed. For example, the variance threshold can be set to one of the values of 0.25, 0.32, 0.43, etc.
[0079] After obtaining M diamond pixels, the variance of the M diamond densities can be calculated, that is, the density variance. The electronic device can determine whether the density variance is less than a set variance threshold, thereby obtaining a judgment result. Further, the sand amount distribution state in the diamond wire image can be determined based on the judgment result.
[0080] In one embodiment, on the one hand, if the density variance represented by the judgment result is less than the set variance threshold, it means that the discrete degree of the diamond pixel density corresponding to the multiple window images is low, and therefore, it can be determined that the sand amount in the diamond wire image is in a uniform sand amount distribution state. On the other hand, if the density variance represented by the judgment result is not less than the set variance threshold, it means that the discrete degree of the diamond pixel density corresponding to the multiple window images is high, in other words, the diamond sand amount distribution is not uniform, and at this time, it can be determined that the sand amount in the diamond wire image is in an uneven sand amount distribution state.
[0081] Through the above measures, after calculating the M diamond pixel densities of the M window images extracted from the diamond wire area in the diamond wire image, since each diamond pixel density can characterize the distribution of the sand amount in the window image, by calculating the density variance of the M diamond pixel densities, the discrete degree of the diamond pixel density corresponding to the M window images can be determined. At this time, after comparing the density variance and setting the variance threshold, the detection result of the sand amount distribution state can be accurately obtained. This process is automatically performed by electronic equipment, avoiding the problem of untimely response that may exist in manual quality inspection, and improving the timeliness of diamond wire quality inspection; in addition, by setting the variance threshold as a standard for detection, the problem of relying on manual experience and being unable to obtain objective quality inspection results is avoided.
[0082] In one embodiment, when extracting M window images from the diamond line area, the electronic device can control the sliding window to slide horizontally and vertically in the diamond line area of the diamond line image according to a preset sliding step length until the entire diamond line area is traversed. Here, the sliding step length can be configured as needed. Exemplarily, the sliding step length can be 2 pixels, 3 pixels, 4 pixels, etc.
[0083] The sliding window slides horizontally and vertically, and after passing through the entire diamond line area, the entire diamond line area is traversed.
[0084] The electronic device may use the image area in each sliding window as a window image during the sliding process of the sliding window, thereby obtaining M window images.
[0085] Through this measure, the areas within adjacent windows of the sliding window may overlap during the sliding process. Therefore, multiple window images extracted from the diamond wire area may overlap. In this case, a more detailed detection of the sand distribution state at each position of the diamond wire area can be performed.
[0086] In one embodiment, before extracting the window image from the diamond wire region based on the sliding window, the size of the sliding window can be determined. The electronic device can convert the width and height of the sliding window based on the width and height of the diamond wire region to obtain the size of the sliding window. Here, the width and height of the diamond wire region, as well as the width and height of the sliding window, are both expressed in pixels.
[0087] For example, the width of the diamond wire area can be multiplied by a preset conversion coefficient to obtain the width of the sliding window; the height of the diamond wire area can be multiplied by the conversion coefficient to obtain the height of the sliding window. Here, the conversion coefficient can be configured as needed, generally a value between 0 and 1, and for example, the conversion coefficient can be 0.2, 0.25, etc.
[0088] Through the above measures, the size of the sliding window can be adaptively converted based on the size of the diamond wire area, so that a sliding window of appropriate size can extract a window image of the diamond wire area for detecting the sand distribution state.
[0089] In one embodiment, when executing step 131 to obtain the number of diamond pixels of the window image, for each window image in the M window images, the electronic device may select a diamond connected domain in the window image from a pre-acquired diamond connected domain set. The diamond connected domain set is obtained by performing a connected domain analysis on the pre-processed image. The diamond connected domain may be located on the boundary of the window image. In this case, the diamond connected domain is not completely in the window image. For the diamond connected domain, only the portion in the window image is selected.
[0090] The electronic device may use the number of pixels corresponding to all diamond connected domains in the window image as the number of diamond pixels of the window image. The electronic device may accumulate the number of pixels corresponding to all diamond connected domains in the window image to obtain the number of diamond pixels of the window image.
[0091] Through the above measures, since there may be connected domains such as broken particles and white spots in the image that do not belong to diamonds, the diamond connected domains in the window image are selected from the diamond connected domain set to count the number of diamond pixels, which can avoid the interference of the corresponding connected domains such as broken particles and white spots in calculating the correct number of diamond pixels.
[0092] In one embodiment, when obtaining a diamond connected domain set, the electronic device may perform a connected domain analysis on the preprocessed image to obtain all connected domains corresponding to the diamond pixels. In the preprocessed image, diamond pixels may constitute a connected domain. In addition, pixels corresponding to broken particles and white spots may also constitute a connected domain. However, the number of pixels in the connected domain where broken particles and white spots are located is relatively small. After performing a connected domain analysis on the preprocessed image, multiple connected domains may be obtained. Further, connected domains with a pixel count less than a set number threshold are filtered out from the multiple connected domains, and connected domains with a remaining pixel count not less than the set number threshold are used as connected domains corresponding to diamond pixels. Here, the set number threshold may be configured as needed to characterize the minimum number of pixels in the connected domain where a single diamond is located.
[0093] The electronic device may add all connected domains corresponding to the diamond pixels to the diamond connected domain set.
[0094] Through the above measures, multiple connected domains can be obtained through connected domain analysis, and all connected domains corresponding to the diamond can be screened out with the minimum number of pixels in the connected domain where a single diamond is located to form a diamond connected domain set.
[0095] In one embodiment, before executing step 150 , a set variance threshold may be generated.
[0096] The electronic device may obtain N sample variances of diamond pixel density of N sample diamond wire images. Here, the sand amount of the sample diamond wire image is in a state of uniform sand amount distribution, and N is an integer greater than 1.
[0097] The electronic device can directly read the N sample variances corresponding to the calculated N sample diamond wire images from the designated storage location. Alternatively, the electronic device can calculate multiple diamond pixel densities of each sample diamond wire image for N uniformly distributed sample diamond wire images, and calculate the variances of multiple diamond pixel densities for each sample diamond wire image as sample variances, thereby obtaining N sample variances.
[0098] After obtaining the N sample variances, the electronic device may calculate a set variance threshold based on the N sample variances.
[0099] In one embodiment, the electronic device may calculate an average of N sample variances as the set variance threshold. In one embodiment, the electronic device may select a maximum variance from the N sample variances as the set variance threshold.
[0100] Through the above measures, since the sample variance of the diamond pixel density of the uniformly distributed sample diamond wire image can characterize the discrete degree of the diamond pixel density at each position of the uniformly distributed sample diamond wire image, the set variance threshold converted by N sample variances can effectively serve as the basis for sand distribution state detection. If the average of the N sample variances is used as the set variance threshold, the central trend of the discrete degree of each diamond pixel density of the N uniformly distributed sample diamond wire images can be determined to distinguish between uniform distribution and uneven distribution. If the maximum variance of the N sample variances is used as the set variance threshold, the lowest threshold of uniform distribution can be selected to judge the sand distribution state.
[0101] In one embodiment, during the process of preprocessing the diamond wire image to obtain the preprocessed image, the electronic device may convert the diamond wire image into a corresponding target grayscale image.
[0102] The diamond wire image is a three-channel image with the color channel order of BGR (Blue Green Red). The detection of the sand distribution state only requires a single-channel image. In order to reduce the amount of calculation and facilitate subsequent processing, the diamond wire image is converted into a single-channel grayscale image as the 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, where 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.
[0103] See also Figure 3 , is a schematic diagram of a diamond wire image provided by an embodiment of the present application, such as Figure 3 As shown in the figure, the black part of the diamond wire image is the background; the gray part is the edge of the busbar, and the busbar is between the two busbar edges; the brightest part is the diamond on the busbar. The busbar and diamond together constitute the diamond wire.
[0104] The electronic device can cluster the pixels in the target grayscale image through three preset initial clustering centers, and generate a ternary image based on the clustering result, 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, wherein the binary image includes a plurality of diamond pixels and a plurality of non-diamond pixels. The electronic device can use the binary image as a preprocessed image.
[0105] 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.
[0106] 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.
[0107] 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.
[0108] 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.
[0109] 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 preprocessed image corresponding to the diamond wire image.
[0110] After the preprocessed image is generated, the diamond wire region can be identified from the preprocessed image. The diamond wire region is the region where the diamond wire is located in the diamond wire image. Figure 4 , is a schematic diagram of a diamond wire area in a diamond wire image provided by an embodiment of the present application, such as Figure 4 As shown, the area between the upper boundary and the lower boundary of the diamond wire is the diamond wire area.
[0111] In one embodiment, see Figure 5 , is a flow chart of a method for identifying a diamond wire region provided in one embodiment of the present application, such as Figure 5 As shown, the method may include the following steps 510 to 540.
[0112] Step 510: summing the pixel values of each row of pixels in the preprocessed image, and determining whether the summation result is greater than a preset numerical threshold.
[0113] Here, the numerical threshold is used to distinguish the diamond line boundary. The numerical threshold can be configured as needed and is adaptively adjusted based on the specified positive integer. If the specified positive integer is 1, the numerical threshold is smaller; if the specified positive integer is 255, the numerical threshold is larger.
[0114] The electronic device may scan each row of pixels in the preprocessed image row by row, and sum the pixel values of the scanned row of pixels. After obtaining the summation result, it may be determined whether the summation result is greater than a numerical threshold.
[0115] Step 520: Scan the pixels of the first row of pixels whose sum is greater than the numerical threshold from the top row of pixels of the pre-processed image row by row, and use it as the upper boundary of the target diamond line.
[0116] From the top row of pixels in the preprocessed image, when scanning down row by row, if the sum of the scanned row of pixels is not greater than the numerical threshold, the scanning can continue. When the sum of the scanned first row of pixels is greater than the numerical threshold, this row of pixels can be used as the upper boundary of the target diamond line in the image.
[0117] Step 530: Scan upward row by row from the bottom row of pixels in the preprocessed image, and find the first row of pixels whose sum is greater than the numerical threshold, as the lower boundary of the target diamond line.
[0118] Step 540: The area between the upper boundary and the lower boundary is used as the diamond wire area.
[0119] From the bottom row of pixels in the preprocessed image, when scanning upwards row by row, if the sum of the scanned row of pixels is not greater than the numerical threshold, the scanning upwards can be continued. When the sum of the scanned first row of pixels is greater than the numerical threshold, this row of pixels can be used as the lower boundary of the target diamond line in the image.
[0120] After determining 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. Based on the diamond line area in the preprocessed image, the diamond line area in the denoised image and the diamond line area in the diamond line image can be determined accordingly.
[0121] Through the above measures, since the pixel value of the diamond corresponding pixel in the preprocessed image is a specified positive integer, and the pixel value of the non-diamond (motherline or background) corresponding pixel is zero, in the process of scanning pixels line by line and summing pixel values, if a diamond on the edge of the diamond line is encountered, the sum result will change significantly. Therefore, based on the numerical threshold, a row of pixels with a large number of diamond corresponding pixels can be effectively screened out, thereby accurately identifying the upper and lower boundaries of the target diamond line.
[0122] In one embodiment, after the electronic device determines the detection results of the corresponding sand amount distribution state for each diamond wire image of the target diamond wire, it can determine the comprehensive evaluation result of the sand amount distribution state of the target diamond wire based on the multiple sand amount distribution states. The comprehensive evaluation result represents the sand amount distribution state of the entire target diamond wire.
[0123] Exemplarily, the electronic device may calculate the proportion of unevenly distributed recognition results among the multiple recognition results. The electronic device may multiply the proportion by one hundred and subtract the product from one hundred to obtain an evaluation score of the sand amount distribution state, and the evaluation score is used as a comprehensive evaluation result. Here, the larger the evaluation score, the more uniform the sand amount distribution state of the diamond on the target diamond wire.
[0124] Through the above measures, based on the detection results characterizing the sand amount distribution state of each section on the target diamond wire, a comprehensive evaluation result can be integrated and converted, thereby indicating the diamond sand amount distribution state of the target diamond wire as a whole.
[0125] Figure 6 is a block diagram of a device for detecting the sand distribution state of a diamond wire according to an embodiment of the present invention. Figure 6 As shown, the device may include:
[0126] A preprocessing module 610 is used to preprocess the diamond wire image to be detected to obtain a preprocessed image; wherein the preprocessed image includes a plurality of diamond pixels and a plurality of non-diamond pixels;
[0127] An extraction module 620, configured to extract M window images from the diamond line region of the preprocessed image, wherein M is an integer greater than 1, and the image regions corresponding to the M window images cover the diamond line region;
[0128] A first acquisition module 630 is used to acquire the diamond pixel density of each window image in the M window images, and obtain M diamond pixel densities corresponding to the M window images;
[0129] A second acquisition module 640 is used to acquire the density variance of the M diamond pixel densities;
[0130] A judgment module 650 is used to judge whether the density variance is less than a set variance threshold and obtain a judgment result;
[0131] The determination module 660 is used to determine the distribution state of the sand amount in the diamond wire image according to the judgment result.
[0132] In one embodiment, the extraction module 620 is further configured to:
[0133] According to a preset sliding step length, the sliding window is controlled to slide in the horizontal and vertical directions of the diamond wire area until the entire diamond wire area is traversed;
[0134] The image areas within all the sliding windows obtained by traversal are taken as the M window images.
[0135] In one embodiment, the first acquisition module 630 is further configured to:
[0136] For each window image in the M window images, obtaining the number of diamond pixels of the window image;
[0137] According to the number of diamond pixels of the window image and the total number of window pixels, the diamond pixel density of the window image is obtained;
[0138] The above operation is performed on each window image of the M window images to obtain the M diamond pixel densities.
[0139] In one embodiment, the first acquisition module 630 is further configured to:
[0140] For each window image in the M window images, a diamond connected domain in the window image is selected from a pre-acquired diamond connected domain set, and the number of pixels corresponding to all diamond connected domains in the window image is used as the number of diamond pixels of the window image, wherein the diamond connected domain set is obtained by performing connected domain analysis on the preprocessed image.
[0141] In one embodiment, the first acquisition module 630 is further configured to:
[0142] Performing connected domain analysis on the preprocessed image to obtain all connected domains corresponding to diamond pixels;
[0143] All connected domains corresponding to the diamond pixels are added to the diamond connected domain set.
[0144] In one embodiment, the determination module 650 is further configured to:
[0145] Obtaining N sample variances of diamond pixel density of N sample diamond wire images, wherein the sand amount of the sample diamond wire images is in a state of uniform sand amount distribution, and N is an integer greater than 1;
[0146] The set variance threshold is determined based on the N sample variances.
[0147] In one embodiment, the determination module 660 is further configured to:
[0148] If the judgment result indicates that the density variance is less than the set variance threshold, it is determined that the amount of sand in the diamond wire image is in a state of uniform sand distribution;
[0149] If the judgment result indicates that the density variance is not less than the set variance threshold, it is determined that the amount of sand in the diamond wire image is in an unevenly distributed state.
[0150] In one embodiment, the preprocessing module 610 is further configured to:
[0151] Converting the diamond wire image into a corresponding target grayscale image;
[0152] 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;
[0153] The ternary image is converted into a binary image, and the binary image is used as a preprocessed image; wherein the binary image includes a plurality of diamond pixels and a plurality of non-diamond pixels.
[0154] In one embodiment, the determination module 660 is further configured to:
[0155] After obtaining the grit distribution states of the target diamond wire corresponding to the plurality of diamond wire images, a comprehensive evaluation result of the grit distribution of the target diamond wire is determined based on the plurality of grit distribution states.
[0156] 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 method for detecting the sand distribution state of the diamond wire, and will not be repeated here.
[0157] 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 method for detecting the sand distribution state of the diamond wire.
[0158] 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.
[0159] 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 method for detecting the sand distribution state of the diamond wire provided in the present application.
[0160] 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.
[0161] 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.
[0162] 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 distribution state of a diamond wire, characterized in that: include: Preprocessing the diamond wire image to be detected to obtain a preprocessed image; wherein the preprocessed image includes a plurality of diamond pixels and a plurality of non-diamond pixels; Extracting M window images from the diamond line region of the preprocessed image, wherein M is an integer greater than 1, and image regions corresponding to the M window images cover the diamond line region; Obtaining the diamond pixel density of each window image in the M window images, and obtaining M diamond pixel densities corresponding to the M window images; Obtaining density variance of the M diamond pixel densities; Determine whether the density variance is less than a set variance threshold, and obtain a determination result; According to the judgment result, the distribution state of the sand amount in the diamond wire image is determined.
2. The method according to claim 1, characterized in that The extracting M window images from the diamond line region of the pre-processed image comprises: According to a preset sliding step length, the sliding window is controlled to slide in the horizontal and vertical directions of the diamond wire area until the entire diamond wire area is traversed; The image areas within all the sliding windows obtained by traversal are taken as the M window images.
3. The method according to claim 1, characterized in that The obtaining of the diamond pixel density of each window image in the M window images to obtain M diamond pixel densities corresponding to the M window images includes: For each window image in the M window images, obtaining the number of diamond pixels of the window image; According to the number of diamond pixels of the window image and the total number of window pixels, the diamond pixel density of the window image is obtained; The above operation is performed on each window image of the M window images to obtain the M diamond pixel densities.
4. The method according to claim 3, characterized in that The step of obtaining the number of diamond pixels of each window image in the M window images includes: For each window image in the M window images, a diamond connected domain in the window image is selected from a pre-acquired diamond connected domain set, and the number of pixels corresponding to all diamond connected domains in the window image is used as the number of diamond pixels of the window image, wherein the diamond connected domain set is obtained by performing connected domain analysis on the preprocessed image.
5. The method according to claim 4, characterized in that The step of obtaining the diamond connected domain set comprises: Performing connected domain analysis on the preprocessed image to obtain all connected domains corresponding to diamond pixels; All connected domains corresponding to the diamond pixels are added to the diamond connected domain set.
6. The method according to claim 1, characterized in that The step of obtaining the set variance threshold comprises: Obtaining N sample variances of diamond pixel density of N sample diamond wire images, wherein the sand amount of the sample diamond wire images is in a state of uniform sand amount distribution, and N is an integer greater than 1; The set variance threshold is determined based on the N sample variances.
7. The method according to claim 1, characterized in that Determining the distribution state of the sand amount in the diamond wire image according to the judgment result includes: If the judgment result indicates that the density variance is less than the set variance threshold, it is determined that the amount of sand in the diamond wire image is in a state of uniform sand distribution; If the judgment result indicates that the density variance is not less than the set variance threshold, it is determined that the amount of sand in the diamond wire image is in an unevenly distributed state.
8. The method according to claim 1, characterized in that: The step of preprocessing the diamond wire image to be detected to obtain a preprocessed image includes: 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 a binary image, and the binary image is used as the preprocessed image; wherein the binary image includes a plurality of diamond pixels and a plurality of non-diamond pixels.
9. The method according to claim 1, characterized in that: The method further comprises: After obtaining the grit distribution states of the target diamond wire corresponding to the plurality of diamond wire images, a comprehensive evaluation result of the grit distribution of the target diamond wire is determined based on the plurality of grit distribution states.
10. A device for detecting the sand distribution state of a diamond wire, characterized in that: include: A preprocessing module, used for preprocessing the diamond wire image to be detected to obtain a preprocessed image; wherein the preprocessed image includes a plurality of diamond pixels and a plurality of non-diamond pixels; An extraction module, used to extract M window images from the diamond line area of the pre-processed image, wherein M is an integer greater than 1, and the image areas corresponding to the M window images cover the diamond line area; A first acquisition module is used to acquire the diamond pixel density of each window image in the M window images, and obtain M diamond pixel densities corresponding to the M window images; A second acquisition module is used to acquire the density variance of the M diamond pixel densities; A judgment module, used to judge whether the density variance is less than a set variance threshold, and obtain a judgment result; A determination module is used to determine the sand amount distribution state in the diamond wire image according to the judgment result.
11. 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 method for detecting the sand distribution state of the diamond wire as described in any one of claims 1-9.
12. 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 detecting the sand distribution state of the diamond wire according to any one of claims 1 to 9.
Citation Information
Patent Citations
Diamond wire quality parameter detection device and processing parameter debugging method thereof
CN108204988A
Diamond fretsaw surface abrasive particle distribution uniformity evaluation method
CN112801973A
Diamond wire surface carborundum particle quality detection method based on machine vision
CN113063705A
Diamond wire monitoring device
CN216816461U