Method and device for detecting quantity of rod-shaped materials in tray box

In the cigarette production process, the number of rod-shaped materials in the disk box is detected by using threshold segmentation and Hoff circle detection combined with contour extraction method, which solves the problems of inaccurate detection and low efficiency in the prior art, and achieves fast and accurate material quantity statistics.

CN119599938APending Publication Date: 2025-03-11XUCHANG TOBACCO MACHINERY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411424589.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

In the prior art, when detecting the number of rod-shaped materials in the disk box, there is a problem that the rod is stuck, the situation of random rods cannot be accurately identified, and the detection algorithm is greatly affected by the filling effect and light source, and the identification time is long.

Method used

The disk box image is detected by using a method based on threshold segmentation and Hough circle detection, and the hollow is identified by combining the contour extraction method. By calculating the difference between the number of rod-shaped materials and the number of voids, the quantity of materials in the disk box is accurately counted.

Benefits of technology

It realizes fast, convenient and accurate detection of the quantity of rod-shaped materials in the disc box, and solves the accuracy and efficiency of material quantity detection in the cigarette production process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119599938A_ABST
    Figure CN119599938A_ABST
Patent Text Reader

Abstract

The invention provides a method for detecting the number of rod-shaped materials in a disc box, and the method comprises the following steps: obtaining a disc box image, and carrying out the preprocessing of the disc box image; performing bar-shaped material detection on the preprocessed disc box image based on threshold segmentation and Hough circle detection, and determining the number of bar-shaped materials in the disc box image based on a bar-shaped material detection result; carrying out hole identification detection on the preprocessed disk box image based on a contour extraction method, and determining the number of holes in the disk box image based on a hole identification detection result; and calculating a difference value between the number of the rod-shaped materials and the number of the holes, wherein the difference value is the final number of the rod-shaped materials in the disc box.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a quantity detection method and device, and in particular to a quantity detection method and device for rod-shaped materials in a disk box. Background Art

[0002] In the process of cigarette processing and production, filter rod production, cigarette rolling, cigarette packaging and other links often require rod-shaped materials such as filter rods or cigarettes to be loaded into trays for storage and transportation through tray loading machines. During the storage and transportation process, filter rods or cigarettes are regularly stacked in the trays and passed to the next process. After the materials are emptied, the trays wait for the next refilling of materials. Among them, before the materials are sent to the next process, their quantity must be accurate and their quality must be intact. When the quantity of materials in the tray does not meet the requirements, it will be prohibited to transport them to downstream equipment. Therefore, manufacturers need to accurately obtain the materials in the trays, and at the same time adjust the operating status of the tray loading machine in time according to the loss of materials in the trays to ensure the quality of the materials loaded into the trays.

[0003] At present, the tray loading machines used by domestic cigarette companies use the following methods to detect the number of rod-shaped materials: counting by adding mechanical devices, counting by identifying holes, and counting by external identification devices. The method of counting by adding mechanical devices refers to installing a drum on the tray loading machine, and the filter rods fall into the tray box through the drum. The number of filter rods is obtained by the number of rotations of the drum. This method can better identify the number of filter rods when the filter rods are arranged neatly, but when there are disordered rods in the tray loading machine channel, there will be a stick jam phenomenon when the drum is turned, resulting in the inability to accurately count the number of filter rods. The detection method of identifying the number of holes in the tray box refers to the number of designed filling materials in the tray box is known, the number of holes in the tray box is identified after the filling is completed, and the actual number of materials in the tray box is obtained by subtracting the number of holes identified from the designed filling number. This method can accurately detect the number of materials when the arrangement and height of the materials in the tray box are consistent with the design, but when the actual arrangement and height are greatly different from the design, the missing materials cannot be completely detected through the holes, which cannot accurately reflect the number of materials in the tray box. When counting is performed through an external recognition device, the detection algorithm is greatly affected by the filling effect of the tray box and the external light source, and the detection algorithm recognition time is relatively long. Therefore, it is necessary to develop a new, convenient and accurate method and device for detecting the number of rod-shaped materials in the tray box.

