A visual inspection method, system, apparatus and storage medium
By applying Gaussian filtering and the maximum inter-class variance method to the V-channel image of the toner-added filter rod in the viewing window, the quality parameters of the viewing window region are calculated, which solves the problem of low detection accuracy of the toner-added filter rod in the existing technology and achieves efficient defect detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUBEI CHINA TOBACCO INDUSTRY CO LTD
- Filing Date
- 2022-09-27
- Publication Date
- 2026-05-19
AI Technical Summary
Existing visual inspection methods have low accuracy in detecting defects in windowed toner filter sticks and cannot effectively screen out defective sticks.
By acquiring the V-channel image of the toner-filled filter rod in the window, Gaussian filtering and Otsu's method are applied to calculate the width, phase value, toner filling ratio, and toner color value of the window area. The filter rod quality is then judged by comparing these values with preset standards.
It improves the accuracy of defect detection for the window-type powder filter stick, effectively filters out defective sticks, and reduces the false detection rate.
Smart Images

Figure CN115587974B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of visual inspection technology, and in particular to a visual inspection method; this application also relates to a visual inspection system, device and storage medium. Background Technology
[0002] The production process of cigarette filter sticks inevitably produces defective products. Screening and removing these defective products is a crucial step in improving the overall quality of cigarette filter sticks. With the continuous development and advancement of machine vision hardware and software technologies, visual inspection technology has been widely applied to cigarette filter stick production lines. The high speed and accuracy of online visual inspection methods can significantly improve the efficiency and automation of defect detection in cigarette filter sticks.
[0003] Existing visual inspection methods are only suitable for detecting defects in composite sticks and popping bead sticks. Due to variations in the amount of powder added to the window-adding filter stick and the instability of image features in the powder-adding area, existing visual inspection methods have a very high error rate when detecting window-adding filter sticks.
[0004] Therefore, how to improve the accuracy of visual inspection methods for detecting defects in window-powdered filter rods is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] To address the aforementioned technical problems, this application provides a visual inspection method that can improve the accuracy of defect detection in window-filled filter rods. This application also provides a visual inspection system, apparatus, and storage medium, which have the same technical effects.
[0006] The first objective of this application is to provide a visual inspection method.
[0007] The aforementioned objective of this application is achieved through the following technical solution:
[0008] A visual inspection method for detecting a toner-filled filter rod in a viewing window includes the following steps:
[0009] Obtain the V-channel plot of the filter rod under test;
[0010] The V-channel image is processed to obtain a first binary image;
[0011] The first binary image is processed to obtain the second binary image;
[0012] The second binary image is processed to obtain a mask image of the viewport region;
[0013] The quality parameters are obtained based on the mask image of the viewport area;
[0014] Based on the comparison results between the quality parameters and the preset standards, it is determined whether the filter rod to be tested is qualified.
[0015] The quality parameters include the width of each viewport area, the phase value of each viewport area, the powder fill ratio of each viewport area, and the powder color value of each powder area.
[0016] Preferably, in the visual inspection method, obtaining the V-channel image of the filter rod to be tested includes:
[0017] Acquire a three-channel color image of the filter rod to be tested, and perform color space conversion on the three-channel color image to obtain the HSV channel image of the filter rod to be tested;
[0018] Channel separation is performed on the HSV channel diagram to obtain the V channel diagram of the filter rod under test.
[0019] Preferably, in the visual detection method, processing the V-channel image to obtain the first binary image includes:
[0020] The V-channel image is subjected to Gaussian filtering, and the first binary image is obtained according to the maximum inter-class variance method.
[0021] Preferably, in the visual detection method, processing the first binary image to obtain a second binary image includes:
[0022] The first binary image is processed by row integration, and the second binary image is obtained by using the Otsu's method.
[0023] Preferably, in the visual detection method, processing the second binary image to obtain a mask image of the viewport region includes:
[0024] The second binary image is scaled to make it the same size as the V channel image, and then morphological erosion is performed to obtain a mask image of the viewport area.
[0025] Preferably, in the visual inspection method, obtaining the quality parameters based on the mask image of the viewing window region includes:
[0026] The mask image of the viewport is contour-fitted to obtain the area of each viewport, the vertical width of each viewport, and the phase position of each viewport.
[0027] The width of each window region is obtained by multiplying its vertical width by a preset vertical pixel precision.
[0028] Multiply the phase position of each window region by a preset longitudinal phase precision to obtain the phase value of each window region;
[0029] Based on the phase position of each viewport region, the region of interest map of each viewport region in the V-channel image is obtained. Then, according to the maximum inter-class variance method, the binary map of each powder region is obtained. Morphological closing operation is performed on the binary map of each powder region, followed by contour fitting, to obtain the area of each powder region. The area of each powder region is divided by the area of the corresponding viewport region to obtain the powder filling ratio of each viewport region.
[0030] Based on each powder region, a region of interest map for each window region of the HSV channel map is obtained. The HSV values of all pixels in the region of interest map for each window region of the HSV channel map are compared with a preset standard comparison table to obtain the powder color value of each powder region.
[0031] Preferably, in the visual inspection method, determining whether the filter rod to be tested is qualified based on the comparison result of the quality parameter and the preset standard includes:
[0032] The width of each viewing area is compared with a preset standard width to determine whether the width of each viewing area falls within the preset standard width range. If not, the filter rod under test is determined to be a defective rod; if so, then:
[0033] The phase value of each viewing window region is compared with a preset standard phase value to determine whether the phase value of each viewing window region is within the range of the preset standard phase value. If not, the filter rod under test is determined to be a defective rod; if so, then:
[0034] The powder filling ratio of each viewing window area is compared with a preset standard filling ratio to determine whether the powder filling ratio of each viewing window area is within the range of the preset standard filling ratio. If not, the filter rod to be tested is determined to be a defective rod; if so, then:
[0035] The color value of the powder in each powder area is compared with the preset standard color value to determine whether the color value of the powder in each powder area is within the range of the preset standard color value. If not, the filter rod to be tested is determined to be a defective rod; if so, the filter rod to be tested is determined to be a qualified rod.
[0036] The second objective of this application is to provide a visual inspection system.
[0037] The second objective of this application is achieved through the following technical solution:
[0038] A visual inspection system for inspecting a toner-filled filter rod in a viewing window, comprising:
[0039] V-channel image acquisition unit, used to acquire the V-channel image of the filter rod under test;
[0040] The first binary image acquisition unit is used to process the V-channel image to obtain the first binary image;
[0041] The second binary image acquisition unit is used to process the first binary image to obtain a second binary image;
[0042] The mask image acquisition unit for the viewport region is used to process the second binary image to obtain the mask image of the viewport region.
[0043] The quality parameter acquisition unit is used to obtain quality parameters based on the mask image of the viewport area;
[0044] The quality parameter comparison unit is used to determine whether the filter rod to be tested is qualified based on the comparison result between the quality parameters and the preset standard.
[0045] The quality parameters include the width of each viewport area, the phase value of each viewport area, the powder fill ratio of each viewport area, and the powder color value of each powder area.
[0046] The third objective of this application is to provide a visual inspection device.
[0047] The aforementioned objective three of this application is achieved through the following technical solution:
[0048] A visual inspection device for inspecting a toner filter rod with a viewing window includes a storage medium and a processor. The storage medium stores computer instructions that can be executed on the processor. When the processor executes the computer instructions, it performs the steps of any of the visual inspection methods described above.
[0049] The fourth objective of this application is to provide a computer-readable storage medium having computer instructions stored thereon.
[0050] The fourth objective of this application is achieved through the following technical solution:
[0051] A computer-readable storage medium having computer instructions stored thereon, which, when executed, perform the steps in any of the above-described visual inspection methods.
[0052] In summary, the above technical solution is based on visual inspection technology and, taking into account the actual characteristics of the window-filling filter rod, first accurately calculates the quality parameters of the window-filling filter rod, namely the width of each window area, the phase value of each window area, the powder filling ratio of each window area, and the powder color value of each powder area. Then, the above quality parameters are compared with preset standards to screen out defective rods in the window-filling filter rod, effectively improving the accuracy of defect detection of the window-filling filter rod. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 This is a flowchart of a visual detection method provided in one embodiment of this application;
[0055] Figure 2 This is a flowchart illustrating the steps for comparing quality parameters in another embodiment of this application;
[0056] Figure 3 This is a structural diagram of a visual inspection system provided in another embodiment of this application;
[0057] Figure 4 This is a structural diagram of a visual inspection device provided in another embodiment of this application. Detailed Implementation
[0058] To enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0059] It should be understood that the use of terms such as "system," "device," and "unit" in this application is merely a method of distinguishing different components, elements, parts, sections, or assemblies at different levels. However, if other terms can achieve the same purpose, they can be replaced by other expressions.
[0060] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0061] The inventors of this application have discovered that existing visual inspection methods are only suitable for detecting defects in composite sticks and menthol sticks. Due to variations in the amount of powder added to the window-filled filter stick and the instability of image features in the powder-filled area, existing visual inspection methods have a very high error rate when detecting window-filled filter sticks. Based on this, this application provides a visual inspection solution that, considering the actual characteristics of the window-filled filter stick, first accurately calculates the quality parameters of the window-filled filter stick, namely the width of each window area, the phase value of each window area, the powder filling ratio of each window area, and the powder color value of each powder area. Then, the above quality parameters are compared with preset standards to screen out defective sticks in the window-filled filter sticks, thereby improving the accuracy of defect detection for window-filled filter sticks.
[0062] In one embodiment of this application, a visual inspection method is provided for detecting a toner filter rod in a viewing window, such as... Figure 1 As shown, the method includes the following steps:
[0063] S1. Obtain the V-channel diagram of the filter rod to be tested;
[0064] In S1, the V channel refers to one of the three channels in the HSV color space. The V channel represents brightness. In this embodiment, the V channel image can be separated from the HSV channel image of the filter rod under test. The specific acquisition method does not affect the implementation of this embodiment.
[0065] In a preferred embodiment, S1 specifically includes: acquiring a three-channel color image of the filter rod to be tested; performing color space conversion on the three-channel color image to obtain an HSV channel image of the filter rod to be tested; and performing channel separation on the HSV channel image to obtain a V channel image of the filter rod to be tested.
[0066] Optionally, a three-channel color image of the filter rod under test is obtained by using dual light sources from the front and back; optionally, the color space conversion can be performed from RGB to HSV according to the following rules:
[0067]
[0068]
[0069] v = max
[0070] Where r, g, and b represent the red, green, and blue coordinates of a color, respectively, and their values are real numbers between 0 and 1. max is equal to the largest of r, g, and b, min is equal to the smallest of r, g, and b, and h, s, and v represent the hue, saturation, and brightness of a color, respectively.
[0071] Alternatively, the channel separation can be accomplished using OpenCV's split function.
[0072] S2. Process the V-channel image to obtain a first binary image;
[0073] In S2, processing the V channel image includes: performing noise reduction processing on the V channel image, and then performing binarization processing on the V channel image that has undergone noise reduction processing; the first binary image can reflect the segmentation of the powdered part and other parts in the image.
[0074] In a preferred embodiment, S2 specifically includes: performing Gaussian filtering on the V channel image and obtaining a first binary image according to the maximum inter-class variance method.
[0075] The Gaussian filtering is used to reduce noise in the V-channel image to obtain an image with a high signal-to-noise ratio. The Otsu's method, a commonly used method for automatically determining thresholds in thresholding, is used here to segment the denoised image. Optionally, the V-channel image is processed by Gaussian filtering with a kernel size of 3, and then the Otsu's method is used to obtain a first binary image in which the areas not filled with powder at the viewport position are marked as 1, and the remaining areas are marked as 0.
[0076] The Gaussian filtering processing logic is as follows:
[0077] (1) Calculate the Gaussian matrix H×W As shown in the following formula:
[0078] gaussMatrix H×W =[gauss(r,c,σ)] 0≤r≤H-1,0≤c≤W-1,r∈N,c∈N
[0079] in,
[0080]
[0081] In the formula, gauss represents a two-dimensional Gaussian function, H is the height of the kernel, W is the width of the kernel, r and c represent position indices, and σ is the variance parameter of the Gaussian distribution, where 0≤c≤W-1, 0≤r≤H-1, and r and c are both integers.
[0082] (2) Calculate the sum of the Gaussian matrices: sum(gaussMatrix) H×W )
[0083] Here, sum represents the summation function.
[0084] (3) Normalize the Gaussian matrix to obtain the Gaussian convolution operator GaussKernel. H×W As shown in the following formula:
[0085] gaussKernelH×W =gaussMatrix / sum(gaussMatrix)
[0086] (4) Multiply the V-channel image with the convolution kernel and perform Gaussian filtering: V = V·gaussKernel H×W
[0087] Where V represents the V-channel map, and the convolution kernel is the Gaussian convolution operator. H×W .
[0088] The logic of the Otsu's method is as follows:
[0089] (1) Calculate the zero-order cumulative moment zeroCumuMoment(k) of the gray-level histogram:
[0090]
[0091] The input image is I, histogram I Histogram represents the normalized image grayscale histogram. I (k) represents the proportion of pixels with gray values equal to k in the image, where k∈[0,255]
[0092] (2) Calculate the first-order cumulative moment oneCumuMoment(k) of the gray-level histogram:
[0093]
[0094] (3) Calculate the mean gray level of the entire image I, which is actually the first-order cumulative moment when k = 255:
[0095] mean = oneCumuMoment(255)
[0096] (4) Calculate the variance σ of the average gray level of the foreground region, the average gray level of the background region, and the average gray level of the entire image when each gray level is used as a threshold. 2 (k), the variance is measured using the following metrics:
[0097]
[0098] (5) Find the largest σ mentioned above. 2 (k), and then the corresponding k is the threshold automatically selected by the Otsu's method, i.e.
[0099] thresh = arg k∈[0,255] max[σ 2 (k)]
[0100] Here, thresh represents the threshold, and argmax is the function that maximizes the independent variable. The formula is used to solve for σ. 2 The maximum value of k corresponds to the value of k in [0, 255].
[0101] The logic for obtaining the first binary image is as follows:
[0102]
[0103] Where x represents the grayscale value and thresh represents the threshold.
[0104] S3. Process the first binary image to obtain the second binary image;
[0105] In S3, processing the first binary image includes: performing integration processing on the first binary image, and then performing binarization processing on the first binary image that has undergone integration processing; wherein, the integration processing can reduce the computational load of subsequent image processing.
[0106] In a preferred embodiment, step S3 specifically includes: performing row integration on the first binary image and obtaining a second binary image according to the maximum inter-class variance method.
[0107] The row integration process involves performing row integration on the first binary image to obtain a row integral image, which reduces the computational load of subsequent image processing and improves computational speed. The process of obtaining the second binary image using the maximum inter-class variance method involves performing binarization processing on the row integral image using the maximum inter-class variance method to obtain the second binary image.
[0108] S4. Process the second binary image to obtain the mask image of the viewport area;
[0109] In S4, processing the second binary image includes: converting the image size of the second binary image, and then performing boundary shrinking processing on the second binary image that has undergone image size conversion; wherein, the image size conversion can be determined according to the needs of the actual detection task, and the mask image of the window area is mainly used for subsequent control of the image processing area.
[0110] In a preferred embodiment, S4 specifically includes: performing image scaling on the second binary image to make the second binary image the same size as the V channel image, and then performing morphological erosion operation to obtain a mask image of the viewport region.
[0111] The image scaling process is used to make the size of the mask image of the viewport region obtained later consistent with the size of the V channel image, so as to facilitate the subsequent extraction of the region of interest of the V channel image; the morphological erosion operation is used to eliminate the boundary points of the image, causing the boundary points to shrink inward; optionally, the second binary image is resized to the size of the V channel image, and then a morphological erosion operation is performed with a kernel of size 3 to obtain the mask image of the viewport region.
[0112] Optionally, the image scaling (resize) can be performed using the OpenCV resize function; the morphological erosion operation can be performed using the OpenCV cvErode function.
[0113] S5. Obtain the quality parameters based on the mask image of the viewing window area;
[0114] In S5, the quality parameters include the width of each window region, the phase value of each window region, the powder filling ratio of each window region, and the powder color value of each powder region.
[0115] In a preferred embodiment, S5 specifically includes:
[0116] The mask image of the viewport is contour-fitted to obtain the area of each viewport, the vertical width of each viewport, and the phase position of each viewport.
[0117] The width of each window region is obtained by multiplying its vertical width by a preset vertical pixel precision.
[0118] Multiply the phase position of each window region by a preset longitudinal phase precision to obtain the phase value of each window region;
[0119] Based on the phase position of each viewport region, the region of interest map of each viewport region in the V-channel image is obtained. Then, according to the maximum inter-class variance method, the binary map of each powder region is obtained. Morphological closing operation is performed on the binary map of each powder region, followed by contour fitting, to obtain the area of each powder region. The area of each powder region is divided by the area of the corresponding viewport region to obtain the powder filling ratio of each viewport region.
[0120] Based on each powder region, a region of interest map for each window region of the HSV channel map is obtained. The HSV values of all pixels in the region of interest map for each window region of the HSV channel map are compared with a preset standard comparison table to obtain the powder color value of each powder region.
[0121] S6. Based on the comparison results between the quality parameters and the preset standards, determine whether the filter rod to be tested is qualified.
[0122] In step S6, the quality parameters are compared with preset standards to obtain comparison results. Based on the comparison results, it can be determined whether the filter rod to be tested is qualified, thereby realizing the defect detection of the filter rod to be tested.
[0123] In a preferred embodiment, S6, as... Figure 2 As shown, it specifically includes:
[0124] S61. Compare the width of each window area with a preset standard width to determine whether the width of each window area is within the range of the preset standard width. If not, execute S65; if yes, execute S62.
[0125] S62. Compare the phase value of each window region with a preset standard phase value to determine whether the phase value of each window region is within the range of the preset standard phase value. If not, execute S65; if yes, execute S63.
[0126] S63. The powder filling ratio of each window area is compared with the preset standard filling ratio to determine whether the powder filling ratio of each window area is within the range of the preset standard filling ratio. If not, proceed to S65; if yes, proceed to S64.
[0127] S64. Compare the powder color value of each powder area with the preset standard color value, and determine whether the powder color value of each powder area is within the range of the preset standard color value. If not, proceed to S65; if yes, proceed to S66.
[0128] S65. Determine that the filter rod to be tested is a defective rod;
[0129] S66. Determine that the filter rod to be tested is a qualified rod.
[0130] In S61, optionally, the range of the preset standard width is [4mm, 6mm]; optionally, S62 specifically involves taking the difference between the phase value of each window area and the preset standard phase value, and determining whether the absolute value of each difference is less than or equal to 1mm. If not, proceed to S65; if yes, proceed to S63; in S64, optionally, the range of the preset standard fill ratio is [0.3, 0.7]; in S65, optionally, the range of the preset standard color value is [lowerb, upperb], where lowerb is the lower limit of the preset color value range and upperb is the upper limit of the preset color value range; optionally, S61, S62, and S6... The judgment contents in S61, S62, S63, and S64 can be interchanged without affecting the implementation of this embodiment. Optionally, the judgment contents in S61, S62, S63, and S64 can also be performed simultaneously, and then all judgment results are summarized to finally confirm whether the filter rod to be tested is qualified. This does not affect the implementation of this embodiment. Optionally, according to the needs of the actual testing task, only some parameters in the quality parameters can be compared with the preset standard to obtain the corresponding defect detection results. For example, if only the width of each window area and the phase value of each window area need to be detected for defects, then in the above preferred embodiment, S63 and S64 can be adaptively deleted without affecting the implementation of this embodiment.
[0131] In the above embodiment, through steps S1 to S5, the quality parameters of the window-filling filter rod are accurately calculated based on its actual characteristics, namely the width of each window area, the phase value of each window area, the powder filling ratio of each window area, and the powder color value of each powder area. Then, through step S6, the quality parameters are compared with a preset standard to screen out defective filters in the window-filling filter rod, effectively improving the accuracy of defect detection for the window-filling filter rod.
[0132] In another embodiment of this application, a visual inspection system is provided for detecting a toner filter rod in a viewing window, such as... Figure 3 As shown, the system includes:
[0133] V-channel image acquisition unit 10 is used to acquire the V-channel image of the filter rod under test;
[0134] The first binary image acquisition unit 11 is used to process the V channel image to obtain the first binary image;
[0135] The second binary image acquisition unit 12 is used to process the first binary image to obtain a second binary image;
[0136] The mask image acquisition unit 13 for the viewport area is used to process the second binary image to obtain the mask image of the viewport area;
[0137] The quality parameter acquisition unit 14 is used to obtain quality parameters based on the mask image of the viewing window area;
[0138] The quality parameter comparison unit 15 is used to determine whether the filter rod to be tested is qualified based on the comparison result between the quality parameter and the preset standard.
[0139] The quality parameters include the width of each viewport area, the phase value of each viewport area, the powder fill ratio of each viewport area, and the powder color value of each powder area.
[0140] In another embodiment of this application, a visual inspection device is also provided for detecting a powder filter rod in a viewing window, such as... Figure 4 As shown, the device includes a storage medium 16 and a processor 17. The storage medium 16 stores computer instructions that can be executed on the processor. When the processor 17 executes the computer instructions, it performs the steps in any of the above-described visual inspection methods.
[0141] The processor 17 may include one or more processing cores. The processor 17 executes instructions, programs, code sets, or instruction sets stored in the storage medium 16, and calls data stored in the storage medium 16 to perform various functions and process data according to this application. The processor 17 may be at least one of a specific application-specific integrated circuit, a digital signal processor, a digital signal processing device, a programmable logic device, a field-programmable gate array, a central processing unit, a controller, a microcontroller, and a microprocessor. It is understood that, for different devices, the electronic devices used to implement the functions of the processor 17 may also be other types.
[0142] The storage medium 16 can be used to store instructions, programs, code, code sets, or instruction sets. The storage medium 16 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for at least one function, and instructions for implementing any of the aforementioned visual inspection methods; the data storage area may store data involved in any of the aforementioned visual inspection methods.
[0143] In another embodiment of this application, a computer-readable storage medium is also provided, on which computer instructions are stored, which, when executed, perform the steps in any of the above-described visual inspection methods.
[0144] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A visual inspection method for detecting a filter rod with added powder in a viewing window, characterized in that, include: Obtain the V-channel plot of the filter rod under test; The V-channel image is processed to obtain a first binary image; The first binary image is processed to obtain the second binary image; The second binary image is processed to obtain a mask image of the viewport region; The quality parameters are obtained based on the mask image of the viewport area; Based on the comparison results between the quality parameters and the preset standards, it is determined whether the filter rod to be tested is qualified. The quality parameters include the width of each window area, the phase value of each window area, the powder filling ratio of each window area, and the powder color value of each powder area; The process of obtaining the V-channel map of the filter rod to be tested includes: Acquire a three-channel color image of the filter rod to be tested, and perform color space conversion on the three-channel color image to obtain the HSV channel image of the filter rod to be tested; Channel separation is performed on the HSV channel diagram to obtain the V channel diagram of the filter rod under test; The process of processing the V-channel image to obtain the first binary image includes: The V-channel image is subjected to Gaussian filtering, and a first binary image is obtained according to the maximum inter-class variance method. The process of processing the first binary image to obtain the second binary image includes: Perform row integral processing on the first binary image and obtain the second binary image according to the Otsu's method; The process of processing the second binary image to obtain the mask image of the viewport region includes: The second binary image is scaled to make it the same size as the V channel image, and then morphological erosion is performed to obtain a mask image of the viewport area. The process of obtaining quality parameters based on the mask map of the viewport area includes: The mask image of the viewport is contour-fitted to obtain the area of each viewport, the vertical width of each viewport, and the phase position of each viewport. The width of each window region is obtained by multiplying its vertical width by a preset vertical pixel precision. Multiply the phase position of each window region by a preset longitudinal phase precision to obtain the phase value of each window region; Based on the phase position of each viewport region, the region of interest map of each viewport region in the V-channel image is obtained. Then, according to the maximum inter-class variance method, the binary map of each powder region is obtained. Morphological closing operation is performed on the binary map of each powder region, followed by contour fitting, to obtain the area of each powder region. The area of each powder region is divided by the area of the corresponding viewport region to obtain the powder filling ratio of each viewport region. Based on each powder region, a region of interest map for each window region of the HSV channel map is obtained. The HSV values of all pixels in the region of interest map for each window region of the HSV channel map are compared with a preset standard comparison table to obtain the powder color value of each powder region.
2. The visual inspection method according to claim 1, characterized in that, The step of determining whether the filter rod to be tested is qualified based on the comparison result of the quality parameters and the preset standard includes: The width of each viewing area is compared with a preset standard width to determine whether the width of each viewing area falls within the range of the preset standard width. If not, the filter rod under test is determined to be a defective rod; if so, then: The phase value of each viewing window region is compared with a preset standard phase value to determine whether the phase value of each viewing window region is within the range of the preset standard phase value. If not, the filter rod under test is determined to be a defective rod; if so, then: The powder filling ratio of each viewing window area is compared with a preset standard filling ratio to determine whether the powder filling ratio of each viewing window area is within the range of the preset standard filling ratio. If not, the filter rod to be tested is determined to be a defective rod; if so, then: The powder color value of each powder area is compared with the preset standard color value to determine whether the powder color value of each powder area is within the range of the preset standard color value. If not, the filter rod to be tested is determined to be a defective rod; if so, the filter rod to be tested is determined to be a qualified rod.
3. A visual inspection system for inspecting a filter rod with added powder in a viewing window, characterized in that, Applied to the visual detection method of claim 1, comprising: V-channel image acquisition unit, used to acquire the V-channel image of the filter rod under test; The first binary image acquisition unit is used to process the V-channel image to obtain the first binary image; The second binary image acquisition unit is used to process the first binary image to obtain a second binary image; The mask image acquisition unit for the viewport region is used to process the second binary image to obtain the mask image of the viewport region. The quality parameter acquisition unit is used to obtain quality parameters based on the mask image of the viewport area; The quality parameter comparison unit is used to determine whether the filter rod to be tested is qualified based on the comparison result between the quality parameters and the preset standard. The quality parameters include the width of each viewport area, the phase value of each viewport area, the powder fill ratio of each viewport area, and the powder color value of each powder area.
4. A visual inspection device for inspecting a filter rod with added powder in a viewing window, characterized in that, The method includes a storage medium and a processor, wherein the storage medium stores computer instructions that can be executed on the processor, and the processor executes the steps of the method according to any one of claims 1 to 2 when executing the computer instructions.
5. A computer-readable storage medium storing computer instructions thereon, characterized in that, The computer instructions, when executed, perform the steps of the method according to any one of claims 1 to 2.