[0004] In order to solve the above problems, people have been seeking an ideal technical solution. Summary of the invention

[0005] The purpose of the present invention is to address the deficiencies in the prior art and to provide a method and device for detecting the amount of rod-shaped materials in a tray box, so as to solve the related problems of detecting the amount of materials in a tray box when a tray loading machine is loading materials, and to achieve fast, convenient and accurate detection of the amount of materials in the tray box.

[0006] In order to achieve the above object, the technical solution adopted by the present invention is: A first aspect provides a method for detecting the amount of stick-shaped materials in a disk box, comprising the following steps: Collecting the disk box image under the specific operation state of the disk loading machine and preprocessing the disk box image; Performing rod-shaped material detection on the preprocessed disk box image based on threshold segmentation and Hough circle detection, and determining the number of rod-shaped materials in the disk box image based on the rod-shaped material detection result; Performing hole recognition detection on the preprocessed disk box image based on the contour extraction method, and determining the number of holes in the disk box image based on the hole recognition detection result; The difference between the number of rod-shaped materials and the number of cavities is calculated, and the difference is the final number N of rod-shaped materials in the tray box.

[0007] Further, the steps of performing rod-shaped material detection on the preprocessed disk box image based on threshold segmentation and Hough circle detection, and determining the number of rod-shaped materials in the disk box image based on the rod-shaped material detection result include: Convert the preprocessed disk box image to a USINT format. Perform threshold segmentation on the disk box image in USINT format to obtain a binary image; Process the binary image based on Hough circle detection to obtain all circular materials; Traverse all circles, and for each circle, determine whether the center pixel is greater than the pixel value threshold, and whether the center is in the set detection area. If so, the number of filter rods is triggered to increase by 1, and the center of the circle is drawn on the disk box image; if not, continue to determine the next circle; until all circles are traversed, the number of rod-shaped materials is output.

[0008] Further, the steps of performing hole recognition detection on the preprocessed disk box image based on the contour extraction method and determining the number of holes in the disk box image based on the hole recognition detection result include: Performing filtering on the preprocessed disk box image; Subtract the image before filtering from the image after filtering to obtain a difference image; Perform threshold segmentation on the difference image to obtain a binary image; The binary image is processed based on the contour extraction method to identify the cavity contour; Traverse the hole contours, and for each hole contour, determine whether its contour area meets the first hole condition and whether its hole centroid pixel and contour area meet the second hole condition. If both are satisfied, the trigger hole number is increased by 1, and the hole contour is drawn on the disk box image; otherwise, continue to determine whether the next hole contour meets the first hole condition and the second hole condition; After traversing all detected holes, output the number of holes.

[0009] A second aspect provides a device for detecting the number of rod-shaped materials in a tray box, comprising: An image preprocessing module, used for acquiring a disk box image and preprocessing the disk box image; The material recognition and statistics module detects stick-shaped materials on the preprocessed disk box image based on threshold segmentation and Hough circle detection, and determines the number of stick-shaped materials in the disk box image based on the stick-shaped material detection result; A hole recognition module performs hole recognition detection on the preprocessed disk box image based on a contour extraction method, and determines the number of holes in the disk box image based on the hole recognition detection result; The output module calculates the difference between the number of rod-shaped materials and the number of cavities, and the difference is the final number of rod-shaped materials in the tray box.

[0010] A second aspect provides a device for detecting the number of rod-shaped materials in a tray box, comprising an industrial camera, a bar light source, a light source fixing bracket, a height adjustment column, a camera fixing plate, a camera cover, and an industrial computer; The industrial camera is fixed on a camera fixing plate and is used to capture images of the tray box filled with materials; The light source fixing bracket is distributed on the tray loading machine frame in four directions of up, down, left and right in front of the industrial camera, and is used to fix the strip light source; The strip light source is used for ambient fill light during image acquisition; The height adjustment column is installed on the bottom plate of the tray loading machine push cylinder and is used for adjusting the height of the industrial camera; The industrial computer is installed in the electric control cabinet and is used to run the aforementioned method for detecting the quantity of rod-shaped materials in the tray box.

[0011] The present invention has outstanding substantive features and significant progress compared to the prior art. Specifically, the present invention identifies the rod-shaped materials in the pre-processed disk box image based on threshold segmentation and Hough circle detection, calculates the difference between the number of rod-shaped materials and the number of cavities obtained by the two detections, and finally obtains the number of rod-shaped materials in the disk box. That is, the accurate statistics of the rod-shaped materials in the disk box are achieved by combining the methods of threshold segmentation, morphological operation, contour recognition, etc.

[0012] Furthermore, the present invention provides a system for detecting the quantity of rod-shaped materials in trays and boxes, which has a simple structure, high algorithm operation efficiency, and fast and accurate material quantity detection. It solves the problem of detecting the quantity of rod-shaped materials in trays and boxes on the tray loading machine production line during the cigarette production process, and realizes material quantity supervision during the storage and transportation of trays and boxes, avoiding the loss of material quantity transmitted to downstream equipment and users. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 This is the implementation process of the method for detecting the amount of material in the disc box described in the present invention.

[0014] Figure 2 It is a flow chart of the rod-shaped material detection method of the present invention.

[0015] Figure 3 It is a flow chart of the cavity identification and detection described in the present invention.

[0016] Figure 4 It is the image of the physical disk box captured by the industrial camera.

[0017] Figure 5 It is the image after threshold segmentation in the material detection in the disk box.

[0018] Figure 6 It is the identification image output by the material detection in the tray box.

[0019] Figure 7 It is the image output after filtering in the misidentified hole detection.

[0020] Figure 8 It is the image after threshold segmentation in misidentified hole detection.

[0021] Fig. 9 is the recognized image output by the misidentified hole detection.

[0022] Fig.10 The schematic diagram of the device for detecting the quantity of materials in the disk box of the present invention is Figure 1 .

[0023] Fig.11 The schematic diagram of the device for detecting the quantity of materials in the disk box of the present invention is Figure 2 .

[0024] In the figure: 1. Industrial camera, 2. Camera cover, 3. Camera fixing plate, 4. Cylinder bottom plate, 5. Height adjustment column screw, 6. Height adjustment column nut, 7. Height adjustment column, 8. Camera triggering position for taking pictures, 9. Left and right light source fixing brackets, 10. Upper and lower light source fixing brackets, 11. Upper and lower light sources, 12. Left and right light sources, 13. Holes that are mistakenly detected when the disk boxes are identified one by one. DETAILED DESCRIPTION

[0025] The technical solution of the present invention is further described in detail below through specific implementation methods.

[0026] Example 1 This embodiment provides a method for detecting the number of rod-shaped materials in a tray box. Figure 1 , including the following steps: Acquire the disk box image and pre-process the disk box image; wherein the pre-processing includes proportional reduction to prevent memory overflow during image recognition due to excessive image pixels; it is understood that the pre-processing may also include denoising, brightness adjustment and other processing in specific implementation; Performing rod-shaped material detection on the preprocessed disk box image based on threshold segmentation and Hough circle detection, and determining the number of rod-shaped materials in the disk box image based on the rod-shaped material detection result; Performing hole recognition detection on the preprocessed disk box image based on the contour extraction method, and determining the number of holes in the disk box image based on the hole recognition detection result; The difference between the number of rod-shaped materials and the number of cavities is calculated, and the difference is the final number of rod-shaped materials in the tray box.

[0027] Since the arrangement of the rod-shaped materials in the tray box is random and uncertain when the rod-shaped materials are detected one by one, the shape and centroid pixels of the holes are similar to those of the rod-shaped materials, which can easily cause the holes to be mistakenly identified as rod-shaped materials. Therefore, after obtaining the number of rod-shaped materials, it is necessary to further eliminate the number of holes mistakenly identified as materials through hole recognition detection. Only then is the number of rod-shaped materials obtained accurate.

[0028] Specifically, Figure 2 As shown, the steps of performing rod-shaped material detection on the preprocessed disk box image based on threshold segmentation and Hough circle detection, and determining the number of rod-shaped materials in the disk box image based on the rod-shaped material detection result include: The preprocessed disk box image is converted into a USINT format disk box image. Figure 4 As shown; it should be noted here that, since the input image of threshold segmentation and Hough detection must be in USINT format, the proportionally reduced disk box image must first be converted into USINT format before executing subsequent steps.

[0029] Perform threshold segmentation on the disk box image in USINT format to obtain a binary image, such as Figure 5 shown.

[0030] Preferably, in order to eliminate uneven lighting or uneven distribution of grayscale values, an adaptive threshold segmentation method can be used to perform threshold segmentation on the disk box image in USINT format, wherein the adaptive threshold segmentation method adopts an average adaptive method and a threshold binarization type.

[0031] The binary image is processed based on Hough circle detection to obtain all circular materials.

[0032] Hough circle detection is an image processing algorithm based on Hough transform that finds circular contours by accumulating in parameter space. It is generally used to detect and locate circular targets in a given image. The core idea is to represent the circle as a curve in parameter space and record the intersection of the curve and the edge points in the image through an accumulator array. When the accumulated value of a certain parameter combination exceeds the preset threshold, it is considered that the circle corresponding to the parameter combination exists in the image. I will not go into details here.

[0033] Traverse all circles, and for each circle, determine whether the center meets the preset conditions. If so, the number of stick-shaped materials is increased by 1, and the center of the circle is drawn on the disk box image; if not, continue to determine the next circle; until all circles are traversed, the number of stick-shaped materials is output. The specific results are as follows Figure 6 As shown. Preferably, the preset condition is whether the center pixel of the circle is greater than the pixel value threshold, and whether the center of the circle is within the set detection area. Among them, the set detection area should be as small as possible, but must include the area within the disk box. This is because the collected disk box image has areas outside the disk box. In order to eliminate the influence of the external area on the Hough circle detection, it is necessary to divide the set detection area. In addition, the pixel value threshold is set to eliminate the influence of lighting conditions on the Hough circle detection. Under normal circumstances, the pixel threshold is between 20-50. In actual use, it can be adjusted within this range according to the detection effect.

[0034] Specifically, Figure 3 As shown, the steps of performing hole recognition detection on the preprocessed disk box image based on the contour extraction method and determining the number of holes in the disk box image based on the hole recognition detection result include: Performing filtering on the preprocessed disk box image, finding the dark areas with connected boundaries in the disk box image and filling them; Subtract the image before filtering from the image after filtering to get the difference image, such as Figure 7 As shown, the difference image contains hole features; Perform threshold segmentation on the difference image to obtain a binary image, such as Figure 8 As shown; The binary image is processed based on the contour extraction method to identify the cavity contour; Traverse the hole contours, and for each hole contour, determine whether its contour area meets the first hole condition and whether its hole centroid pixel and contour area meet the second hole condition. If both are satisfied, the trigger hole number is increased by 1, and the hole contour is drawn on the disk box image; otherwise, continue to determine whether the next hole contour meets the first hole condition and the second hole condition; wherein, the first hole condition is that the contour area is between the set area upper limit and the set area lower limit, and the set area upper limit and the set area lower limit can be set in advance; the second hole condition is that the hole centroid pixel and contour area are both greater than the set value. It can be understood that the set threshold of the contour area is between the set area upper limit and the set area lower limit, and is usually a threshold slightly smaller than the contour area.

[0035] After traversing all detected holes, the number of holes is output. The specific results are as follows Fig. 9 shown.

[0036] Further, for each hole contour, when judging whether its contour area satisfies the first hole condition and whether its hole centroid pixel and contour area satisfy the second hole condition, the following steps are performed: For each hole contour, determine whether its contour area meets the first hole condition. When the first hole condition is met, continue to determine whether its hole centroid pixel and contour area meet the second hole condition.

[0037] When performing hole recognition, there may be hole contours that are too large or too small. Therefore, it is necessary to set the upper and lower limits of the area of ​​the first hole condition for preliminary screening, so as to screen out the holes within this range, thereby preliminarily eliminating irrelevant holes that are too large or too small in the image, reducing the subsequent workload of hole judgment and improving judgment efficiency; the hole area in the second hole condition is equivalent to making an accurate judgment based on the first step of screening, so as to further eliminate small holes in the image; through two judgments, holes that meet the actual situation are identified.

[0038] It should be noted that the pixel setting value of the center of mass of the void in the void identification and detection is the same as the pixel value threshold of the center of the circle in the material detection and identification. This is the only way to determine the voids that are mistakenly identified as bars in the material detection and identification.

[0039] The present invention integrates threshold segmentation, morphological operation, contour recognition and other methods to achieve accurate statistics of rod-shaped materials in a tray box.

[0040] Example 2 This embodiment provides a device for detecting the number of stick-shaped materials in a tray box, comprising: An image preprocessing module, used for acquiring a disk box image and preprocessing the disk box image; The material recognition and statistics module detects stick-shaped materials on the preprocessed disk box image based on threshold segmentation and Hough circle detection, and determines the number of stick-shaped materials in the disk box image based on the stick-shaped material detection result; A hole recognition module performs hole recognition detection on the preprocessed disk box image based on a contour extraction method, and determines the number of holes in the disk box image based on the hole recognition detection result; The output module calculates the difference between the number of rod-shaped materials and the number of cavities, and the difference is the final number of rod-shaped materials in the tray box.

[0041] Example 3 This embodiment provides a system for detecting the number of rod-shaped materials in a tray box. Figure 10-11 As shown, it includes an industrial camera 1, a strip light source, a light source fixing bracket, a height adjustment column 7, a camera fixing plate 3, a camera cover 2 and an industrial computer; The industrial camera is fixed on the camera fixing plate 3 and is used to capture images of the tray box filled with materials; The light source fixing bracket is distributed on the tray loading machine frame in four directions of up, down, left and right in front of the industrial camera 1, and is used to fix the strip light source; specifically, the light source fixing bracket is divided into left and right light source fixing brackets 9 and upper and lower light source fixing brackets 10 according to the layout position.

[0042] The strip light source is used for ambient fill light during image acquisition; specifically, the strip light source is divided into upper and lower light sources and left and right light sources 12 according to the layout position.

[0043] The height adjustment column is installed on the bottom plate 4 of the tray loading machine push cylinder and is used for adjusting the height of the industrial camera 1; The industrial computer is installed in the electric control cabinet and is used to execute the method for detecting the number of rod-shaped materials in the disk box described in Example 1.

[0044] Furthermore, a camera fixing plate 3 is provided, and the camera fixing plate 3 is fixedly provided on the height adjustment column 7. The camera fixing plate 3 is provided with four long holes, and the front and rear positions of the industrial camera 1 are adjusted by cooperating with the studs.

[0045] Furthermore, a camera cover 2 is also provided on the camera fixing plate 3 to protect the industrial camera.

[0046] Furthermore, the light source fixing bracket is provided with an annular hole to adjust the angle of the light source.

[0047] The working process of the rod-shaped material quantity detection system in the tray box is as follows: Fix the industrial camera 1 to the long hole on the camera fixing plate 3 by means of screws, and adjust the front and rear position of the industrial camera 1 by adjusting the fixed position of the industrial camera 1 on the long hole, and fix the camera cover 2 on the camera fixing plate 3; fix the camera fixing plate 3 to the cylinder base plate 4 by means of the height adjustment column screw 5, the height adjustment column nut 6 and the height adjustment column 7, loosen the height adjustment column screw 5 and the height adjustment column nut 6, adjust the height adjustment column 7 to the appropriate height, first lock the height adjustment column nut 6, and then lock the height adjustment column screw 5 to adjust the height position of the industrial camera 1.

[0048] like Fig.11 As shown, the left and right light source fixing brackets 9 and the upper and lower light source fixing brackets 10 are fixed on the tray loading machine frame, the upper and lower light sources 11 are fixed on the upper and lower light source fixing brackets 10 by screws, and the left and right light sources 12 are fixed on the left and right light source fixing brackets 9 by screws. The upper and lower light sources 11 can be rotated up and down to adjust the light source illumination area, and the left and right light sources 12 can be rotated left and right to adjust the light source illumination area.

[0049] like Fig.10 As shown, 8 is the camera triggering position. When the tray box filled with materials is pushed onto the full tray table and transported to position 8, the industrial camera is triggered to collect the tray box image. Figure 4 Shown is the captured disk box image.

[0050] The data is transmitted to the industrial computer through the network cable to execute the material quantity detection algorithm. At this time, the disk box image is preprocessed first, and then the rod-shaped materials are detected one by one and the hole recognition detection is performed on the preprocessed disk box image. Finally, the number of materials obtained by detecting the rod-shaped materials one by one is subtracted from the number of holes obtained by the hole recognition detection, that is, the final number of materials identified in the disk box is obtained.

[0051] In specific implementation, preprocessing the disk box image means reducing the image size proportionally, for example, reducing the size to 1824*1216. The purpose of image reduction is to prevent memory overflow during image recognition due to excessive image pixels.

[0052] like Figure 2 As shown, the detection of rod-shaped materials in the tray box includes the following steps: Step 1: Since the input image for threshold segmentation and Hough detection must be in USINT format, the scaled-down disk box image needs to be converted into USINT format.

[0053] Step 2: Perform threshold segmentation on the image obtained in step 1. Preferably, in order to eliminate uneven illumination or uneven distribution of gray values, adaptive threshold segmentation is used, and the adaptive threshold segmentation is carried out using an average adaptive method and a threshold binarization type. Figure 7 This is the image after threshold segmentation.

[0054] Step 3: Perform Hough circle detection on the binary image obtained in step 2, set the detection conditions: accumulator value, minimum circle center distance, threshold, number of votes, maximum and minimum circle radius. After the detection is completed, the detected circles that meet the detection conditions are stored in a container, which contains the X and Y coordinates of the circle center and the circle radius.

[0055] Step 4: Traverse all circles stored in the container, determine whether the center pixel is greater than the set pixel threshold, and whether the center is within the set detection area. If the identified circle meets the judgment conditions, jump to step 5. If the identified circle does not meet the judgment conditions, stay in step 4 to continue detecting the remaining circles. If all circle judgments are completed, the algorithm jumps to step 6.

[0056] Since the collected disk box image contains areas outside the disk box, the influence of the external area on the Hough circle detection can be eliminated by defining the detection area, and the false detection of circles caused by lighting conditions can be eliminated by specifying the pixel threshold.

[0057] Step 5: Add 1 to the number of materials and draw the center of mass of the materials on the disk box image; it can be understood that the initial value of the number of materials is 0.

[0058] Step 6: After traversing all the circles stored in the container, output the detected quantity N1 of the material in the tray box.

[0059] Figure 6 is the recognition result image of each material detection. It can be seen that Figure 6 There are 13 holes in the image where rod-shaped materials are mistakenly identified. The reason is that when the materials in the tray box are detected one by one, the material arrangement is different. The shape and centroid pixels of the holes are similar to those of the materials, causing the holes to be mistakenly identified as materials. It is necessary to eliminate the number of holes mistakenly identified as materials through false hole detection.

[0060] like Figure 3 As shown, the hole recognition detection includes the following steps: Step A: Image filtering, find the dark areas with connected boundaries in the proportionally reduced disk box image and fill them.

[0061] Step B: Subtract the image of the disk box before proportional reduction from the image after the dark area is filled in step A to obtain a filtered image containing the hole features. Figure 7 Shown is the filtered image.

[0062] Step C: Perform threshold segmentation on the filtered image. This step uses conventional threshold segmentation and threshold binarization. The threshold is set to 50. Figure 8 Shown is the hole feature image after threshold segmentation.

[0063] Step D: Perform contour search on the binarized image. Return all found contours without considering their hierarchical structure. Compress the elements in the horizontal, vertical, and diagonal directions and only retain the end point coordinates in that direction. The found hole contours are stored in the specified container.

[0064] Step E: Traverse all the found hole contours in the container and determine whether the contour area is between the set area upper and lower limits. If the set area condition is met, the algorithm jumps to step F. If the set area condition is not met, it stays in step E to continue to judge the remaining detected holes. If all hole judgments are completed, jump to step H.

[0065] The purpose of this step is to preliminarily eliminate irrelevant holes that are too large or too small in the image, reduce the workload of subsequent hole judgment, and improve judgment efficiency.

[0066] Step F: Get the centroid pixel and contour area of ​​the hole contour respectively, and then determine whether it is greater than the set value. This determination can further eliminate small holes in the image. If both conditions are met at the same time, jump to step G. If not, jump back to step E and continue to determine the remaining detected holes.

[0067] It should be noted that the setting value of the centroid pixel is the same as the setting value of the center pixel in the material detection, so that the voids in the tray box that are mistakenly identified as rods in the material detection can be determined.

[0068] Step G: Trigger the hole number to increase by 1, and draw the hole outline on the disk box image. It can be understood that the initial value of the hole number is 0.

[0069] After completion, the algorithm returns to step E to continue to determine the remaining detected holes. Fig. 9 This is the image of the void recognition result. It can be seen from the figure that the void that was mistakenly identified as a bar material in the material detection in the tray box can be accurately identified in the void recognition detection.

[0070] Step H: After traversing all detected holes, output the number of falsely detected holes N2.

[0071] The final number of rod-shaped materials in the tray is obtained by subtracting the number of falsely detected voids N2 from the number of material detected N1.

[0072] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or some technical features can be replaced by equivalents without departing from the spirit of the technical solution of the present invention, which should be included in the scope of the technical solution for protection of the present invention.

Claims

1. A method for detecting the number of rod-shaped materials in a tray box, characterized in that: The following steps are involved: Acquire a disk box image and pre-process the disk box image; Performing rod-shaped material detection on the preprocessed disk box image based on threshold segmentation and Hough circle detection, and determining the number of rod-shaped materials in the disk box image based on the rod-shaped material detection result; Performing hole recognition detection on the preprocessed disk box image based on the contour extraction method, and determining the number of holes in the disk box image based on the hole recognition detection result; The difference between the number of rod-shaped materials and the number of cavities is calculated, and the difference is the final number of rod-shaped materials in the tray box.

2. A method for detecting the number of rod-shaped materials in a disk box according to claim 1, characterized in that: The steps of performing rod-shaped material detection on the preprocessed disk box image based on threshold segmentation and Hough circle detection, and determining the number of rod-shaped materials in the disk box image based on the rod-shaped material detection result include: Convert the preprocessed disk box image to a USINT format. Perform threshold segmentation on the disk box image in USINT format to obtain a binary image; Process the binary image based on Hough circle detection to obtain all circular materials; Traverse all circles, and for each circle, determine whether the center pixel is greater than the pixel value threshold, and whether the center is in the set detection area. If so, the number of filter rods is triggered to increase by 1, and the center of the circle is drawn on the disk box image; if not, continue to determine the next circle; until all circles are traversed, the number of rod-shaped materials is output.

3. A method for detecting the number of rod-shaped materials in a disk box according to claim 1, characterized in that: The steps of performing hole recognition detection on the preprocessed disk box image based on the contour extraction method and determining the number of holes in the disk box image based on the hole recognition detection result include: Performing filtering on the preprocessed disk box image; Subtract the image before filtering from the image after filtering to obtain a difference image; Perform threshold segmentation on the difference image to obtain a binary image; The binary image is processed based on the contour extraction method to identify the cavity contour; Traverse the hole contours, and for each hole contour, determine whether its contour area meets the first hole condition and whether its hole centroid pixel and contour area meet the second hole condition. If both are satisfied, the trigger hole number is increased by 1, and the hole contour is drawn on the disk box image; otherwise, continue to determine whether the next hole contour meets the first hole condition and the second hole condition; After traversing all detected holes, output the number of holes.

4. A method for detecting the number of rod-shaped materials in a disk box according to claim 3, characterized in that: For each hole contour, when determining whether its contour area satisfies the first hole condition and whether its hole centroid pixel and contour area satisfy the second hole condition, perform the following steps: For each hole contour, determine whether its contour area meets the first hole condition. When the first hole condition is met, continue to determine whether its hole centroid pixel and contour area meet the second hole condition.

5. A method for detecting the number of rod-shaped materials in a disk box according to claim 3 or 4, characterized in that: The first hole condition is that the contour area is between the set upper limit and the set lower limit; the second hole condition is that the hole centroid pixel and the contour area are greater than the set value.

6. A device for detecting the number of rod-shaped materials in a tray box, characterized in that: include: An image preprocessing module, used for acquiring a disk box image and preprocessing the disk box image; The material recognition and statistics module detects stick-shaped materials on the preprocessed disk box image based on threshold segmentation and Hough circle detection, and determines the number of stick-shaped materials in the disk box image based on the stick-shaped material detection result; A hole recognition module performs hole recognition detection on the preprocessed disk box image based on a contour extraction method, and determines the number of holes in the disk box image based on the hole recognition detection result; The output module calculates the difference between the number of rod-shaped materials and the number of cavities, and the difference is the final number of rod-shaped materials in the tray box.

7. A system for detecting the number of rod-shaped materials in a tray box, comprising an industrial camera, a bar light source, a light source fixing bracket, a height adjustment column, a camera fixing plate, a camera cover and an industrial computer; The industrial camera is fixed on a camera fixing plate and is used to capture images of the tray box filled with materials; The light source fixing bracket is distributed on the tray loading machine frame in four directions of up, down, left and right in front of the industrial camera, and is used to fix the strip light source; The strip light source is used for ambient fill light during image acquisition; The height adjustment column is installed on the bottom plate of the tray loading machine push cylinder and is used for adjusting the height of the industrial camera; The industrial computer is installed in an electric control cabinet and is used to run the method for detecting the number of rod-shaped materials in a disk box as described in any one of claims 1-6.

8. A system for detecting the number of rod-shaped materials in a disk box according to claim 7, characterized in that: A camera fixing plate is also provided, which is fixed on the height adjustment column. Four long holes are provided on the camera fixing plate, and the front and rear positions of the industrial camera are adjusted by cooperating with the studs.

9. A system for detecting the number of rod-shaped materials in a disk box according to claim 7, characterized in that: A camera cover is also provided on the camera fixing plate.

10. A system for detecting the number of rod-shaped materials in a disk box according to any one of claims 7 to 9, characterized in that: The light source fixing bracket is provided with an annular hole to adjust the angle of the light source.